Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
dist/ | H | - | - | 8,904,819 | 6,883,798 | |
lib/ | H | - | - | 216,015 | 88,320 | |
usr.bin/ | H | - | - | 254,703 | 169,569 | |
Makefile | H A D | 18-Jan-2019 | 138 | 8 | 3 | |
Makefile.autobuild_h | H A D | 01-Aug-2023 | 1.2 KiB | 43 | 29 | |
Makefile.gcc_path | H A D | 12-Aug-2018 | 405 | 19 | 7 | |
Makefile.hooks | H A D | 01-Aug-2023 | 841 | 29 | 19 | |
Makefile.version_h | H A D | 01-Aug-2023 | 1.7 KiB | 67 | 49 | |
README.gcc12 | H A D | 23-Sep-2024 | 6 KiB | |||
README.warnings | H A D | 08-Aug-2023 | 5.3 KiB | 172 | 108 | |
gcc2gcc.old | H A D | 27-Feb-2014 | 1.3 KiB | 64 | 40 | |
gcc2netbsd | H A D | 08-Sep-2024 | 2.3 KiB |
README.warnings
1$NetBSD: README.warnings,v 1.5 2023/08/08 11:50:22 riastradh Exp $ 2 3What to do about GCC warnings and NetBSD. 4 5 6New GCC releases always come with a host of new warnings and 7each new warning can find real bugs, find odd code, or simply 8be a pain of new useless warnings, or all three and more. 9 10As each warning has its own set of issues they each have their 11own section and it is expected that this document will be 12modified for updates to warnings and new warnings. 13 14 15<bsd.own.mk> provides several variables for use in Makefiles: 16 COPTS.foo.c += ${CC_WNO_FORMAT_TRUNCATION} 17 COPTS.foo.c += ${CC_WNO_FORMAT_OVERFLOW} 18 COPTS.foo.c += ${CC_WNO_STRINGOP_OVERFLOW} 19 COPTS.foo.c += ${CC_WNO_STRINGOP_TRUNCATION} 20 COPTS.foo.c += ${CC_WNO_CAST_FUNCTION_TYPE} 21 COPTS.foo.c += ${CC_WNO_IMPLICIT_FALLTHROUGH} 22 COPTS.foo.c += ${CC_WNO_ADDRESS_OF_PACKED_MEMBER} 23 COPTS.foo.c += ${CC_WNO_MAYBE_UNINITIALIZED} 24 COPTS.foo.c += ${CC_WNO_RETURN_LOCAL_ADDR} 25 COPTS.foo.c += ${CC_WNO_MISSING_TEMPLATE_KEYWORD} 26 COPTS.foo.c += ${CC_WNO_STRINGOP_OVERREAD} 27 COPTS.foo.c += ${CC_WNO_REGISTER} 28 COPTS.foo.c += ${CC_WNO_ARRAY_BOUNDS} 29 30 31new GCC 12 warnings: 32 33 -Wno-missing-template-keyword 34 35 This warning trips on older C++ code, and should only be applyed to 3rd 36 party code. 37 38 bsd.own.mk variable: ${CC_WNO_MISSING_TEMPLATE_KEYWORD} 39 40 -Wno-stringop-overread 41 42 This warning triggers when array bounds appear to be exceeded. There 43 maybe some bugs related to this warning in GCC 12. 44 45 bsd.own.mk variable: ${CC_WNO_STRINGOP_OVERREAD} 46 47 -Wno-register 48 49 This warning triggers in C++17 mode where 'register' has been removed, 50 and should only be applied to 3rd party code. 51 52 bsd.own.mk variable: ${CC_WNO_REGISTER} 53 54 -Wno-array-bounds 55 56 This warning triggers with a number of code issues that tend to be real 57 problem but require careful adjustments to fix properly, when there are 58 platform related accesses beyond the immediately size and address of 59 known variables (real bugs to fix), but also may trigger when passing 60 C arrays vs C pointers to functions, often incorrectly. See 61 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110878 62 63 bsd.own.mk variable: ${CC_WNO_ARRAY_BOUNDS} 64 65 66new GCC 10 warnings: 67 68 GCC 10 switched the default from "-fcommon" to "-fno-common", 69 which can cause multiply defined symbol issues. Ideally we 70 fix all of these, but "-fcommon" can be used otherwise. 71 72 -Wno-maybe-uninitialized 73 74 This warning was introduced in an ancient GCC but was 75 significantly enhanced in GCC 10, unfortunately, many of 76 the new instances are incorrect. 77 78 bsd.own.mk variable: ${CC_WNO_MAYBE_UNINITIALIZED} 79 80 -Wno-return-local-addr 81 82 This warning was introduced in GCC 5 and was enhanced in GCC 83 10. Unfortunately, the new instances are failing to correctly 84 analyze code flow and miss that most of the are handled. 85 86 bsd.own.mk variable: ${CC_WNO_RETURN_LOCAL_ADDR} 87 88 89new GCC 9 warnings: 90 91 -Wno-address-of-packed-member 92 93 This warning was introduced in GCC 8. 94 This warning is similar to -Wformat-truncation, but for the 95 general family of string functions (str*(), etc.), and has 96 similar issues of false positives. 97 98 bsd.own.mk variable: ${CC_WNO_ADDRESS_OF_PACKED_MEMBER} 99 100 101new GCC 8 warnings: 102 103 -Wstringop-truncation 104 105 This warning was introduced in GCC 8. 106 This warning is similar to -Wformat-truncation, but for the 107 general family of string functions (str*(), etc.), and has 108 similar issues of false positives. 109 110 bsd.own.mk variable: ${CC_WNO_STRINGOP_TRUNCATION} 111 112 113 -Wcast-function-type 114 115 This warning was introduced in GCC 8. 116 This warning can find real problems. Most instances are 117 false positives, and hopefully this warning will become 118 more useful in the future. See __FPTRCAST(). 119 120 bsd.own.mk variable: ${CC_WNO_CAST_FUNCTION_TYPE} 121 122 123new GCC 7 warnings: 124 125 -Wstringop-overflow 126 127 This warning was introduced in GCC 7. 128 This warning can find issues where source length is 129 passed as destination length (eg, strncpy() where the 130 length is strlen(src)) that are potential buffer overflow 131 cases and should always be inspected, but false positives 132 are also seen. 133 134 bsd.own.mk variable: ${CC_WNO_STRINGOP_OVERFLOW} 135 136 137 -Wformat-truncation 138 139 This warning was introduced in GCC 7. 140 This warning has many false positives where truncation is 141 either expected or unavoidable, but also finds several real 142 code bugs. 143 144 Code should always be manually inspected for this warning 145 as it does pick up real issues. 146 147 bsd.own.mk variable: ${CC_WNO_FORMAT_TRUNCATION} 148 149 150 -Wformat-overflow 151 152 This warning was introduced in GCC 7. 153 This warning typically identifies a real problem, but it may 154 fail to notice the code handles this case. 155 156 Code should always be manually inspected for this warning 157 as it does pick up real issues. 158 159 bsd.own.mk variable: ${CC_WNO_FORMAT_OVERFLOW} 160 161 162 -Wimplicit-fallthrough 163 164 This warning was introduced in GCC 7. 165 This warning has many false positives in GCC 7, and many are 166 fixed in newer GCC 10. Old uses should be checked occasionally. 167 168 Code should always be manually inspected for this warning 169 as it does pick up real issues. 170 171 bsd.own.mk variable: ${CC_WNO_IMPLICIT_FALLTHROUGH} 172