Commit Graph

93 Commits

Author SHA1 Message Date
mrg 832d47522a introduce new GCC 12 warning disables and use them in a few places
this introduces 4 new warning disable flags:

   CC_WNO_MISSING_TEMPLATE_KEYWORD
   CC_WNO_REGISTER
   CC_WNO_STRINGOP_OVERREAD
   CC_WNO_ARRAY_BOUNDS

and documents them in README.warnings.  of these, the string op
and array bounds are both problematic (real bugs) and also spurious
(not real bugs), and the other 2 are mostly temporary for older
3rd party code.

add some new uses of CC_WNO_STRINGOP_OVERFLOW.

fix m68k build for gallium and GCC 12.
2023-08-08 06:27:31 +00:00
lukem c4b7a9e794 bsd.own.mk: rename GCC_NO_* to CC_WNO_*
Rename compiler-warning-disable variables from
	GCC_NO_warning
to
	CC_WNO_warning
where warning is the full warning name as used by the compiler.

GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
2023-06-03 09:09:01 +00:00
lukem f937c412f3 bsd.own.mk: rename to CC_WNO_ADDRESS_OF_PACKED_MEMBER
Provide a single variable
	CC_WNO_ADDRESS_OF_PACKED_MEMBER
with options for both clang and gcc, to replace
	CLANG_NO_ADDR_OF_PACKED_MEMBER
	CC_NO_ADDR_OF_PACKED_MEMBER
	GCC_NO_ADDR_OF_PACKED_MEMBER

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
2023-06-03 08:52:53 +00:00
christos 7286702501 change cksum prototype to const void *, and check alignment via assertion. 2020-09-07 18:37:21 +00:00
mrg cb93b81028 add support for new GCC 9 warnings that may be too much to fix
right now.  new address-of-packed-member and format-overflow
warnings have new GCC_NO_ADDR_OF_PACKED_MEMBER amd
GCC_NO_FORMAT_OVERFLOW variables to remove these warnings.

apply to a bunch of the tree.  mostly, these are real bugs that
should be fixed, but in many cases, only by removing the 'packed'
attribute from some structure that doesn't really need it.  (i
looked at many different ones, and while perhaps 60-80% were
already properly aligned, it wasn't clear to me that the uses
were always coming from sane data vs network alignment, so it
doesn't seem safe to remove packed without careful research for
each affect struct.)  clang already warned (and was not erroring)
for many of these cases, but gcc picked up dozens more.
2020-09-06 07:20:26 +00:00
mrg de11d87641 introduce some common variables for use in GCC warning disables:
GCC_NO_FORMAT_TRUNCATION    -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION  -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW    -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE   -Wno-cast-function-type (GCC 8)

use these to turn off warnings for most GCC-8 complaints.  many
of these are false positives, most of the real bugs are already
commited, or are yet to come.


we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."
2019-10-13 07:28:04 +00:00
mrg fbffadb9f8 - add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
  this case, and thus can't be marked __dead easily
2019-02-03 03:19:25 +00:00
wiz 01869ca4d2 Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
gdt 91f284e510 Fix bug in mrouted about aging neighbors.
mrouted will periodically age its neighbors and will remove a neighbor
if it hasn't heard from it for NEIGHBOR_EXPIRE_TIME. Unfortunately, the
neighbor pointers 'a' and 'prev_a' were never advanced when timer was
not expired. Therefore it would get stuck in a tight loop, advancing
'al_timer' until it would be greater than NEIGHBOR_EXPIRE_TIME. This
caused the neighbor to allways get timed out and dropped. Furthermore,
there was a second bug in this loop when deleting an item that was not
at the head of the list (i.e., prev_a should stay the same instead of
advancing).

This bug fix is the work of Konrad Lorincz.  Bug found and fix made on
netbsd-6.

This material is based upon work supported by the Defense Advanced
Research Projects Agency and Space and Naval Warfare Systems Center,
Pacific, under Contract No. N66001-09-C-2073.  Any opinions, findings
and conclusions or recommendations expressed in this material are
those of the author(s) and do not necessarily reflect the views of the
Defense Advanced Research Project Agency and Space and Naval Warfare
Systems Center, Pacific.
Approved for Public Release, Distribution Unlimited
2015-02-05 16:50:19 +00:00
plunky 9f61b80465 NULL does not need a cast 2011-08-31 16:24:54 +00:00
joerg bec77c5f43 Use __dead 2011-08-31 13:32:36 +00:00
joerg a216da57a6 Default to -Wno-sign-compare -Wno-pointer-sign for clang.
Push -Wno-array-bounds down to the cases that depend on it.
Selectively disable warnings for 3rd party software or non-trivial
issues to be reviewed later to get clang -Werror to build most of the
tree.
2011-05-26 12:56:24 +00:00
dyoung 6c185a0be8 Don't use bool as a variable name.
Remove a bunch of parameter names form function prototypes.
2011-02-23 01:23:03 +00:00
lukem 58cb611abb Fix WARNS=4 (-Wshadow -Wsign-compare -Wcast-qual) 2009-04-17 16:05:43 +00:00
joerg 70f96e3d54 Fix markup. 2009-03-15 10:09:29 +00:00
seanb 86b8382bbc - Clean up warnings / errors. 2008-08-26 17:38:21 +00:00
tls 4147a3c54a Add new Makefile knob, USE_FORT, which extends USE_SSP by turning on the
FORTIFY_SOURCE feature of libssp, thus checking the size of arguments to
various string and memory copy and set functions (as well as a few system
calls and other miscellany) where known at function entry.  RedHat has
evidently built all "core system packages" with this option for some time.

This option should be used at the top of Makefiles (or Makefile.inc where
this is used for subdirectories) but after any setting of LIB.

This is only useful for userland code, and cannot be used in libc or in
any code which includes the libc internals, because it overrides certain
libc functions with macros.  Some effort has been made to make USE_FORT=yes
work correctly for a full-system build by having the bsd.sys.mk logic
disable the feature where it should not be used (libc, libssp iteself,
the kernel) but no attempt has been made to build the entire system with
USE_FORT and doing so will doubtless expose numerous bugs and misfeatures.

Adjust the system build so that all programs and libraries that are setuid,
directly handle network data (including serial comm data), perform
authentication, or appear likely to have (or have a history of having)
data-driven bugs (e.g. file(1)) are built with USE_FORT=yes by default,
with the exception of libc, which cannot use USE_FORT and thus uses
only USE_SSP by default.  Tested on i386 with no ill results; USE_FORT=no
per-directory or in a system build will disable if desired.
2007-05-28 12:06:17 +00:00
hubertf b5f80fa241 Move ctype.h header from defs.h to main.c where it's really used
From: Slava Semushin <slava.semushin@gmail.com>
2007-02-21 21:01:10 +00:00
christos d8050237b6 Coverity CID 1188: Don't check for NULL just to log and then die
de-referencing; return instead.
2006-05-25 01:44:28 +00:00
christos 4aafa6340a Coverity CID 1189, 1190: Don't check for NULL just to log and then die
de-referencing; return instead.
2006-05-25 01:43:58 +00:00
christos 6388d5cc98 Coverity CID 1191, 1192: Don't check for NULL allocation, just to log it
and then die dereferencing. Return instead.
2006-05-25 01:41:13 +00:00
christos 43c323928f Coverity CID 2718: Avoid using free'd memory. 2006-05-25 01:38:41 +00:00
mrg 3479c0a6a2 can't fit "256" in an 8bit value, don't have a switch case for it. 2006-05-12 01:27:27 +00:00
mrg 2a5124235b if we are going to cast the 3rd argument to accept_info_request(),
use the right type.
2006-05-11 21:17:02 +00:00
mrg 0c37c63edc change (mostly) int to socklen_t. GCC 4 doesn't like that int and
socklen_t are different signness.
2006-05-09 20:18:05 +00:00
dsl e7df4576bb Add (unsigned char) cast to ctype functions 2004-10-30 08:56:00 +00:00
wiz 47190e80b8 Consistently use 'RFC 1234' instead of 'RFC1234' or 'RFC-1234'.
From jmc@openbsd.
2003-09-07 16:22:20 +00:00
itojun e2c411ce3c use arc4random 2003-09-06 12:42:00 +00:00
itojun 757e458559 SIOCGIFCONF -> getifaddrs conversion 2003-08-18 05:39:52 +00:00
itojun b98c10dfbb strdup is simpler 2003-07-13 12:40:17 +00:00
itojun b37b18f113 remove obsolete comment 2003-05-17 19:19:50 +00:00
dsl 35605a88c0 A slightly better inet_parse(), tested in isolation. 2003-05-17 09:39:04 +00:00
dsl ee70b5d6af Revert previous change. Remove s parameter from teh function and rotate
the result through a fixed set of strings instead.
There never was a possibility of a buffer overrun in inet_fmt{s}().
Fix an actual buffer overrun in a scanf() call.
2003-05-16 22:59:50 +00:00
itojun 761f7bebc3 avoid possible buffer overruns - strlcpy, snprintf 2003-05-16 18:10:37 +00:00
fvdl 2130087152 This seems to need a -I${.CURDIR} these days. 2003-03-07 01:06:05 +00:00
wiz 7f3982ff72 Add RCS Id; new sentence, new line; at least one mdoc fix; sort sections. 2003-03-05 21:48:59 +00:00
wiz 6b7e50194b mdocified man page from mpech@openbsd.org 2003-03-05 21:40:08 +00:00
wiz 2dd997ff9e ANSIfy one more. 2003-03-05 21:32:51 +00:00
wiz ff2bebb731 Use vsnprintf instead of vsprintf. From OpenBSD. 2003-03-05 21:15:18 +00:00
wiz b4cca63351 Add license (from Xerox), from OpenBSD. 2003-03-05 21:12:26 +00:00
wiz f74dd12ce6 License update from Stanford, via OpenBSD. 2003-03-05 21:07:14 +00:00
wiz c60d41a9de Move back from gnu/dist/mrouted, now that it's available under a BSD
license.
2003-03-05 21:05:38 +00:00
itojun 9bbfbbb676 move mrouted out of basesrc, as it carries non-BSD license.
agreed w/ core.
2002-10-01 03:30:50 +00:00
itojun 17110be88b die if fd_set overrun. (they're not setuid binary so it is not that critical) 2002-08-09 02:17:26 +00:00
itojun 2f26267778 ifa->ifa_addr is already pointer, no need for "&". from love 2002-08-01 23:47:46 +00:00
itojun 43cad3fc3f use getifaddrs, not SIOCGIFCONF. should fix PR12578 2002-08-01 14:04:50 +00:00
itojun a297f25294 avoid issues with typecast optimization (taking advantage of pointer aliasing),
which results in incorrect igmp checksum.
confirmed by taca@netbsd
2002-08-01 08:33:14 +00:00
itojun 896f6ff227 u_short cleansing (should be u_int16_t) 2002-08-01 03:40:34 +00:00
wiz 51c0807f60 Unifdef __STDC__. Remove __P(). Remove register. ANSIfy. 2002-07-14 16:30:41 +00:00
itojun a3a7b3dc05 missing memset() for sockaddr. from deraadt 2002-06-02 13:47:02 +00:00