gcc/errors.cc lacks ATTRIBUTE_PRINTF_1 for the definition of `warning`,
`error`, `fatal`, and `internal_error`, which generate following
warnings when compiling GCC:
../../gcc-16.1.0/gcc/errors.cc: In function 'void warning(const char*, ...)':
../../gcc-16.1.0/gcc/errors.cc:51:12: warning: function 'void warning(const
char*, ...)' might be a candidate for 'gnu_printf' format attribute
[-Wsuggest-attribute=format]
51 | vfprintf (stderr, format, ap);
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
<Likewise for error, fatal, and internal_error>
gcc/ChangeLog:
PR driver/126500
* errors.cc: Add missing ATTRIBUTE_PRINTF_1 for the definition
of `warning`, `error`, `fatal`, and `internal_error`.
Signed-off-by: Zhongteng Gui <[email protected]>
---
gcc/errors.cc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gcc/errors.cc b/gcc/errors.cc
index 1e2d8ba2be0..272d576ec9c 100644
--- a/gcc/errors.cc
+++ b/gcc/errors.cc
@@ -41,7 +41,7 @@ int have_error = 0;
/* Print a warning message - output produced, but there may be problems. */
-void
+void ATTRIBUTE_PRINTF_1
warning (const char *format, ...)
{
va_list ap;
@@ -56,7 +56,7 @@ warning (const char *format, ...)
/* Print an error message - we keep going but the output is unusable. */
-void
+void ATTRIBUTE_PRINTF_1
error (const char *format, ...)
{
va_list ap;
@@ -73,7 +73,7 @@ error (const char *format, ...)
/* Fatal error - terminate execution immediately. Does not return. */
-void
+void ATTRIBUTE_PRINTF_1
fatal (const char *format, ...)
{
va_list ap;
@@ -88,7 +88,7 @@ fatal (const char *format, ...)
/* Similar, but say we got an internal error. */
-void
+void ATTRIBUTE_PRINTF_1
internal_error (const char *format, ...)
{
va_list ap;
--
2.55.0.windows.3