Skip to contentSkip to conversation

libcacard: Fix compilation with gcc-4.7

PATCH Applied Hans de Goede 5 participants 7 messages Mar 2, 2012 – Mar 9, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libcacard: Fix compilation with gcc-4.7

VCARD_ATR_PREFIX is used as part of an array initializer so it should not have () around it, so far this happened to work, but gcc-4.7 does not like it.

---
 libcacard/vcardt.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
libcacard/vcardt.h +2 -2
index d4d8e2e..d3e9522 100644
@@ -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 {
Signature · 1 line
1.7.7.6
#1 lore raw
Quoted 3 lines · Hans de Goede

VCARD_ATR_PREFIX is used as part of an array initializer so it should not have () around it, so far this happened to work, but gcc-4.7 does not like it.

This recent commit..

libcacard: fix reported ATR length

Broke the build on my OpenBSD (gcc 4.2.1) buildbot which was due to the change to this macro.

vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect vcard_emul_nss.c:528: error: initializer element is not constant vcard_emul_nss.c:528: error: (near initialization for 'nss_atr[0]') gmake[1]: *** [vcard_emul_nss.o] Error 1

Quoted 20 lines
---
  libcacard/vcardt.h |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
libcacard/vcardt.h +2 -2
index d4d8e2e..d3e9522 100644
@@ -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 {
Signature · 3 lines
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
#2 lore raw
Quoted 5 lines · Brad Smith
Quoted 3 lines · Hans de Goede

VCARD_ATR_PREFIX is used as part of an array initializer so it should not have () around it, so far this happened to work, but gcc-4.7 does not like it.

Thanks for the report, my bad, used a different version of vcardt.h for compilation probably. This breaks on linux as well with gcc 4.7.0 .

Quoted 56 lines

This recent commit..

libcacard: fix reported ATR length

Broke the build on my OpenBSD (gcc 4.2.1) buildbot which was due to the change to this macro.

vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect
vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect
vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect
vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect
vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect
vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect
vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect
vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect
vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect
vcard_emul_nss.c:528: error: initializer element is not constant vcard_emul_nss.c:528: error: (near initialization for 'nss_atr[0]') gmake[1]: *** [vcard_emul_nss.o] Error 1

Quoted 20 lines
---
 libcacard/vcardt.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
libcacard/vcardt.h +2 -2
index d4d8e2e..d3e9522 100644
@@ -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 {
Signature · 3 lines
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
#3 lore raw
Quoted 9 lines · Alon Levy
Quoted 5 lines · Brad Smith
Quoted 3 lines · Hans de Goede

VCARD_ATR_PREFIX is used as part of an array initializer so it should not have () around it, so far this happened to work, but gcc-4.7 does not like it.

Thanks for the report, my bad, used a different version of vcardt.h for compilation probably. This breaks on linux as well with gcc 4.7.0 .

Please ignore the previous email.

Quoted 58 lines
Quoted 57 lines

This recent commit..

libcacard: fix reported ATR length

Broke the build on my OpenBSD (gcc 4.2.1) buildbot which was due to the change to this macro.

vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect
vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect
vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect
vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect
vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect
vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect
vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect
vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect
vcard_emul_nss.c:528: warning: left-hand operand of comma expression has no effect
vcard_emul_nss.c:528: error: initializer element is not constant vcard_emul_nss.c:528: error: (near initialization for 'nss_atr[0]') gmake[1]: *** [vcard_emul_nss.o] Error 1

Quoted 20 lines
---
 libcacard/vcardt.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
libcacard/vcardt.h +2 -2
index d4d8e2e..d3e9522 100644
@@ -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 {
Signature · 3 lines
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
#4 lore raw
In reply to Hans de Goede
Quoted 3 lines · Hans de Goede

VCARD_ATR_PREFIX is used as part of an array initializer so it should not have () around it, so far this happened to work, but gcc-4.7 does not like it.

Neither do gcc-4.6.2.

#5 lore raw
In reply to Hans de Goede

On Fri, Mar 02, 2012 at 04:49:44PM +0100, Hans de Goede wrote:

Ack. Anthony, this breaks build for libcacard, caused by my last commit to the same file as Brad noted:

commit 0082f4336e128a17d5f34e01de0fd29930e99b0d
Author: Alon Levy <[email protected]>
Date: Sun Feb 26 17:09:24 2012 +0100

libcacard: fix reported ATR length

Can you apply?

Thanks,
Alon

Quoted 28 lines

VCARD_ATR_PREFIX is used as part of an array initializer so it should not have () around it, so far this happened to work, but gcc-4.7 does not like it.

---
 libcacard/vcardt.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
libcacard/vcardt.h +2 -2
index d4d8e2e..d3e9522 100644
@@ -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 {
Signature · 1 line
1.7.7.6
#6 lore raw
In reply to Hans de Goede
Quoted 5 lines · Hans de Goede

VCARD_ATR_PREFIX is used as part of an array initializer so it should not have () around it, so far this happened to work, but gcc-4.7 does not like it.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 19 lines
---
  libcacard/vcardt.h |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
libcacard/vcardt.h +2 -2
index d4d8e2e..d3e9522 100644
@@ -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 {