public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PTACH] libcacard: fix VCARD_ATTR_PREFIX macro
@ 2012-03-18 17:41 Marcel Heinz
  2012-03-18 19:23 ` Alon Levy
  0 siblings, 1 reply; 3+ messages in thread
From: Marcel Heinz @ 2012-03-18 17:41 UTC (permalink / raw)
  To: kvm

Hi,

i just tried to compile lastest git HEAD and ran into the following
problem:

vcard_emul_nss.c:528:1: error: initializer element is not constant

The source code is:
static const unsigned char nss_atr[] = { VCARD_ATR_PREFIX(3), 'N', 'S', 'S' };

with

#define VCARD_ATR_PREFIX(size) (0x3b, 0x68+(size), 0x00, 0xff, \
                                'V', 'C', 'A', 'R', 'D', '_')

The parentheses in this macro result in the use of the comma operator
in the initialization and are clearly not correct. This is a regression
from commit 0082f4336e128a17d5f34e01de0fd29930e99b0d, which changed
0x66+(size) to 0x68+size and added the parenthesis.

So I propose the following patch:

diff --git a/libcacard/vcardt.h b/libcacard/vcardt.h
index d4d8e2e..d3e9522 100644
--- a/libcacard/vcardt.h
+++ b/libcacard/vcardt.h
@@ -26,8 +26,8 @@ typedef struct VCardEmulStruct VCardEmul;
 #define MAX_CHANNEL 4

 /* create an ATR with appropriate historical bytes */
-#define VCARD_ATR_PREFIX(size) (0x3b, 0x68+(size), 0x00, 0xff, \
-                               'V', 'C', 'A', 'R', 'D', '_')
+#define VCARD_ATR_PREFIX(size) 0x3b, 0x68+(size), 0x00, 0xff, \
+                               'V', 'C', 'A', 'R', 'D', '_'


 typedef enum {



Regards,
	Marcel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PTACH] libcacard: fix VCARD_ATTR_PREFIX macro
  2012-03-18 17:41 [PTACH] libcacard: fix VCARD_ATTR_PREFIX macro Marcel Heinz
@ 2012-03-18 19:23 ` Alon Levy
  2012-03-19  8:51   ` Marcel Heinz
  0 siblings, 1 reply; 3+ messages in thread
From: Alon Levy @ 2012-03-18 19:23 UTC (permalink / raw)
  To: Marcel Heinz; +Cc: kvm

On Sun, Mar 18, 2012 at 06:41:18PM +0100, Marcel Heinz wrote:
> Hi,
> 

Thanks for the patch, but I think you are using a not up to date tree,
it's fixed by:


commit 0202181245297a9e847c05f4a18623219d95e93e
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Fri Mar 2 16:49:44 2012 +0100

    libcacard: Fix compilation with gcc-4.7

(same fix).

Alon
> i just tried to compile lastest git HEAD and ran into the following
> problem:
> 
> vcard_emul_nss.c:528:1: error: initializer element is not constant
> 
> The source code is:
> static const unsigned char nss_atr[] = { VCARD_ATR_PREFIX(3), 'N', 'S', 'S' };
> 
> with
> 
> #define VCARD_ATR_PREFIX(size) (0x3b, 0x68+(size), 0x00, 0xff, \
>                                 'V', 'C', 'A', 'R', 'D', '_')
> 
> The parentheses in this macro result in the use of the comma operator
> in the initialization and are clearly not correct. This is a regression
> from commit 0082f4336e128a17d5f34e01de0fd29930e99b0d, which changed
> 0x66+(size) to 0x68+size and added the parenthesis.
> 
> So I propose the following patch:
> 
> diff --git a/libcacard/vcardt.h b/libcacard/vcardt.h
> index d4d8e2e..d3e9522 100644
> --- a/libcacard/vcardt.h
> +++ b/libcacard/vcardt.h
> @@ -26,8 +26,8 @@ typedef struct VCardEmulStruct VCardEmul;
>  #define MAX_CHANNEL 4
> 
>  /* create an ATR with appropriate historical bytes */
> -#define VCARD_ATR_PREFIX(size) (0x3b, 0x68+(size), 0x00, 0xff, \
> -                               'V', 'C', 'A', 'R', 'D', '_')
> +#define VCARD_ATR_PREFIX(size) 0x3b, 0x68+(size), 0x00, 0xff, \
> +                               'V', 'C', 'A', 'R', 'D', '_'
> 
> 
>  typedef enum {
> 
> 
> 
> Regards,
> 	Marcel
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PTACH] libcacard: fix VCARD_ATTR_PREFIX macro
  2012-03-18 19:23 ` Alon Levy
@ 2012-03-19  8:51   ` Marcel Heinz
  0 siblings, 0 replies; 3+ messages in thread
From: Marcel Heinz @ 2012-03-19  8:51 UTC (permalink / raw)
  To: Alon Levy; +Cc: kvm

Hi,

Alon Levy <alevy@redhat.com> wrote:
> Thanks for the patch, but I think you are using a not up to date tree,
> it's fixed by:
>
>
> commit 0202181245297a9e847c05f4a18623219d95e93e
> Author: Hans de Goede <hdegoede@redhat.com>
> Date:   Fri Mar 2 16:49:44 2012 +0100
>
>     libcacard: Fix compilation with gcc-4.7
>
> (same fix).

My fault, sorry for the noise.

Regards,
	Marcel



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-19  8:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-18 17:41 [PTACH] libcacard: fix VCARD_ATTR_PREFIX macro Marcel Heinz
2012-03-18 19:23 ` Alon Levy
2012-03-19  8:51   ` Marcel Heinz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox