[Bug preprocessor/34692] [4.2/4.3 regression] Internal error with pragma in macro

2008-01-25 Thread jakub at gcc dot gnu dot org


--- Comment #5 from jakub at gcc dot gnu dot org  2008-01-25 09:02 ---
Subject: Bug 34692

Author: jakub
Date: Fri Jan 25 09:01:27 2008
New Revision: 131819

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=131819
Log:
PR preprocessor/34692
* macro.c (collect_args): Add pragma_buff argument.  Push
CPP_PRAGMA ... CPP_PRAGMA_EOL tokens to *pragma_buff, rather
than into arguments.  Reset prevent_expansion and parsing_args
state at CPP_PRAGMA_EOL/CPP_EOF.
(funlike_invocation_p): Add pragma_buff argument, pass it through
to collect_args.
(enter_macro_context): Add result argument.  Adjust
funlike_invocation_p caller.  Emit all deferred pragma tokens
gathered during collect_args before the expansion, add a padding
token.  Return 2 instead of 1 if any pragma tokens were prepended.
(cpp_get_token): If enter_macro_context returns 2, don't return
a padding token, instead cycle to grab CPP_PRAGMA token.
* directives.c (_cpp_handle_directive): If was_parsing_args
in deferred pragma, leave parsing_args and prevent_expansion as is.

* gcc.dg/cpp/pr34692.c: New test.
* gcc.dg/gomp/pr34692.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/cpp/pr34692.c
trunk/gcc/testsuite/gcc.dg/gomp/pr34692.c
Modified:
trunk/gcc/testsuite/ChangeLog
trunk/libcpp/ChangeLog
trunk/libcpp/directives.c
trunk/libcpp/macro.c


-- 


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



[Bug preprocessor/34692] [4.2/4.3 regression] Internal error with pragma in macro

2008-01-23 Thread jakub at gcc dot gnu dot org


--- Comment #4 from jakub at gcc dot gnu dot org  2008-01-23 15:59 ---
Testing a patch.


-- 

jakub at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
   |dot org |
 Status|NEW |ASSIGNED
   Last reconfirmed|2008-01-07 20:18:16 |2008-01-23 15:59:04
   date||


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



[Bug preprocessor/34692] [4.2/4.3 regression] Internal error with pragma in macro

2008-01-10 Thread jakub at gcc dot gnu dot org


-- 

jakub at gcc dot gnu dot org changed:

   What|Removed |Added

   Priority|P3  |P2


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



[Bug preprocessor/34692] [4.2/4.3 regression] Internal error with pragma in macro

2008-01-09 Thread jakub at gcc dot gnu dot org


--- Comment #3 from jakub at gcc dot gnu dot org  2008-01-09 19:44 ---
ISO C99, 6.3.10, paragraph 11 contains:
If there are sequences of preprocessing tokens within the list of arguments
that would otherwise act as preprocessing directives, the behavior is
undefined.
GCC 3.2.x had:
  if (token-type == CPP_HASH)
{
  cpp_error (pfile,
 directives may not be used inside a macro argument);
  step_back = true;
}
then http://gcc.gnu.org/ml/gcc-patches/2002-02/msg01905.html changed that.
I'd say doing what 4.1 did is sane, say for:
#define FOO(y, x) y #x
FOO(const char *p =,
a
#pragma GCC visibility push(hidden)
b
cde f g h
);
int v = 6;
#pragma GCC visibility pop
gcc -E would output:
# 1 /tmp/V.c
# 1 built-in
# 1 command line
# 1 /tmp/V.c



#pragma GCC visibility push(hidden)
const char *p = a b cde f g h;


int v = 6;
#pragma GCC visibility pop
and gcc -S would:
.file   V.c
.hidden p
.globl p
.section.rodata.str1.1,aMS,@progbits,1
.LC0:
.string a b cde f g h
.data
.align 8
.type   p, @object
.size   p, 8
p:
.quad   .LC0
.hidden v
.globl v
.align 4
.type   v, @object
.size   v, 4
v:
.long   6
.ident  GCC: (GNU) 4.1.3 20070822 (prerelease)
.section.note.GNU-stack,,@progbits


-- 


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



[Bug preprocessor/34692] [4.2/4.3 regression] Internal error with pragma in macro

2008-01-07 Thread tromey at gcc dot gnu dot org


--- Comment #2 from tromey at gcc dot gnu dot org  2008-01-07 20:18 ---
Confirmed.
4.1 seems to have silently accepted this.
I will try to read the standard to figure out what is correct.


-- 

tromey at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||tromey at gcc dot gnu dot
   ||org
 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2008-01-07 20:18:16
   date||


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



[Bug preprocessor/34692] [4.2/4.3 regression] Internal error with pragma in macro

2008-01-06 Thread pinskia at gcc dot gnu dot org


--- Comment #1 from pinskia at gcc dot gnu dot org  2008-01-06 22:14 ---
I think this was introduced with the pragma changes from the openmp branch.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||pinskia at gcc dot gnu dot
   ||org


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