public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/37267] New: #pragma inside structure initialization causes error
@ 2008-08-28 18:51 neale at sinenomine dot net
2008-09-02 20:54 ` [Bug c/37267] [4.2/4.3/4.4 Regression] " pinskia at gcc dot gnu dot org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: neale at sinenomine dot net @ 2008-08-28 18:51 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1329 bytes --]
Weve implemented the #pragma ident which simply generates information in the
comment section of an elf object. Solaris uses it throughout its source tree.
However, its causing some grief when used in a manner like this:
#include <stdio.h>
typedef struct X {
int a;
int b;
} X_t;
int z;
X_t x[] = {
#pragma weak Y = z
{0,1},
{2,3}
};
int
main(int argc, char **argv)
{
printf("%x",x[0].a);
return x[1].b;
}
Ive replaced ident with weak so it will run on other platforms. For gcc 4.0.1
theres no problem but with 4.2.3 I get the following:
/tmp/test.c:11: error: expected expression before '#pragma'
The context in which I am seeing a problem is that the C code does something
like this:
tuple_t x[] = {
#include a.h
#include b.h
};
Each of the .h files have the contents of the structure but they also contain
a #pragma ident which causes the compiler to emit the error.
Neale
--
Summary: #pragma inside structure initialization causes error
Product: gcc
Version: 4.2.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: neale at sinenomine dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37267
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/37267] [4.2/4.3/4.4 Regression] #pragma inside structure initialization causes error
2008-08-28 18:51 [Bug c/37267] New: #pragma inside structure initialization causes error neale at sinenomine dot net
@ 2008-09-02 20:54 ` pinskia at gcc dot gnu dot org
2008-09-03 9:42 ` jakub at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-09-02 20:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2008-09-02 20:53 -------
Confirmed, this is most likely caused by the pragma changes in 4.2 as 4.1.1
works.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |rejects-valid
Known to fail| |4.2.0 4.3.0 4.4.0
Known to work| |4.1.1
Last reconfirmed|0000-00-00 00:00:00 |2008-09-02 20:53:30
date| |
Summary|#pragma inside structure |[4.2/4.3/4.4 Regression]
|initialization causes error |#pragma inside structure
| |initialization causes error
Target Milestone|--- |4.2.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37267
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/37267] [4.2/4.3/4.4 Regression] #pragma inside structure initialization causes error
2008-08-28 18:51 [Bug c/37267] New: #pragma inside structure initialization causes error neale at sinenomine dot net
2008-09-02 20:54 ` [Bug c/37267] [4.2/4.3/4.4 Regression] " pinskia at gcc dot gnu dot org
@ 2008-09-03 9:42 ` jakub at gcc dot gnu dot org
2008-09-03 9:49 ` jakub at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-09-03 9:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jakub at gcc dot gnu dot org 2008-09-03 09:41 -------
Similar to PR25246.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37267
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/37267] [4.2/4.3/4.4 Regression] #pragma inside structure initialization causes error
2008-08-28 18:51 [Bug c/37267] New: #pragma inside structure initialization causes error neale at sinenomine dot net
2008-09-02 20:54 ` [Bug c/37267] [4.2/4.3/4.4 Regression] " pinskia at gcc dot gnu dot org
2008-09-03 9:42 ` jakub at gcc dot gnu dot org
@ 2008-09-03 9:49 ` jakub at gcc dot gnu dot org
2008-09-20 14:36 ` rguenth at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-09-03 9:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jakub at gcc dot gnu dot org 2008-09-03 09:47 -------
But I'm not convinced we want to allow pragmas in this context. While these
pragmas aren't covered by the C standard, for all the covered pragmas in there
they must appear outside of external declarations or explicit declarations and
statements inside a compound statement. While there was a point in handling
some pragmas inside of structure/union definition, pragmas at this spot don't
serve anything useful and allowing it here would mean
basically we'd need to handle pragmas almost everywhere in the grammar.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37267
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/37267] [4.2/4.3/4.4 Regression] #pragma inside structure initialization causes error
2008-08-28 18:51 [Bug c/37267] New: #pragma inside structure initialization causes error neale at sinenomine dot net
` (2 preceding siblings ...)
2008-09-03 9:49 ` jakub at gcc dot gnu dot org
@ 2008-09-20 14:36 ` rguenth at gcc dot gnu dot org
2008-09-21 16:14 ` joseph at codesourcery dot com
2008-10-22 3:51 ` mmitchel at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-09-20 14:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from rguenth at gcc dot gnu dot org 2008-09-20 14:35 -------
I agree with Jakub. Joseph - are you ok with closing this as invalid?
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jsm28 at gcc dot gnu dot org
Status|NEW |WAITING
Keywords|rejects-valid |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37267
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/37267] [4.2/4.3/4.4 Regression] #pragma inside structure initialization causes error
2008-08-28 18:51 [Bug c/37267] New: #pragma inside structure initialization causes error neale at sinenomine dot net
` (3 preceding siblings ...)
2008-09-20 14:36 ` rguenth at gcc dot gnu dot org
@ 2008-09-21 16:14 ` joseph at codesourcery dot com
2008-10-22 3:51 ` mmitchel at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: joseph at codesourcery dot com @ 2008-09-21 16:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from joseph at codesourcery dot com 2008-09-21 16:12 -------
Subject: Re: [4.2/4.3/4.4 Regression] #pragma inside structure
initialization causes error
On Sat, 20 Sep 2008, rguenth at gcc dot gnu dot org wrote:
> I agree with Jakub. Joseph - are you ok with closing this as invalid?
Yes.
I think back ends should be able to register non-deferred pragmas, which
should be allowed everywhere (and wouldn't reach the parser at all), like
the "ident" pragma of the motivating case for this PR, but it's for the
person adding such a pragma to add the facilities required. #pragma weak
is one I think it is entirely appropriate to allow only at limited places
in the grammar rather than trying to define what it means in the middle
of a declaration.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37267
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/37267] [4.2/4.3/4.4 Regression] #pragma inside structure initialization causes error
2008-08-28 18:51 [Bug c/37267] New: #pragma inside structure initialization causes error neale at sinenomine dot net
` (4 preceding siblings ...)
2008-09-21 16:14 ` joseph at codesourcery dot com
@ 2008-10-22 3:51 ` mmitchel at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2008-10-22 3:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from mmitchel at gcc dot gnu dot org 2008-10-22 03:50 -------
Closed as INVALID, per Comment #4 and Comment #5.
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37267
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-10-22 3:51 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-28 18:51 [Bug c/37267] New: #pragma inside structure initialization causes error neale at sinenomine dot net
2008-09-02 20:54 ` [Bug c/37267] [4.2/4.3/4.4 Regression] " pinskia at gcc dot gnu dot org
2008-09-03 9:42 ` jakub at gcc dot gnu dot org
2008-09-03 9:49 ` jakub at gcc dot gnu dot org
2008-09-20 14:36 ` rguenth at gcc dot gnu dot org
2008-09-21 16:14 ` joseph at codesourcery dot com
2008-10-22 3:51 ` mmitchel 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).