# Test if the input language was specified externally. # Otherwise test if the compiler unterstands the "-std=c11" flag, and use it if so. ifeq ($(filter -std=%,$(CFLAGS)),) ifeq ($(shell $(CC) -std=c11 -E - 2>/dev/null >/dev/null y` was accessed. # 0x0 might be a sane memory location for embedded systems, so the test must not be removed. # Right now clang does not use the *delete-null-pointer* optimization, and does not understand the parameter. # Related issues: #628, #664. OPTIONAL_CFLAGS += -fno-delete-null-pointer-checks # Use colored compiler output if the compiler supports this and if this is not # disabled by the user ifneq ($(CC_NOCOLOR),1) OPTIONAL_CFLAGS += -fdiagnostics-color endif # Force the C compiler to not ignore signed integer overflows # Background: In practise signed integers overflow consistently and wrap # around to the lowest number. But this is undefined behaviour. # Branches that rely on this undefined behaviour will be silently # optimized out. For details, have a look at # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30475 # Note: Please do not add new code that relies on this undefined # behaviour, even though this flag makes your code work. There are # safe ways to check for signed integer overflow. CFLAGS += -fwrapv # Enable warnings for code relying on signed integers to overflow correctly # (see above for details). # Note: This warning is sadly not reliable, thus -fwrapv cannot be # dropped in favor of this CFLAGS += -Wstrict-overflow # Fast-out on old style function definitions. # They cause unreadable error compiler errors on missing semicolons. # Worse yet they hide errors by accepting wildcard argument types. OPTIONAL_CFLAGS += -Wstrict-prototypes OPTIONAL_CFLAGS += -Wold-style-definition # Unwanted flags for c++ CXXUWFLAGS += -std=% CXXUWFLAGS += -Wstrict-prototypes -Wold-style-definition ifeq ($(filter -std=%,$(CXXEXFLAGS)),) ifeq ($(shell $(CC) -std=c++14 -E - 2>/dev/null >/dev/null