public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/13046] New: cannot use #ifdef __APPLE__ on Darwin
@ 2003-11-14  3:18 n8gray at caltech dot edu
  2003-11-14  5:23 ` [Bug preprocessor/13046] " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: n8gray at caltech dot edu @ 2003-11-14  3:18 UTC (permalink / raw)
  To: gcc-bugs

Apologies if this is an Apple bug and not a GCC bug.

[n8gray@golux tmp]$ cpp --version
cpp (GCC) 3.3 20030304 (Apple Computer, Inc. build 1495)
[n8gray@golux tmp]$ uname -a
Darwin golux 7.0.0 Darwin Kernel Version 7.0.0: Wed Sep 24 15:48:39 PDT 2003; root:xnu/xnu
-517.obj~1/RELEASE_PPC  Power Macintosh powerpc

This code (adapted from /usr/include/ppc/param.h on a Mac OS X 10.3 install) causes CPP to do 
strange things:
#ifdef __APPLE__
#warning Defining two-argument macros
#define  btodb(bytes, devBlockSize) ((unsigned)(bytes) / devBlockSize)
#define  dbtob(db, devBlockSize)  ((unsigned)(db) * devBlockSize)
#else
#warning Defining one-argument macros
#define	btodb(bytes)  ((unsigned)(bytes) >> DEV_BSHIFT)
#define	dbtob(db)  ((unsigned)(db) << DEV_BSHIFT)
#endif

This is the output (eliding many blank lines):
[n8gray@golux tmp]$ cpp param.h
# 1 "param.h"
#pragma GCC set_debug_pwd "/Users/n8gray/tmp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "param.h"
param.h:4: warning: #warning Defining two-argument macros 
param.h:13: macro "btodb" requires 2 arguments, but only 1 given
param.h:14: macro "dbtob" requires 2 arguments, but only 1 given
# 17 "param.h"

Using using the -undef option restores the expected behavior, as does using cpp from 2.95.2.  
Other symbols besides __APPLE__ work ok.

-- 
           Summary: cannot use #ifdef __APPLE__ on Darwin
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: n8gray at caltech dot edu
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2004-04-18 18:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-14  3:18 [Bug preprocessor/13046] New: cannot use #ifdef __APPLE__ on Darwin n8gray at caltech dot edu
2003-11-14  5:23 ` [Bug preprocessor/13046] " pinskia at gcc dot gnu dot org
2003-11-15  2:44 ` [Bug preprocessor/13046] [3.3 Regression] -traditional-cpp rejects valid code pinskia at gcc dot gnu dot org
2003-12-08 23:14 ` [Bug preprocessor/13046] [3.3/3.4 " janis187 at us dot ibm dot com
2003-12-11 22:04 ` neil at gcc dot gnu dot org
2003-12-12  7:08 ` neil at gcc dot gnu dot org
2003-12-12  7:13 ` gdr at integrable-solutions dot net
2004-01-31  3:15 ` [Bug preprocessor/13046] [3.3 " pinskia at gcc dot gnu dot org
2004-02-15 12:36 ` gdr at gcc dot gnu dot org
2004-03-12 21:12 ` gdr at gcc dot gnu dot org
2004-03-13 15:05 ` neil at daikokuya dot co dot uk
2004-04-18 18:17 ` gdr at gcc dot gnu dot 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).