[PATCH] avoid GCC 10 test suite warnings (BZ #25219)
DJ Delorie
dj@redhat.com
Thu May 7 20:00:28 GMT 2020
Martin Sebor <msebor@gmail.com> writes:
> +#if __GNUC_PREREQ (7, 0)
> + DIAG_PUSH_NEEDS_COMMENT;
> + /* Avoid warnings about the second (size) argument being negative. */
> + DIAG_IGNORE_NEEDS_COMMENT (10.1, "-Wstringop-overflow");
This means "for gcc 7.0 or higher, ignore -Wstringop-overflow, and
remember that gcc 10.1 was the last version we saw that needed this."
I'm not sure that's what you intended ;-)
(also DIAG_IGNORE_NEEDS_COMMENT's comment says major version only,
although it totally ignores the version argument)
- - - - -
/* Convenience macro to test the version of gcc.
Use like this:
#if __GNUC_PREREQ (2,8)
... code requiring gcc 2.8 or later ...
#endif
Note: only works for GCC 2.0 and later, because __GNUC_MINOR__ was
added in 2.0. */
#if defined __GNUC__ && defined __GNUC_MINOR__
# define __GNUC_PREREQ(maj, min) \
. . .
/* Ignore the diagnostic OPTION. VERSION is the most recent GCC
version for which the diagnostic has been confirmed to appear in
the absence of the pragma (in the form MAJOR.MINOR for GCC 4.x,
just MAJOR for GCC 5 and later). Uses of this pragma should be
reviewed when the GCC version given is no longer supported for
building glibc; the version number should always be on the same
source line as the macro name, so such uses can be found with grep.
Uses should come with a comment giving more details of the
diagnostic, and an architecture on which it is seen if possibly
optimization-related and not in architecture-specific code. This
macro should only be used if the diagnostic seems hard to fix (for
example, optimization-related false positives). */
#define DIAG_IGNORE_NEEDS_COMMENT(version, option) \
_Pragma (_DIAG_STR (GCC diagnostic ignored option))
More information about the Libc-alpha
mailing list