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

* [Bug preprocessor/13046] cannot use #ifdef __APPLE__ on Darwin
  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 ` 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
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-14  5:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-14 05:22 -------
The problem is the traditional c preprocessor does not accept this at all.

-- 


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


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

* [Bug preprocessor/13046] [3.3 Regression] -traditional-cpp rejects valid code
  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 ` 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
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-15  2:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-15 02:44 -------
Here is a simpler testcase:
#define A
#ifdef A
#define F(a) (a)
#else
#define F(a,b) (a/b)
#endif

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2003-11-15 02:44:39
               date|                            |
            Summary|cannot use #ifdef __APPLE__ |[3.3 Regression] -
                   |on Darwin                   |traditional-cpp rejects
                   |                            |valid code
   Target Milestone|---                         |3.3.3


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


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

* [Bug preprocessor/13046] [3.3/3.4 Regression] -traditional-cpp rejects valid code
  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 ` janis187 at us dot ibm dot com
  2003-12-11 22:04 ` neil at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: janis187 at us dot ibm dot com @ 2003-12-08 23:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From janis187 at us dot ibm dot com  2003-12-08 23:14 -------
The regression in PR 13046 was introduced or exposed with this patch:

2002-06-28  Neil Booth  <neil@daikokuya.co.uk>

        PR preprocessor/7138
        * cpplib.c (_cpp_handle_directive): Do traditional
        preparation after setting state.angled_headers.
        * cpptrad.c (scan_out_logical_line): Fix potential
        quote bug.

The regression hunt took place on i686-pc-linux-gnu using the small
test case from comment #2, but is confirmed with the original test
case whose output before the patch (blank lines removed) is:

# 1 "13046_orig.c"
# 1 "<built-in>"
# 1 "<command line>"# 1 "<built-in>"
# 1 "<command line>"
# 1 "13046_orig.c"
13046_orig.c:2: warning: #warning Defining two-argument macros

and right after the patch is:

# 1 "13046_orig.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "13046_orig.c"
13046_orig.c:2: warning: #warning Defining two-argument macros
13046_orig.c:7: macro "btodb" requires 2 arguments, but only 1 given
13046_orig.c:8: macro "dbtob" requires 2 arguments, but only 1 given

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |neil at daikokuya dot co dot
                   |                            |uk


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


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

* [Bug preprocessor/13046] [3.3/3.4 Regression] -traditional-cpp rejects valid code
  2003-11-14  3:18 [Bug preprocessor/13046] New: cannot use #ifdef __APPLE__ on Darwin n8gray at caltech dot edu
                   ` (2 preceding siblings ...)
  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
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: neil at gcc dot gnu dot org @ 2003-12-11 22:04 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2003-11-15 02:44:39         |2003-12-11 22:04:48
               date|                            |


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


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

* [Bug preprocessor/13046] [3.3/3.4 Regression] -traditional-cpp rejects valid code
  2003-11-14  3:18 [Bug preprocessor/13046] New: cannot use #ifdef __APPLE__ on Darwin n8gray at caltech dot edu
                   ` (3 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: neil at gcc dot gnu dot org @ 2003-12-12  7:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From neil at gcc dot gnu dot org  2003-12-12 07:08 -------
Fixed in 3.4.

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


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


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

* [Bug preprocessor/13046] [3.3/3.4 Regression] -traditional-cpp rejects valid code
  2003-11-14  3:18 [Bug preprocessor/13046] New: cannot use #ifdef __APPLE__ on Darwin n8gray at caltech dot edu
                   ` (4 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: gdr at integrable-solutions dot net @ 2003-12-12  7:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2003-12-12 07:13 -------
Subject: Re:  [3.3/3.4 Regression] -traditional-cpp rejects valid code

"neil at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| Fixed in 3.4.

Does it make sense to backport the patch to 3.3.3?

-- Gaby


-- 


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


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

* [Bug preprocessor/13046] [3.3 Regression] -traditional-cpp rejects valid code
  2003-11-14  3:18 [Bug preprocessor/13046] New: cannot use #ifdef __APPLE__ on Darwin n8gray at caltech dot edu
                   ` (5 preceding siblings ...)
  2003-12-12  7:13 ` gdr at integrable-solutions dot net
@ 2004-01-31  3:15 ` pinskia at gcc dot gnu dot org
  2004-02-15 12:36 ` gdr at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-31  3:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-31 03:15 -------
Reopening as this is not fixed for 3.3.3.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |
            Summary|[3.3/3.4 Regression] -      |[3.3 Regression] -
                   |traditional-cpp rejects     |traditional-cpp rejects
                   |valid code                  |valid code


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


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

* [Bug preprocessor/13046] [3.3 Regression] -traditional-cpp rejects valid code
  2003-11-14  3:18 [Bug preprocessor/13046] New: cannot use #ifdef __APPLE__ on Darwin n8gray at caltech dot edu
                   ` (6 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-02-15 12:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at gcc dot gnu dot org  2004-02-15 12:36 -------
Adjust milestone

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.3.3                       |3.3.4


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


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

* [Bug preprocessor/13046] [3.3 Regression] -traditional-cpp rejects valid code
  2003-11-14  3:18 [Bug preprocessor/13046] New: cannot use #ifdef __APPLE__ on Darwin n8gray at caltech dot edu
                   ` (7 preceding siblings ...)
  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
  10 siblings, 0 replies; 12+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-03-12 21:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at gcc dot gnu dot org  2004-03-12 21:12 -------
(In reply to comment #4)
> Fixed in 3.4.

Is this something you fixed with a specific patch?



-- 


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


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

* [Bug preprocessor/13046] [3.3 Regression] -traditional-cpp rejects valid code
  2003-11-14  3:18 [Bug preprocessor/13046] New: cannot use #ifdef __APPLE__ on Darwin n8gray at caltech dot edu
                   ` (8 preceding siblings ...)
  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
  10 siblings, 0 replies; 12+ messages in thread
From: neil at daikokuya dot co dot uk @ 2004-03-13 15:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From neil at daikokuya dot co dot uk  2004-03-13 15:05 -------
Subject: Re:  [3.3 Regression] -traditional-cpp rejects valid code

gdr at gcc dot gnu dot org wrote:-

> 
> ------- Additional Comments From gdr at gcc dot gnu dot org  2004-03-12 21:12 -------
> (In reply to comment #4)
> > Fixed in 3.4.
> 
> Is this something you fixed with a specific patch?

http://gcc.gnu.org/ml/gcc-patches/2003-12/msg01044.html

Neil.


-- 


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


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

* [Bug preprocessor/13046] [3.3 Regression] -traditional-cpp rejects valid code
  2003-11-14  3:18 [Bug preprocessor/13046] New: cannot use #ifdef __APPLE__ on Darwin n8gray at caltech dot edu
                   ` (9 preceding siblings ...)
  2004-03-13 15:05 ` neil at daikokuya dot co dot uk
@ 2004-04-18 18:17 ` gdr at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-04-18 18:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at gcc dot gnu dot org  2004-04-18 18:11 -------
(In reply to comment #9)

> > (In reply to comment #4)
> > > Fixed in 3.4.
> > 
> > Is this something you fixed with a specific patch?
> 
> http://gcc.gnu.org/ml/gcc-patches/2003-12/msg01044.html

Thanks.  It did not apply cleanly.  I tried a manual backport,
but it seemed to cause regressions elsewhere in the CPP testsuite.
I'll close this as won't fix for 3.3.x.

-- Gaby




-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|3.3.4                       |3.4.0


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).