This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR cpp/33907 Empty macro definitions not considered equal


:ADDPATCH cpp:

This patch fixes PR33907. The conclusion is that warning about A being
redefined for this testcase is annoying:

#define A(a)
#define A(b)


worse in C++ where it is an error by default.  Unfortunately both C
and C++ require diagnostics here. So we give the diagnostic only if
the user enables -pedantic (or -pedantic-errors).

Suggestions on how to improve the comment (in particular where in the
standard this is actually mentioned) are welcome.

Bootstrapped and regression tested on x86_64-unknown-linux-gnu.

2007-11-28  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

  PR cpp/33907
libcpp/
  * macro.c (warn_of_redefinition): Do not warn for empty macros
unless -pedantic is enabled.

testsuite/
  * g++.dg/cpp/redefine-empty-macro.C: New.
  * g++.dg/cpp/redefine-empty-macro-pedantic.C: New.

Attachment: fix-pr33907.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]