public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: preprocessor/5177: Problem with gcc-3.0.2 CPP and #define
@ 2001-12-23 16:16 Chris Adams
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Adams @ 2001-12-23 16:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR preprocessor/5177; it has been noted by GNATS.

From: Chris Adams <cmadams@hiwaay.net>
To: Richard Henderson <rth@redhat.com>, neil@gcc.gnu.org, gcc-bugs@gcc.gnu.org,
       gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: preprocessor/5177: Problem with gcc-3.0.2 CPP and #define
Date: Sun, 23 Dec 2001 18:14:14 -0600

 Once upon a time, Richard Henderson <rth@redhat.com> said:
 > On Sun, Dec 23, 2001 at 04:18:12PM -0000, neil@gcc.gnu.org wrote:
 > >     It is a bug in your package that it trips over the macro.
 > 
 > No, it's not his fault -- <sys/stat.h> contains something like
 > 
 > #if _DECC
 > #pragma prefix symbols with "_F64"
 > #else
 > #define stat(a,b,c)  _F64stat(a,b,c)
 > #endif
 
 Well, with only two arguments, but basically correct.  I didn't realize
 this until after I sent in the "bug".  I was under the (mistaken)
 impression that cpp shouldn't have been replacing the stat after the ->
 (and that the Compaq preprocessor was not).  After reading sys/stat.h
 some more (it is a little convoluted), I realized what was happening.
 
 > Basically, we'd have to do some extremely ugly fixincludery to
 > get this transformed to something that works properly wth gcc.
 
 I can't really see how it could be done other than to either support the
 DEC/Compaq "#pragma extern_prefix" extension (and detecting it and
 changing the #if around it) or generate an inline funcion like:
 
 static inline int stat(const char *x, struct stat *y) { return _F64_stat(x,y); }
 
 It seems like anything done with a macro would still trip up cpp.
 
 
 I did fix my case by changing:
 
     rc = db->stat(db, &dbi->dbi_stats, flags);
 
 into
 
     int (*stfunc) (DB *, void *, u_int32_t);
     stfunc = db->stat;
     rc = stfunc(db, &dbi->dbi_stats, flags);
 
 That works okay, so I'll pass it to the RPM folks to see if they'll
 accept it.  I'm surprised that this hasn't come up before with libdb3
 (maybe not many people use the ->stat call, at least on Tru64).
 
 Thanks for looking at this, and sorry to report a "not-a-bug".
 -- 
 Chris Adams <cmadams@hiwaay.net>
 Systems and Network Administrator - HiWAAY Internet Services
 I don't speak for anybody but myself - that's enough trouble.


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

* Re: preprocessor/5177: Problem with gcc-3.0.2 CPP and #define
@ 2002-01-01 11:16 Zack Weinberg
  0 siblings, 0 replies; 5+ messages in thread
From: Zack Weinberg @ 2002-01-01 11:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR preprocessor/5177; it has been noted by GNATS.

From: Zack Weinberg <zack@codesourcery.com>
To: Chris Adams <cmadams@hiwaay.net>
Cc: Richard Henderson <rth@redhat.com>, neil@gcc.gnu.org,
	gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org,
	gcc-gnats@gcc.gnu.org
Subject: Re: preprocessor/5177: Problem with gcc-3.0.2 CPP and #define
Date: Tue, 1 Jan 2002 11:15:03 -0800

 On Sun, Dec 23, 2001 at 06:14:14PM -0600, Chris Adams wrote:
 > > Basically, we'd have to do some extremely ugly fixincludery to
 > > get this transformed to something that works properly wth gcc.
 > 
 > I can't really see how it could be done other than to either support the
 > DEC/Compaq "#pragma extern_prefix" extension (and detecting it and
 > changing the #if around it)
 
 You might want to talk to Martin Loewis, this sounds rather similar to
 Sun's #pragma redefine_extname, which he was adding to GCC.  In
 general I think it's a good idea for GCC to recognize and do something
 sensible with #pragmas used in system headers.
 
 zw


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

* Re: preprocessor/5177: Problem with gcc-3.0.2 CPP and #define
@ 2001-12-23 14:06 Richard Henderson
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2001-12-23 14:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR preprocessor/5177; it has been noted by GNATS.

From: Richard Henderson <rth@redhat.com>
To: neil@gcc.gnu.org, cmadams@hiwaay.net, gcc-bugs@gcc.gnu.org,
       gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: preprocessor/5177: Problem with gcc-3.0.2 CPP and #define
Date: Sun, 23 Dec 2001 14:01:46 -0800

 On Sun, Dec 23, 2001 at 04:18:12PM -0000, neil@gcc.gnu.org wrote:
 >     It is a bug in your package that it trips over the macro.
 
 No, it's not his fault -- <sys/stat.h> contains something like
 
 #if _DECC
 #pragma prefix symbols with "_F64"
 #else
 #define stat(a,b,c)  _F64stat(a,b,c)
 #endif
 
 Basically, we'd have to do some extremely ugly fixincludery to
 get this transformed to something that works properly wth gcc.
 
 
 r~


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

* Re: preprocessor/5177: Problem with gcc-3.0.2 CPP and #define
@ 2001-12-23  8:18 neil
  0 siblings, 0 replies; 5+ messages in thread
From: neil @ 2001-12-23  8:18 UTC (permalink / raw)
  To: cmadams, gcc-bugs, gcc-prs, nobody

Synopsis: Problem with gcc-3.0.2 CPP and #define

State-Changed-From-To: open->closed
State-Changed-By: neil
State-Changed-When: Sun Dec 23 08:18:12 2001
State-Changed-Why:
    Not a bug - that's the way macros work.
    
    If your other compiler is OK, then it is not including the
    same header.
    
    It is a bug in your package that it trips over the macro.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5177


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

* preprocessor/5177: Problem with gcc-3.0.2 CPP and #define
@ 2001-12-22 11:56 cmadams
  0 siblings, 0 replies; 5+ messages in thread
From: cmadams @ 2001-12-22 11:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5177
>Category:       preprocessor
>Synopsis:       Problem with gcc-3.0.2 CPP and #define
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 22 11:56:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Chris Adams
>Release:        3.0.2
>Organization:
>Environment:
System: OSF1 bugs.hiwaay.net V5.1 1885 alpha
Machine: alpha
	AlphaServer 1000A 5/300, Compaq Tru64 Unix 5.1A
host: alphaev5-dec-osf5.1
build: alphaev5-dec-osf5.1
target: alphaev5-dec-osf5.1
configured with: /usr/users/cmadams/ftp/gcc-3.0.2/configure --prefix=/usr/users/cmadams/strap --disable-shared --disable-nls --enable-languages=c,c++
>Description:
	I am trying to build RPM 4.0.3 (http://www.rpm.org/).  The compile
	stops in rpmdb/db3.c at a line that calls "db->stat()" (db is a DB*
	from the Berkeley DB library included with RPM):

    rc = db->stat(db, &dbi->dbi_stats, flags);

	This generates an error from CPP about the number of arguments to
	stat:

db3.c:601:45: macro "stat" passed 3 arguments, but takes just 2

	The Tru64 include file /usr/include/sys/stat.h includes the line
	(this is the only #define of a stat macro that I can find included
	from the file above):

#       define stat(__a,__b) _F64_stat(__a,__b)

	It looks like the preprocessor is trying to use the define of stat
	in the db->stat line, which is not correct.  The Tru64 CPP has no
	problem with this code.

>How-To-Repeat:
	Try to build rpm-4.0.3 on Tru64 5.1A with gcc-3.0.2.
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2002-01-01 19:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-23 16:16 preprocessor/5177: Problem with gcc-3.0.2 CPP and #define Chris Adams
  -- strict thread matches above, loose matches on Subject: below --
2002-01-01 11:16 Zack Weinberg
2001-12-23 14:06 Richard Henderson
2001-12-23  8:18 neil
2001-12-22 11:56 cmadams

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