+2018-07-17 Jason Franklin <j_fra@fastmail.us>
+ Jakub Jelinek <jakub@redhat.com>
+
+ * lex.c (_cpp_lex_direct): Use CPP_DL_NOTE instead of CPP_DL_PEDWARN,
+ CPP_DL_WARNING or CPP_DL_ERROR for note that diagnostics for C++ style
+ comments is reported only once per file and guard those calls on the
+ preceding cpp_error returning true.
+
2018-07-03 Nathan Sidwell <nathan@acm.org>
Reorg line_map data structures for better packing.
&& CPP_PEDANTIC (pfile)
&& ! buffer->warned_cplusplus_comments)
{
- cpp_error (pfile, CPP_DL_PEDWARN,
- "C++ style comments are not allowed in ISO C90");
- cpp_error (pfile, CPP_DL_PEDWARN,
- "(this will be reported only once per input file)");
+ if (cpp_error (pfile, CPP_DL_PEDWARN,
+ "C++ style comments are not allowed in ISO C90"))
+ cpp_error (pfile, CPP_DL_NOTE,
+ "(this will be reported only once per input file)");
buffer->warned_cplusplus_comments = 1;
}
/* Or if specifically desired via -Wc90-c99-compat. */
&& ! CPP_OPTION (pfile, cplusplus)
&& ! buffer->warned_cplusplus_comments)
{
- cpp_error (pfile, CPP_DL_WARNING,
- "C++ style comments are incompatible with C90");
- cpp_error (pfile, CPP_DL_WARNING,
- "(this will be reported only once per input file)");
+ if (cpp_error (pfile, CPP_DL_WARNING,
+ "C++ style comments are incompatible with C90"))
+ cpp_error (pfile, CPP_DL_NOTE,
+ "(this will be reported only once per input file)");
buffer->warned_cplusplus_comments = 1;
}
/* In C89/C94, C++ style comments are forbidden. */
}
else if (! buffer->warned_cplusplus_comments)
{
- cpp_error (pfile, CPP_DL_ERROR,
- "C++ style comments are not allowed in ISO C90");
- cpp_error (pfile, CPP_DL_ERROR,
- "(this will be reported only once per input "
- "file)");
+ if (cpp_error (pfile, CPP_DL_ERROR,
+ "C++ style comments are not allowed in "
+ "ISO C90"))
+ cpp_error (pfile, CPP_DL_NOTE,
+ "(this will be reported only once per input "
+ "file)");
buffer->warned_cplusplus_comments = 1;
}
}