bison-patches
[Top][All Lists]
Advanced

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

Re: AIX with Visual Age C compiler fails to compile 2.1 and later


From: Paul Eggert
Subject: Re: AIX with Visual Age C compiler fails to compile 2.1 and later
Date: Wed, 12 Oct 2005 23:26:40 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

"John P. Hartmann" <address@hidden> writes:

>     How about the macro __C99__FUNC__?
>
>
> Yes, it is defined with the value 1 when using cc.

Thanks for checking this.

> It is undefined with xlc.

xlc doesn't support C99 by default?  Yet another reason not to use xlc.

Anyway, I installed this patch into Bison:

2005-10-12  Paul Eggert  <address@hidden>

        * data/c.m4 (b4_c_function_def): Look at __C99_FUNC__, not at
        __STDC_VERSION__, as IBM cc 7.0 doesn't define the latter either.
        Problem reported by John P. Hartmann.
        * data/yacc.c (YYMODERN_C): Likewise.  Don't define if the user has
        already defined it.

--- data/c.m4   11 Oct 2005 05:36:04 -0000      1.37
+++ data/c.m4   13 Oct 2005 06:19:48 -0000
@@ -232,7 +232,7 @@ m4_define([b4_token_enums_defines],
 # ----------------------------------------------------------
 # Declare the function NAME.
 m4_define([b4_c_function_def],
-[#if defined (__STDC__) || defined (__STDC_VERSION__) || defined (__cplusplus)
+[#if defined (__STDC__) || defined (__C99__FUNC__) || defined (__cplusplus)
 b4_c_ansi_function_def($@)
 #else
 $2
--- data/yacc.c 11 Oct 2005 05:36:04 -0000      1.114
+++ data/yacc.c 13 Oct 2005 06:19:48 -0000
@@ -219,15 +219,17 @@ typedef struct YYLTYPE
 /* Line __line__ of yacc.c.  */
 b4_syncline(address@hidden@], address@hidden@])[
 
-/* Define YYMODERN_C if this compiler supports C89 or better.  Some
-   modern compilers (e.g., IBM xlc 7.0) don't define __STDC__ for
-   pedantic reasons, but they define __STDC_VERSION__ so check that
-   as well.  Consider a C++ compiler to be modern if it defines
-   __cplusplus.  */
-#if defined (__STDC__) || defined (__STDC_VERSION__) || defined (__cplusplus)
-# define YYMODERN_C 1
-#else
-# define YYMODERN_C 0
+/* Define YYMODERN_C if this compiler supports C89 or better.  If
+   __STDC__ is defined, the compiler is modern.  IBM xlc 7.0 when run
+   as 'cc' doesn't define __STDC__ (or __STDC_VERSION__) for pedantic
+   reasons, but it defines __C99__FUNC__ so check that as well.
+   Consider a C++ compiler to be modern if it defines __cplusplus.  */
+#ifndef YYMODERN_C
+# if defined (__STDC__) || defined (__C99__FUNC__) || defined (__cplusplus)
+#  define YYMODERN_C 1
+# else
+#  define YYMODERN_C 0
+# endif
 #endif
 
 #ifndef YYSIZE_T




reply via email to

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