summaryrefslogtreecommitdiff
path: root/usr.bin/xlint
AgeCommit message (Collapse)Author
2006-06-02Rework logic for function argument conversion warnings. Only do certainChad Loder
classes of warnings if the function is not actually governed by a prototype, otherwise in standard C the compiler is free to avoid the usual widening/renarrowing conversions familiar to us from traditional C. This gets rid of many duplicate warnings. There is still more work to do to quiet lint but this is a necessary prerequisite.
2006-05-29Get rid of -t (traditional C) option. Some corrections by moritz.Chad Loder
2006-05-29lint has two synopses, so remove -ab from the second one too;Jason McIntyre
2006-05-28Kill the bflag, which was really just used to shut up a useless warningChad Loder
regarding unreachable breaks, we committed a smarter fix for this a while back, so the flag is not needed anymore. Lint will still accept and silently ignore this flag for now.
2006-05-28Kill the -a option for lint, which controlled (inconsistently) warningsChad Loder
regarding narrowing conversions. For now, lint still accepts and ignores the -a option, but soon I will remove it utterly and change the default LINTFLAGS.
2006-05-06use mkstemp, remove races wrt lint1 and cpp.Marc Espie
(check lint1 and cpp code, they use fopen/freopen to open that temp file, and thus will happily overwrite a symlink) okay cloder@
2006-05-05Do not warn when casting a pointer to [unsigned] char *;Otto Moerbeek
discussion with espie@; ok cloder@
2006-05-05Fix SEGV on prototypes containing functions; from NetBSD rev 1.18;Otto Moerbeek
ok cloder@
2006-05-05Fix SEGV on scalar initialization with braces; also found in NetBSDOtto Moerbeek
rev 1.23 as part of a much larger diff. ok cloder@
2006-05-03be smarter about warning for null effects; kills a lot of spuriousOtto Moerbeek
warnings. ok cloder@
2006-04-27print a quad as %lld, not %dOtto Moerbeek
2006-04-27Correctly process comma operator when hunting for "expression has nullOtto Moerbeek
effect" warnings. NetBSD has same fix, I found out after the fact. ok cloder@
2006-04-26Something very small and lame for nowChad Loder
2006-04-26Typos in comments, no code changesChad Loder
2006-04-25Prettier error messagesChad Loder
2006-04-25Rather than use the psize() macro everywhere (portable size macro whichChad Loder
only makes sense when -p option is specified to lint), add a new concept and macro called rank(), which corresponds to the C99 definition of rank for integral types. This has one main benefit, which is that on ILP32 platforms, if -p was not specified, lint did not warn when the code converted from long to int, because they are the same size. This is fixed. While here, get rid of a false positive with warning 259, when converting from an unsigned char to an int, for example.
2006-04-21Kill warning 54, trailing comma in enum, because this is allowed in C99.Chad Loder
2006-04-21On gcc3, specify -CC to the preprocessor (preserve comments even in macroChad Loder
expansios). On gcc 2.95, we can't do this yet because the preprocessor support for -CC is not fully functional yet. OK deraadt@
2006-04-21Fix crash when lint deals with break statements outside switch or loop.Chad Loder
This defect was introduced by me on my last commit and found by dlg@ when linting in kernel.
2006-04-20Add a LINTUSED special comment which marks the following declared symbol(s)Chad Loder
as used so that lint2 doesn't complain. Prodded by deraadt
2006-04-20Do not warn about unreachable breaks in a switch. Prodded by theo, andChad Loder
this is necessitated by output of lex (thanks a lot).
2006-04-18Disable -CC to cpp until cpp 2.95 can handle it properlyChad Loder
2006-04-18Add () to function names to make it more clear what is happeningChad Loder
2006-04-18For prototype argument conversions, include both "from" and "to" types.Chad Loder
2006-04-18For all warnings involving prototypes, print the function name and theChad Loder
argument number.
2006-04-18Add a funcname() function, which returns the name of a function given aChad Loder
CALL or AMPER or NAME node to a function or pointer to a function. This will come in handy later.
2006-04-18The old way of passing function argument information was to pass an intChad Loder
which corresponded to the argument # (1-based, with 0 meaning it is not an argument). This sucked because it is impossible to include the function name or argument name in warnings when all you have is an argument number. Introduce a new type farg_t which represents a passed function argument. struct farg contains argument number, function name, and argument symbol information from the prototype).
2006-04-17Pass -CC to cpp, which preserves comments in macros. This gets us __deadChad Loder
code detection and later on, other things.
2006-04-03reflect reality, wchar_t has been int on OpenBSD for about a year now.Marc Espie
okay millert@
2006-03-20Lint should not complain about expressions of the form: ((x == y) == z)Chad Loder
because this is perfectly legal in C. deraadt@ was seeing lint false positives with the S_ISREG macro from stat.h. So set m_eqwarn to 0 for the EQ operator. See xlint regress case #16.
2006-03-13Do not warn for functions declared with ARGSUSEDMoritz Jodeit
but having no arguments. ok deraadt@ cloder@
2006-03-08some cleanup including:Moritz Jodeit
o typos in comments o missing #include o remove pointless nomem() func o unused variables o more use of asprintf(3) ok deraadt@
2006-03-07Fix NULL deref when doing `lint --'.Moritz Jodeit
Successful build with i386 and sparc64.
2006-01-16minimal recognition of C99 float hex constants, allows lint to parseMarc Espie
frexp.c. okay cloder@, millert@
2006-01-16Kill spurious warnings when using size_t as an index; since size_t andOtto Moerbeek
ptrdiff_T are now alays (u)long, tell lint that. ok millert@ deraadt@
2005-12-18Grok NORETURN function prototypes in addition to NORETURN functionChad Loder
definitions.
2005-12-17Handle __dead functions using lint comments.Chad Loder
2005-12-17Check for functions declared with ARGSUSED but having no arguments.Chad Loder
2005-12-16Make div by zero a non-fatal messageChad Loder
2005-12-16Limp along with integral 0 instead of UQUAD_MAX when there is a divisionChad Loder
by zero. This avoids bogus integer overflow errors in div by zero situations.
2005-12-16Call checkdbz with the correct operand, so that div by zero checks actuallyChad Loder
work, instead of resulting in an exception. Problem noticed by aaron.
2005-12-15Add a new warning message: conversion of %s return value from '%s' to '%s'.Chad Loder
Lint now warns when a function's return value is converted to a smaller (or differently signed) type. These conversions can happen when doing an assignment, when passing a function's return value as an argument to another function, or when initializing a variable. Currently this produces useless warnings on tolower() and toupper() because they return ints but are usually assigned to chars.
2005-12-14Move arg # to start of message. Makes it slighly more usefulKjell Wooding
even when display is truncated due to long file name. ok cloder
2005-12-12Restructure conditional from last checkin regarding constant in conditionalChad Loder
contexts, so that we do not lose the ability to warn on non-integer constants.
2005-12-12Cut down on extraneous "constant in conditional context" warnings whenChad Loder
lint encounters expressions like do { ... } while (0); and if (1) ... We use these idioms frequently in our tree for scoping purposes and we deem them to be safe. Now lint will not warn if it encounters a constant in a conditional context when the expression consists only of a constant (with no operators) and the constant is 0 or 1. This means that lint will not warn for "if (1)" but will warn for "if (2)" and will also continue to warn for "if (foo && 1)". This cuts down the vast majority of these warnings while still preserving the ability to catch bugs.
2005-12-11SRCS should contain .y and .l references, then make will do the right thingTheo de Raadt
2005-12-11make this compile againTheo de Raadt
2005-12-10Make the style of these messages more like that of gcc messages.Chad Loder
2005-12-10Change warning/error format to match gcc's.Chad Loder
2005-12-10how did this slip in, grr.Martin Reindl