[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

_AC_PROG_CC_C89 enhancement

From: Larry Jones
Subject: _AC_PROG_CC_C89 enhancement
Date: Thu, 22 Jun 2006 15:28:36 -0400 (EDT)

The IBM C compiler for AIX has a default mode that's almost, but not
quite, C89.  The differences mostly involve the preprocessor.  In
particular, macro parameters are substituted inside character constants
and string literals, which can be quite surprising if you're not
expecting it.  The current autoconf _AC_PROG_CC_C89 macro does not
detect this and thus does not add the appropriate flag to CC to fix it. 
Here's a fix:

--- c.m4.orig   Thu Jun 22 15:17:41 2006
+++ c.m4        Thu Jun 22 15:18:10 2006
@@ -1043,6 +1043,11 @@
    that's true only with -std.  */
 int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
 int test (int i, double x);
 struct s1 {int (*f) (int a);};
 struct s2 {int (*f) (double a);};

-Larry Jones

Talk about someone easy to exploit! -- Calvin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]