diff options
author | David Malcolm <dmalcolm@redhat.com> | 2018-10-11 13:21:28 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2018-10-11 13:21:28 +0000 |
commit | 954ad1127eb4d367be1ece52e34ce15334d40c5e (patch) | |
tree | dec8d87521395a312aab96b828e7959479b364f8 /gcc/read-rtl-function.c | |
parent | c727b835139299adc623951aff782cdfaff655d9 (diff) | |
download | gcc-954ad1127eb4d367be1ece52e34ce15334d40c5e.zip gcc-954ad1127eb4d367be1ece52e34ce15334d40c5e.tar.gz gcc-954ad1127eb4d367be1ece52e34ce15334d40c5e.tar.bz2 |
libcpp: show macro definition when used with wrong argument count
Consider:
demo.c: In function 'test':
demo.c:5:40: error: macro "LOG_2" requires 3 arguments, but only 2 given
5 | LOG_2 ("loading file: %s\n", filename);
| ^
This patch adds a note showing the definition of the macro in
question, giving:
demo.c: In function 'test':
demo.c:5:40: error: macro "LOG_2" requires 3 arguments, but only 2 given
5 | LOG_2 ("loading file: %s\n", filename);
| ^
In file included from demo.c:1:
logging.h:1: note: macro "LOG_2" defined here
1 | #define LOG_2(FMT, ARG0, ARG1) do { fprintf (stderr, (FMT), (ARG0), (ARG1)); }
|
gcc/testsuite/ChangeLog:
* g++.dg/diagnostic/macro-arg-count.C: Move to...
* c-c++-common/cpp/macro-arg-count-1.c: ...here, generalizing
output for C vs C++. Expect notes showing the definitions of the
macros.
* c-c++-common/cpp/macro-arg-count-2.c: New test, adapted from the
above.
libcpp/ChangeLog:
* macro.c (_cpp_arguments_ok): If the argument count is wrong, add
a note showing the definition of the macro.
From-SVN: r265040
Diffstat (limited to 'gcc/read-rtl-function.c')
0 files changed, 0 insertions, 0 deletions