diff options
author | Andrew Haley <aph@redhat.com> | 2008-07-03 10:31:50 +0000 |
---|---|---|
committer | Andrew Haley <aph@gcc.gnu.org> | 2008-07-03 10:31:50 +0000 |
commit | e85edc9ed5f31da291d8c16a5f1a044ff3c46c11 (patch) | |
tree | a96da7501f8e8902f4d0dc7373b66cf4c299e1a9 | |
parent | 70d3fcabfd2d4446b6ff44454c8f81d51ab92f8b (diff) | |
download | gcc-e85edc9ed5f31da291d8c16a5f1a044ff3c46c11.zip gcc-e85edc9ed5f31da291d8c16a5f1a044ff3c46c11.tar.gz gcc-e85edc9ed5f31da291d8c16a5f1a044ff3c46c11.tar.bz2 |
re PR preprocessor/33305 (We should warn about empty macro arguments)
2008-06-13 Andrew Haley <aph@redhat.com>
PR preprocessor/33305
* macro.c (replace_args): Print a warning for empty macro
arguments in C89 and C++.
From-SVN: r137414
-rw-r--r-- | libcpp/ChangeLog | 6 | ||||
-rw-r--r-- | libcpp/macro.c | 11 |
2 files changed, 17 insertions, 0 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 7f06941..2d29a30 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,9 @@ +2008-06-13 Andrew Haley <aph@redhat.com> + + PR preprocessor/33305 + * macro.c (replace_args): Print a warning for empty macro + arguments in C89 and C++. + 2008-06-17 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> * Makefile.in ($(srcdir)/aclocal.m4): Update dependencies. diff --git a/libcpp/macro.c b/libcpp/macro.c index 016754b..edc2856 100644 --- a/libcpp/macro.c +++ b/libcpp/macro.c @@ -1009,6 +1009,17 @@ replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro, macro_arg if (src->flags & PASTE_LEFT) paste_flag = dest - 1; } + else if (CPP_PEDANTIC (pfile) && ! macro->syshdr + && ! CPP_OPTION (pfile, c99) + && ! cpp_in_system_header (pfile)) + { + cpp_error (pfile, CPP_DL_PEDWARN, + "invoking macro %s argument %d: " + "empty macro arguments are undefined" + " in ISO C90 and ISO C++98", + NODE_NAME (node), + src->val.arg_no); + } /* Avoid paste on RHS (even case count == 0). */ if (!pfile->state.in_directive && !(src->flags & PASTE_LEFT)) |