[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: #if __GNUC__ > 2 ..
From: |
Mark H Weaver |
Subject: |
Re: #if __GNUC__ > 2 .. |
Date: |
Sun, 18 Jun 2017 15:33:31 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
Jan Nieuwenhuizen <address@hidden> writes:
> Hi Matt!
>
> When I use Nyacc to parse things like
>
> #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
> # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
> #else
> # define _GL_ATTRIBUTE_PURE /* empty */
> #endif
>
> I get
>
> foo.c:1: undefined identifier: "__GNUC__"
> foo.c:1: CPP error
This looks like a problem in Nyacc. Within the condition of an "#if" or
"#elif" preprocessor form, after macro expansion is performed, all
remaining identifiers are replaced with 0. See section 6.10.1
(Conditional inclusion) paragraph 4 of C99.
Mark