diff options
author | Neil Booth <neil@daikokuya.co.uk> | 2003-12-12 07:00:29 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2003-12-12 07:00:29 +0000 |
commit | 45f2492c99625b7dff5e9eced1969861d3fc1ca1 (patch) | |
tree | 4614d26a7b81e6a3878d634b99ee0a34b5e069e1 /gcc/cpptrad.c | |
parent | d2b6eb76fa7c35f512f8f8dd16b027a525550460 (diff) | |
download | gcc-45f2492c99625b7dff5e9eced1969861d3fc1ca1.zip gcc-45f2492c99625b7dff5e9eced1969861d3fc1ca1.tar.gz gcc-45f2492c99625b7dff5e9eced1969861d3fc1ca1.tar.bz2 |
PR preprocessor/12935 preprocessor/12952 preprocessor/13046
PR preprocessor/12935 preprocessor/12952 preprocessor/13046
* cpplib.c (prepare_directive_trad): Clear skipping only in
#if and #elif directives.
(do_undef): Call the handler even if the identifier is not a macro.
* cpptrad.c (scan_parameters): Emit an error message.
(_cpp_create_trad_definition): Remember the params list even on
failure.
* testsuite/gcc.dg/cpp/trad/macro.c: New tests.
From-SVN: r74562
Diffstat (limited to 'gcc/cpptrad.c')
-rw-r--r-- | gcc/cpptrad.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/cpptrad.c b/gcc/cpptrad.c index 6da19cc..08636ed 100644 --- a/gcc/cpptrad.c +++ b/gcc/cpptrad.c @@ -907,6 +907,9 @@ scan_parameters (cpp_reader *pfile, cpp_macro *macro) break; } + if (!ok) + cpp_error (pfile, CPP_DL_ERROR, "syntax error in macro parameter list"); + CUR (pfile->context) = cur + (*cur == ')'); return ok; @@ -982,14 +985,17 @@ _cpp_create_trad_definition (cpp_reader *pfile, cpp_macro *macro) /* Is this a function-like macro? */ if (* CUR (context) == '(') { + bool ok = scan_parameters (pfile, macro); + + /* Remember the params so we can clear NODE_MACRO_ARG flags. */ + macro->params = (cpp_hashnode **) BUFF_FRONT (pfile->a_buff); + /* Setting macro to NULL indicates an error occurred, and prevents unnecessary work in _cpp_scan_out_logical_line. */ - if (!scan_parameters (pfile, macro)) + if (!ok) macro = NULL; else { - /* Success. Commit the parameter array. */ - macro->params = (cpp_hashnode **) BUFF_FRONT (pfile->a_buff); BUFF_FRONT (pfile->a_buff) = (uchar *) ¯o->params[macro->paramc]; macro->fun_like = 1; } |