# Copyright (c) Advanced Micro Devices, Inc. All rights reserved. # # SPDX-License-Identifier: MIT # Warning flags for GNU g++ # # https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html function(get_ais_gnu_warning_flags outvar compiler_version) # Warning flags for g++ 9 and earlier set(flags # Basic "high" warning levels -Wall -Wextra # Avoid non-standard C/C++ behavior # Can't use -pedantic with nvcc at this time, as nvcc # generates code with non-standard #line styles, leading # to a LOT of warnings #-pedantic # Check for ABI warnings # Most of this is noise, but probably useful to turn # on from time to time #-Wabi # Turn on stack protection options -fstack-clash-protection -fstack-protector-strong # Misc warnings #-Waggregate-return # We return structs, but might be useful # to turn on to see where this can be # minimized -Walloca -Walloc-zero -Warray-bounds=2 # TODO: Consider making =3 in newer g++ -Wcast-align -Wcast-qual -Wconversion -Wdate-time -Wdouble-promotion -Wduplicated-branches -Wduplicated-cond -Wfloat-equal -Wformat=2 -Wformat-nonliteral -Wformat-overflow=2 -Wformat-security -Wformat-signedness -Wformat-truncation=2 -Wformat-y2k -Winvalid-pch # This is a warning for when using