aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Fix build with GCC 4.6 series.v0.4.3-gentooDiego Elio Pettenò2011-04-081-4/+0
| | | | | | | The label_statement attribute in the anonymous structures' union was duplicated for label_arg and labeled_struct alises, which were identical. Since the former is never used, delete it and leave the other as the only copy.
* build: add an all-installable target that builds the targets to install.Diego Elio Pettenò2011-04-081-1/+3
| | | | | This is useful for distributions that don't want to build content that won't be installed.
* build: don't override CFLAGS in environment.Diego Elio Pettenò2011-04-081-1/+1
| | | | | | This allows proper setting of flags by having them in the environment, rather than overriding them on the make command line (which would then also drop the required flags for building sparse.
* build: allow easy override of GCC_BASEDiego Elio Pettenò2011-04-081-1/+2
| | | | | | Sometimes gcc reports the wrong path for its own base (for instance when ICC is present in the same system); by allowing an override of GCC_BASE in Makefile, it's easier for packages to fix this up.
* sparse 0.4.3 finialv0.4.3Christopher Li2010-09-021-1/+1
| | | | Signed-off-by: Christopher Li <sparse@chrisli.org>
* parser: add Blackfin gcc infoMike Frysinger2010-10-082-0/+15
| | | | | | | | | The Blackfin port uses some custom attributes to control memory placement, and it has some custom builtins. So add the ones that the kernel actually utilizes to avoid massive build errors with sparse. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Christopher Li <sparse@chrisli.org>
* Fixup and cleanup modifier_string() function.Christopher Li2010-09-151-19/+45
| | | | | | | | | | | The change started from Bernd Petrovitsch's patch but get mostly rewritten using accociatived array. It fix the modifier_string() function and check the string length for the string. Signed-off-by: Christopher Li <sparse@chrisli.org> Signed-off-by: Bernd Petrovitsch <bernd@sysprog.at>
* add test-inspect to .gitignoreDan Carpenter2010-09-011-0/+1
| | | | | Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
* Fix a typo - "typdef" is neither C nor plain EnglishBernd Petrovitsch2010-09-011-1/+1
| | | | | Signed-off-by: Bernd Petrovitsch <bernd@sysprog.at> Signed-off-by: Christopher Li <sparse@chrisli.org>
* inspect: cast expressionChristopher Li2010-07-221-1/+19
| | | | | | Adding cast expression for AST inspecting. Signed-off-by: Christopher Li <sparse@chrisli.org>
* skip may_alias and declare builtin_fabsMorten Welinder2010-07-192-0/+3
| | | | | Signed-off-by: Morten Welinder <terra@gnome.org> Signed-off-by: Christopher Li <sparse@chrisli.org>
* inspect: add some expression inspectionChristopher2010-07-132-1/+81
| | | | Signed-Off-By: Christopher Li <sparse@chrisli.org>
* inspect: Add test-inspect programChristopher Li2010-07-132-3/+57
| | | | | | | The test program will launch a gtk treeview windows to display the symbol node in the AST. Signed-Off-By: Christopher Li <sparse@chrisli.org>
* inspect: add some example inspect for symbol and statementChristopher Li2010-07-132-0/+127
| | | | | | | | | | | This is far fro complete. It is an example how to write call back driven inspect functions. Inside each inspect call back function. It can add a child node with: ast_append_child(), or add text attribute node with ast_append_attribute() Signed-Off-By: Christopher Li <sparse@chrisli.org>
* inspect: add custom ast treeview modelChristopher Li2010-07-134-0/+611
| | | | | | | | | It is custom gtk treeview model to wrap the C data structure use by sparse. The ast model does not have any sparse specific stuff in it. Instead, it provide a simplier call back based API to allow user construct tree view object very easily. Signed-Off-By: Christopher Li <sparse@chrisli.org>
* parser: define __builtin_unreachableJiri Slaby2010-07-131-0/+1
| | | | | | | | | Gcc 4.5 defines extern void __builtin_unreachable(void); so, add it also to sparse. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Christopher <sparse@chrisli.org>
* Add test case for builtin_unreachable()Christopher2010-07-131-0/+15
| | | | | | The test case is taken from gcc documents. Signed-off-by: Christopher <sparse@chrisli.org>
* parser: fix and simplify support of asm gotoJiri Slaby2010-07-131-1/+2
| | | | | | | | | | 1) We now handle only "asm (volatile|goto)?", whereas "asm volatile? goto?" is correct. 2) We need to match only goto_ident, so do it explicitly against token->ident without match_idents. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Christopher <sparse@chrisli.org>
* parser: add support for asm gotoJiri Slaby2010-06-173-0/+32
| | | | | | | | | As of gcc 4.5, asm goto("jmp %l[label]" : OUT : IN : CLOB : LABELS) is supported. Add this support to the parser so that it won't choke on the newest Linux kernel when compiling with gcc 4.5. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Christopher Li <sparse@chrisli.org>
* Adding asm goto label test caseChristopher Li2010-06-171-0/+22
| | | | | | Provided by Jiri Slaby <jslaby@suse.cz> Signed-off-by: Christopher Li <sparse@chrisli.org>
* Ignore the may_alias GCC attributeDamien Lespiau2010-06-171-0/+2
| | | | | | | | may_alias is used in the wild (glib) and makes sparse spew a lot of unhelpful warning messages. Ignore it (for now?). Signed-off-by: Damien Lespiau <damien.lespiau@gmail.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
* Parsing wide char stringChristopher Li2010-06-175-15/+28
| | | | | | | | A follow up change to parse the wide char string. It currently only parse and store it like normal strings. Need more change to reflect the base type and size etc. Signed-off-by: Christopher Li <sparse@chrisli.org>
* Allow parsing L'\0'Christopher Li2010-04-085-5/+15
| | | | | | | | | It is nasty that L'\0' start from an identifier letter. I try my best not to slow down the hot path. The test is done inside get_one_identifier() after the ident hash is built. It look a little bit out of palace but faster than testing 'L' before hand. Signed-off-by: Christopher Li <sparse@chrisli.org>
* evaluate: check for NULL type inside typeofChristopher2010-03-291-1/+3
| | | | | | | This should fix the segfault report by Randy. It still doesn't parse the struct attribute correctly though. Signed-off-by: Christopher <sparse@chrisli.org>
* Pointer don't inherent the alignment from base typeChristopher Li2010-03-281-0/+1
| | | | Signed-off-by: Christopher Li <sparse@chrisli.org>
* possible fix to cgcc issue in sparse 0.4.2:Joel Soete2010-03-281-1/+1
| | | | | | | | Use of uninitialized value $bits in exists at /usr/bin/cgcc line 139. /usr/bin/cgcc: weird number of bits. at /usr/bin/cgcc line 139. Signed-off-by: Joel Soete <rubisher@scarlet.be> Signed-off-by: Christopher Li <sparse@chrisli.org>
* Ignore "naked" attributeMichael Buesch2010-03-281-0/+2
| | | | | | | | | | The GCC "naked" attribute is used on certain architectures to generate functions without a prologue/epilogue. Ignore it in sparse. Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: Christopher Li <sparse@chrisli.org>
* ignore attributes "externally_visible" and "signal"Michael Buesch2010-03-281-0/+4
| | | | | | | | | | | | This adds more ignored gcc-style attributes. externally_visible is a standard gcc attribute. signal is an AVR8 attribute used to define interrupt service routines. Ignore these attributes, as they are currently not useful for sparse checking. Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: Christopher Li <sparse@chrisli.org>
* Adding test case for "x && y && z" .Christopher Li2010-03-281-0/+17
| | | | Signed-off-by: Christopher Li <sparse@chrisli.org>
* Fix incorrect linearization of "x && y && z"Daniel De Graaf2010-03-281-1/+3
| | | | | | | | This fixes an incorrect assumption that results in && using shortcut logic on the true branch instead of the false branch. Signed-off-by: Daniel De Graaf <danieldegraaf@gmail.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
* Makefile: fix permissions mixup on installDan McGee2010-03-281-7/+12
| | | | | | | | `install` by default uses 755 permissions; for everything but executables we want to use 644 permissions. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Christopher Li <sparse@chrisli.org>
* New attribute designated_init: mark a struct as requiring designated initJosh Triplett2010-03-288-2/+250
| | | | | | | | | | | | | | | | | | | | | | | Some structure types provide a set of fields of which most users will only initialize the subset they care about. Users of these types should always use designated initializers, to avoid relying on the specific structure layout. Examples of this type of structure include the many *_operations structures in Linux, which contain a set of function pointers; these structures occasionally gain a new field, lose an obsolete field, or change the function signature for a field. Add a new attribute designated_init; when used on a struct, it tells Sparse to warn on any positional initialization of a field in that struct. The new flag -Wdesignated-init controls these warnings. Since these warnings only fire for structures explicitly tagged with the attribute, enable the warning by default. Includes documentation and test case. Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Christopher Li <sparse@chrisli.org>
* Rename -Wall to Wsparse-all, so it doesn't get turned on unintentionallyJosh Triplett2010-03-284-17/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sparse's -Wall option turns on all sparse warnings, including those that many projects will not want; for instance, warnings that enforce particular stylistic choices, or behavior allowed by a standard but considered questionable or error-prone. Furthermore, using -Wall means accepting all future warnings sparse may start issuing, not just those intentionally turned on by default. Other compilers like GCC also use -Wall, and interpret it to mean "turn on a sensible set of warnings". Since sparse exists to emit warnings, it already defaults to emitting a sensible set of warnings. Many projects pass the same options to both sparse and the C compiler, including warning options like -Wall; this results in turning on excessive amounts of sparse warnings. cgcc already filtered out -Wall, but many projects invoke sparse directly rather than using cgcc. Remove that filter, now that -Wall does not change sparse's behavior. Projects almost certainly don't want to use the new -Wsparse-all option; they should choose the specific set of warnings they want, or just go with sparse's defaults. Also update cgcc to know about Wsparse-all and not pass it to GCC, and update a test case that unnecessarily used -Wall. Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Christopher Li <sparse@chrisli.org>
* Handle __builtin_ms_va_list.Michael Stefaniuc2010-03-282-0/+3
| | | | | | | | | | | | | | | | | | | | | | For Win64 compiles Wine does #ifndef __ms_va_list # if defined(__x86_64__) && defined (__GNUC__) # define __ms_va_list __builtin_ms_va_list # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg) # define __ms_va_end(list) __builtin_ms_va_end(list) # else Wouldn't be as bad if sparse cannot handle those but it trips over WINBASEAPI DWORD WINAPI FormatMessageA(DWORD,LPCVOID,DWORD,DWORD,LPSTR,DWORD,__ms_va_list*); WINBASEAPI DWORD WINAPI FormatMessageW(DWORD,LPCVOID,DWORD,DWORD,LPWSTR,DWORD,__ms_va_list*); producing this errors for basically every file: wine/include/winbase.h:1546:96: error: Expected ) in function declarator wine/include/winbase.h:1546:96: error: got * wine/include/winbase.h:1547:97: error: Expected ) in function declarator wine/include/winbase.h:1547:97: error: got * Signed-off-by: Michael Stefaniuc <mstefaniuc@gmail.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
* Simplify Makefile using static pattern rulesChristopher Li2010-03-281-8/+3
| | | | | | | I find a way to get rid of the macro and $$ in linking executable program. Signed-off-by: Christopher Li <sparse@chrisli.org>
* Ignore the alloc_size attribute.Michael Stefaniuc2010-03-281-0/+2
| | | | | | | | | Wine has annotated the Win32 alloc functions with the alloc_size attribute. This cuts down the noise a lot when running sparse on the Wine source code. Signed-off-by: Michael Stefaniuc <mstefaniuc@gmail.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
* Ignore the ms_abi/sysv_abi attributes.Michael Stefaniuc2010-03-281-0/+4
| | | | | | | | | | | | | This is needed for getting a meaningful sparse run on a Wine 64-bit compile. Else the basic Win32 headers will produce tons of error: attribute 'ms_abi': unknown attribute which end in error: too many errors. The sysv_abi attribute was just added for symmetry. Signed-off-by: Michael Stefaniuc <mstefaniuc@gmail.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
* Declare ignored attributres into a list of string.Christopher Li2010-03-282-71/+86
| | | | | | Adding ignored attributes is much easier now. Signed-off-by: Christopher Li <sparse@chrisli.org>
* Move noreturn attribute out of ignore attr areaChristopher Li2010-03-281-2/+2
| | | | Signed-off-by: Christopher Li <sparse@chrisli.org>
* Make MOD_NORETURN fits into 32 bitChristopher Li2009-10-161-1/+1
| | | | | | | It is causing compiler warning on 32 bit systems. Move it to lower bits fix it. Signed-off-by: Christopher Li <sparse@chrisli.org>
* do not ignore attribute 'noreturn'...Kamil Dudka2009-10-162-3/+5
| | | | | | | | | | | | | | | | | | | | | Hello, enclosed is a simple patch adding support for attribute 'noreturn' to the parser. The enhancement makes it possible to optimize walk through CFG and thus help us to fight with the state explosion. The benefit is demonstrated on a simple real-world example. Generated CFG before patch: http://dudka.cz/devel/html/slsparse-before/slplug.c-handle_stmt_assign.svg Generated CFG after patch: http://dudka.cz/devel/html/slsparse-after/slplug.c-handle_stmt_assign.svg It's one of the key features I am currently missing in SPARSE in contrast to gcc used as parser. Thanks in advance for considering it! Signed-off-by: Kamil Dudka <kdudka@redhat.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
* Sparse 0.4.2Christopher Li2009-10-111-2/+2
| | | | Signed-off-by: Christopher Li <sparse@chrisli.org>
* sparse: Add GCC pre-defined macros for user-spacePekka Enberg2009-08-212-0/+11
| | | | | | | | | | | | | | | | | | | Sparse produces a bunch of warnings like this when compiling against glibc: /usr/lib/gcc/i486-linux-gnu/4.3.2//include-fixed/limits.h:33:22: warning: undefined preprocessor identifier '__INT_MAX__' /usr/lib/gcc/i486-linux-gnu/4.3.2//include-fixed/limits.h:64:5: warning: undefined preprocessor identifier '__SHRT_MAX__' /usr/lib/gcc/i486-linux-gnu/4.3.2//include-fixed/limits.h:64:21: warning: undefined preprocessor identifier '__INT_MAX__' /usr/include/bits/xopen_lim.h:95:6: warning: undefined preprocessor identifier '__INT_MAX__' /usr/include/bits/xopen_lim.h:98:7: warning: undefined preprocessor identifier '__INT_MAX__' Fix that up by adding some add_pre_buffer() calls to create_builtin_define(). For future reference, GCC defines the builtins in the c_cpp_builtins() function in gcc/c-cppbuiltin.c. Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> Acked-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Christopher Li <sparse@chrisli.org>
* make sparse headers self-compilable...Kamil Dudka2009-08-115-0/+14
| | | | | | | | ... and thus possible to include them in arbitrary order and without any external dependencies. Signed-off-by: Kamil Dudka <kdudka@redhat.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
* show_token: handle TOKEN_UNTAINT and TOKEN_ARG_COUNT typesReinhard Tartler2009-08-111-2/+11
| | | | | | | | These cases are probably never hit with "regular" codepaths, but are useful when called in a gdb session to print token sequences. Signed-off-by: Reinhard Tartler <siretart@tauware.de> Signed-off-by: Christopher Li <sparse@chrisli.org>
* unssa: track uses when replacing a phi nodeKamil Dudka2009-08-023-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hello, attached are patch, testing input for test-unssa and its outputs before patch and after patch. Thanks in advance for considering the patch! Kamil test: .L0x7f9fb2030010 <entry-point> phisrc.32 %phi2(ptr) <- %arg1 br .L0x7f9fb2030130 .L0x7f9fb2030130 copy.32 %r1(ptr) <- %r5(ptr) br %r1(ptr), .L0x7f9fb2030058, .L0x7f9fb20300e8 .L0x7f9fb2030058 load.32 %r3 <- 0[%r1(ptr)] phisrc.32 %phi3(ptr) <- %r3 br .L0x7f9fb2030130 .L0x7f9fb20300e8 ret test: .L0x7f4a7f7f1010 <entry-point> copy.32 %r5(ptr) <- %arg1 br .L0x7f4a7f7f1130 .L0x7f4a7f7f1130 copy.32 %r1(ptr) <- %r5(ptr) br %r1(ptr), .L0x7f4a7f7f1058, .L0x7f4a7f7f10e8 .L0x7f4a7f7f1058 load.32 %r3 <- 0[%r1(ptr)] copy.32 %r5(ptr) <- %r3 br .L0x7f4a7f7f1130 .L0x7f4a7f7f10e8 ret >From 66a02fa7cec780fc88d6ef4cce7a1e704928808a Mon Sep 17 00:00:00 2001 From: Kamil Dudka <kdudka@redhat.com> Date: Sun, 9 Aug 2009 10:22:11 +0200 Subject: [PATCH] unssa: track uses when replacing a phi node The output of test-unssa is inconsistent for a simple test-case without this patch: static void test(void **ptr) { while (ptr) { ptr = *ptr; } } Signed-off-by: Kamil Dudka <kdudka@redhat.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
* Define __LP64__ for x86_64 unless in 32 bit modeBlue Swirl2009-08-011-1/+1
| | | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
* Add support for TImode type (__int128_t)Blue Swirl2009-08-0110-13/+51
| | | | | | | | | | GCC provides a 128 bit type called internally as TImode (__int128_t)on 64 bit platforms (at least x86_64 and Sparc64). These types are used by OpenBIOS. Add support for types "long long long", __mode__(TI) and __(u)int128_t. Signed-off-by: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
* linearize.h: sanitize headerKamil Dudka2009-07-292-4/+4
| | | | | | | | | | It's unfortunate to use 'true' and 'false' as identifiers in a system header. It clashes with corresponding macros from <stdbool.h> when included before <sparse/linearize.h>. Signed-off-by: Kamil Dudka <kdudka@redhat.com> Acked-by: Hannes Eder <hannes@hanneseder.net> Signed-off-by: Christopher Li <sparse@chrisli.org>
* Add c{l,t}z{,l,ll}, ffsl{,l}, popcountll and floating point comparison builtins.Blue Swirl2009-08-031-3/+22
| | | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Christopher Li <sparse@chrisli.org>