public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/48192] New: Conditional macros should not pass #ifdef
@ 2011-03-18 17:12 meissner at gcc dot gnu.org
  2011-03-18 17:24 ` [Bug preprocessor/48192] " meissner at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: meissner at gcc dot gnu.org @ 2011-03-18 17:12 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48192

           Summary: Conditional macros should not pass #ifdef
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
        AssignedTo: meissner@gcc.gnu.org
        ReportedBy: meissner@gcc.gnu.org
              Host: powerpc64-linux
            Target: powerpc64-linux
             Build: powerpc64-linux


The PowerPC port defines 3 conditional macros, vector, bool, and pixel in
non-standards complaint mode to implement the Altivec/VSX vector keywords.  The
rs6000 backend only expands these keywords if the next token is a type or
keyword that would be used for the Altivec/VSX vector support, to allow the
user to use these 'keywords' as normal identifiers.  So vector int foo; would
expand vector to the vector __attribute__ to define a vector type, but int
vector = 0 would not be expanded.

The Spu also defines vector as a conditional macro.

No other port currently uses conditional macros.

The problem is if the user does:
#ifndef bool
#define bool char
#endif
static bool variable = 0;

The #ifndef case will not succeed because 'bool' is a macro, but 'bool' will
not be expanded because it was not preceded with 'vector'.


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

* [Bug preprocessor/48192] Conditional macros should not pass #ifdef
  2011-03-18 17:12 [Bug preprocessor/48192] New: Conditional macros should not pass #ifdef meissner at gcc dot gnu.org
@ 2011-03-18 17:24 ` meissner at gcc dot gnu.org
  2011-03-18 23:40 ` meissner at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: meissner at gcc dot gnu.org @ 2011-03-18 17:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48192

--- Comment #1 from Michael Meissner <meissner at gcc dot gnu.org> 2011-03-18 17:20:34 UTC ---
Created attachment 23711
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23711
Patch to make conditional macros not 'defined'


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

* [Bug preprocessor/48192] Conditional macros should not pass #ifdef
  2011-03-18 17:12 [Bug preprocessor/48192] New: Conditional macros should not pass #ifdef meissner at gcc dot gnu.org
  2011-03-18 17:24 ` [Bug preprocessor/48192] " meissner at gcc dot gnu.org
@ 2011-03-18 23:40 ` meissner at gcc dot gnu.org
  2011-03-18 23:45 ` meissner at gcc dot gnu.org
  2011-04-01 18:53 ` meissner at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: meissner at gcc dot gnu.org @ 2011-03-18 23:40 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48192

Michael Meissner <meissner at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011.03.18 23:10:58
     Ever Confirmed|0                           |1


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

* [Bug preprocessor/48192] Conditional macros should not pass #ifdef
  2011-03-18 17:12 [Bug preprocessor/48192] New: Conditional macros should not pass #ifdef meissner at gcc dot gnu.org
  2011-03-18 17:24 ` [Bug preprocessor/48192] " meissner at gcc dot gnu.org
  2011-03-18 23:40 ` meissner at gcc dot gnu.org
@ 2011-03-18 23:45 ` meissner at gcc dot gnu.org
  2011-04-01 18:53 ` meissner at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: meissner at gcc dot gnu.org @ 2011-03-18 23:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48192

Michael Meissner <meissner at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #23711|0                           |1
        is obsolete|                            |

--- Comment #2 from Michael Meissner <meissner at gcc dot gnu.org> 2011-03-18 23:12:48 UTC ---
Created attachment 23719
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23719
Patch to correctly ignore conditional macros in #ifdef

The previous patch had a typo in it.  This patch is the corrected version.


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

* [Bug preprocessor/48192] Conditional macros should not pass #ifdef
  2011-03-18 17:12 [Bug preprocessor/48192] New: Conditional macros should not pass #ifdef meissner at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-03-18 23:45 ` meissner at gcc dot gnu.org
@ 2011-04-01 18:53 ` meissner at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: meissner at gcc dot gnu.org @ 2011-04-01 18:53 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48192

Michael Meissner <meissner at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Michael Meissner <meissner at gcc dot gnu.org> 2011-04-01 18:53:42 UTC ---
Fixed in subversion id 171247.


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

end of thread, other threads:[~2011-04-01 18:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-18 17:12 [Bug preprocessor/48192] New: Conditional macros should not pass #ifdef meissner at gcc dot gnu.org
2011-03-18 17:24 ` [Bug preprocessor/48192] " meissner at gcc dot gnu.org
2011-03-18 23:40 ` meissner at gcc dot gnu.org
2011-03-18 23:45 ` meissner at gcc dot gnu.org
2011-04-01 18:53 ` meissner at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).