Skip to content

Instantly share code, notes, and snippets.

@zvr
Created May 1, 2023 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zvr/3814cc3e5b2b54e90320c09e9d074e64 to your computer and use it in GitHub Desktop.
Save zvr/3814cc3e5b2b54e90320c09e9d074e64 to your computer and use it in GitHub Desktop.
gcc 13 with useful warnings
#!/bin/sh
# gccw -- gcc with useful warnings
# updated for gcc-13.1.0
# Copyright Alexios Zavras <github@zvr.gr>
# SPDX-License-Identifier: MIT
gcc \
-WNSObject-attribute \
-Wabsolute-value \
-Waddress \
-Waddress-of-packed-member \
-Waggregate-return \
-Waggressive-loop-optimizations \
-Walloc-zero \
-Walloca \
-Warith-conversion \
-Warray-bounds=2 \
-Warray-compare \
-Warray-parameter=2 \
-Wattribute-alias=2 \
-Wattribute-warning \
-Wattributes \
-Wbad-function-cast \
-Wbidi-chars=any,ucn \
-Wbool-compare \
-Wbool-operation \
-Wbuiltin-declaration-mismatch \
-Wbuiltin-macro-redefined \
-Wc11-c2x-compat \
-Wc99-c11-compat \
-Wcannot-profile \
-Wcast-align \
-Wcast-align=strict \
-Wcast-function-type \
-Wcast-qual \
-Wchar-subscripts \
-Wclobbered \
-Wcomment \
-Wcomplain-wrong-lang \
-Wconversion \
-Wcoverage-invalid-line-number \
-Wcoverage-mismatch \
-Wcpp \
-Wdangling-else \
-Wdangling-pointer=2 \
-Wdeprecated \
-Wdeprecated-declarations \
-Wdesignated-init \
-Wdisabled-optimization \
-Wdiscarded-array-qualifiers \
-Wdiscarded-qualifiers \
-Wdiv-by-zero \
-Wdouble-promotion \
-Wduplicate-decl-specifier \
-Wduplicated-branches \
-Wduplicated-cond \
-Wempty-body \
-Wendif-labels \
-Wenum-compare \
-Wenum-conversion \
-Wenum-int-mismatch \
-Wexpansion-to-defined \
-Wfloat-conversion \
-Wfloat-equal \
-Wformat \
-Wformat-contains-nul \
-Wformat-diag \
-Wformat-extra-args \
-Wformat-nonliteral \
-Wformat-overflow=2 \
-Wformat-security \
-Wformat-signedness \
-Wformat-truncation=2 \
-Wformat-y2k \
-Wformat-zero-length \
-Wformat=2 \
-Wframe-address \
-Wfree-nonheap-object \
-Wif-not-aligned \
-Wignored-attributes \
-Wignored-qualifiers \
-Wimplicit \
-Wimplicit-fallthrough=3 \
-Wimplicit-function-declaration \
-Wimplicit-int \
-Wimport \
-Wincompatible-pointer-types \
-Winfinite-recursion \
-Winit-self \
-Winline \
-Wint-conversion \
-Wint-in-bool-context \
-Wint-to-pointer-cast \
-Winvalid-memory-model \
-Winvalid-pch \
-Winvalid-utf8 \
-Wjump-misses-init \
-Wlogical-not-parentheses \
-Wlogical-op \
-Wlong-long \
-Wlto-type-mismatch \
-Wmain \
-Wmaybe-uninitialized \
-Wmemset-elt-size \
-Wmemset-transposed-args \
-Wmisleading-indentation \
-Wmismatched-dealloc \
-Wmissing-attributes \
-Wmissing-braces \
-Wmissing-declarations \
-Wmissing-field-initializers \
-Wmissing-format-attribute \
-Wmissing-include-dirs \
-Wmissing-parameter-type \
-Wmissing-profile \
-Wmissing-prototypes \
-Wmultichar \
-Wmultistatement-macros \
-Wnarrowing \
-Wnested-externs \
-Wnonnull \
-Wnonnull-compare \
-Wnormalized=nfkc \
-Wnull-dereference \
-Wold-style-declaration \
-Wold-style-definition \
-Wopenacc-parallelism \
-Wopenmp-simd \
-Woverflow \
-Woverlength-strings \
-Woverride-init \
-Woverride-init-side-effects \
-Wpacked \
-Wpacked-bitfield-compat \
-Wpacked-not-aligned \
-Wpadded \
-Wparentheses \
-Wpedantic \
-Wpointer-arith \
-Wpointer-compare \
-Wpointer-sign \
-Wpointer-to-int-cast \
-Wpragmas \
-Wprio-ctor-dtor \
-Wredundant-decls \
-Wrestrict \
-Wreturn-local-addr \
-Wreturn-type \
-Wscalar-storage-order \
-Wsequence-point \
-Wshadow=global \
-Wshift-count-negative \
-Wshift-count-overflow \
-Wshift-negative-value \
-Wshift-overflow \
-Wshift-overflow=2 \
-Wsign-compare \
-Wsign-conversion \
-Wsizeof-array-argument \
-Wsizeof-array-div \
-Wsizeof-pointer-div \
-Wsizeof-pointer-memaccess \
-Wstack-protector \
-Wstrict-aliasing=3 \
-Wstrict-overflow=5 \
-Wstrict-prototypes \
-Wstring-compare \
-Wstringop-overflow \
-Wstringop-overflow=4 \
-Wstringop-overread \
-Wstringop-truncation \
-Wsuggest-attribute=cold \
-Wsuggest-attribute=const \
-Wsuggest-attribute=format \
-Wsuggest-attribute=malloc \
-Wsuggest-attribute=noreturn \
-Wsuggest-attribute=pure \
-Wswitch \
-Wswitch-bool \
-Wswitch-default \
-Wswitch-enum \
-Wswitch-outside-range \
-Wswitch-unreachable \
-Wsync-nand \
-Wtautological-compare \
-Wtrampolines \
-Wtrigraphs \
-Wtrivial-auto-var-init \
-Wtsan \
-Wtype-limits \
-Wundef \
-Wunicode \
-Wuninitialized \
-Wunknown-pragmas \
-Wunsuffixed-float-constants \
-Wunused \
-Wunused-but-set-parameter \
-Wunused-but-set-variable \
-Wunused-const-variable=2 \
-Wunused-function \
-Wunused-label \
-Wunused-local-typedefs \
-Wunused-macros \
-Wunused-parameter \
-Wunused-result \
-Wunused-value \
-Wunused-variable \
-Wuse-after-free=3 \
-Wvarargs \
-Wvariadic-macros \
-Wvector-operation-performance \
-Wvla \
-Wvla-parameter \
-Wvolatile-register-var \
-Wwrite-strings \
-Wxor-used-as-pow \
-Wzero-length-bounds \
\
"$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment