cpptrad.c (_cpp_replacement_text_len): Add check for macro parameter count.

* cpptrad.c (_cpp_replacement_text_len): Add check for macro parameter count.
        (_cpp_copy_replacement_text): Same.


        * gcc.dg/cpp/trad/funlike-5.c: New test.

From-SVN: r65952
This commit is contained in:
Devang Patel 2003-04-22 12:52:51 -07:00
parent 1067694a52
commit f945b4e0f5
4 changed files with 24 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2003-04-22 Devang Patel <dpatel@apple.com>
* cpptrad.c (_cpp_replacement_text_len): Add check for macro parameter count.
(_cpp_copy_replacement_text): Same.
2003-04-22 Neil Booth <neil@daikokuya.co.uk>
* c-lex.c (c_lex): Handle CPP_OTHER differently.
@ -57,6 +63,7 @@
(note_eh_region_may_contain_throw): New function.
* except.h (note_eh_region_may_contain_throw): New function.
>>>>>>> 1.17566
2003-04-21 Mark Mitchell <mark@codesourcery.com>
* config/i386/winnt.c (i386_pe_mark_dllimport): Revert previous

View File

@ -761,7 +761,7 @@ _cpp_replacement_text_len (macro)
{
size_t len;
if (macro->fun_like)
if (macro->fun_like && (macro->paramc != 0))
{
const uchar *exp;
@ -791,7 +791,7 @@ _cpp_copy_replacement_text (macro, dest)
const cpp_macro *macro;
uchar *dest;
{
if (macro->fun_like)
if (macro->fun_like && (macro->paramc != 0))
{
const uchar *exp;

View File

@ -1,3 +1,8 @@
2003-04-22 Devang Patel <dpatel@apple.com>
* gcc.dg/cpp/trad/funlike-5.c: New test.
2003-04-21 Andreas Tobler <a.tobler@schweiz.ch>
* g++.dg/other/packed1.C: Fix dg options.

View File

@ -0,0 +1,10 @@
/* Test function like macro. */
/* Contributed by Devang Patel <dpatel@apple.com> */
/* {do-do preprocess } */
/* { dg-options "-traditional-cpp -E -dD" } */
int __srget (char *);
#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
#define getc(fp) __sgetc(fp)
#define getchar() getc(stdin)