aboutsummaryrefslogtreecommitdiffstats
path: root/ident-list.h
AgeCommit message (Collapse)AuthorFilesLines
2015-02-08Teach sparse about the __COUNTER__ predefined macroLuc Van Oostenryck1-0/+1
__COUNTER__ macro is expanded to a sequential number starting from 0. This is sometimes used to declare unique variable names. Implement support for __COUNTER__ in sparse including a set of small test programs for the test suite. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Acked-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
2014-10-10Add the __restrict__ keywordRamsay Jones1-1/+1
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Christopher Li <sparse@chrisli.org>
2014-04-17parse: support c99 [static ...] in abstract array declaratorsCody P Schafer1-0/+1
The n1570 specifies (in 6.7.6.2.3) that either type-qualifiers (ie: "restrict") come first and are followed by "static" or the opposite ("static" then type-qualifiers). Also add a test. Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
2013-04-21Support #pragma onceJosh Triplett1-0/+1
"#pragma once" acts like a multiple-inclusion guard affecting the entire file, without an associated preprocessor symbol. This allows use of sparse on projects that rely on #pragma once without also using an ifndef-based multiple-inclusion guard, such as systemd; without this change, sparse will get into an include loop. Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Christopher Li <sparse@chrisli.org>
2012-06-25sparse: Add 'error' to ignored attributesKOSAKI Motohiro1-0/+1
Add some more ignored attributes which are used in glibc header files. It silences the warnings such as the following: /usr/include/bits/fcntl2.h:36:1: error: attribute '__error__': unknown attribute Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@gmail.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
2012-06-25sparse: Add '__vector_size__' to ignored attributesKOSAKI Motohiro1-0/+1
We already had "vector_size" but we also need __vector_size__ to silence some warnings in glibc: /usr/include/bits/link.h:67:45: error: attribute '__vector_size__': unknown attribute Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@gmail.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
2012-01-18sparse: Add 'leaf' to ignored attributes.Ethan Jackson1-0/+2
This patch adds the 'leaf' GCC attribute to the list of ignored attributes. Glibc uses this attribute causing the following warnings in userspace projects: /usr/include/stdlib.h:514:26: error: attribute '__leaf__': unknown attribute Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Pekka Enberg <penberg@kernel.org> Signed-off-by: Christopher Li <sparse@chrisli.org>
2011-06-28sparse: Add 'artifical' to ignore attributesPekka Enberg1-0/+1
This patch adds the 'artifical' GCC attribute to list of ignore attributes. It's an attribute that's used by glibc which causes the following bogus sparse warnings when using it for userspace projects: /usr/include/bits/stdlib.h:37:1: error: attribute '__artificial__': unknown attribute /usr/include/bits/stdlib.h:64:1: error: attribute '__artificial__': unknown attribute Signed-off-by: Pekka Enberg <penberg@kernel.org> Signed-off-by: Christopher Li <sparse@chrisli.org>
2010-04-08Allow parsing L'\0'Christopher Li1-0/+3
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>
2009-07-18Allow array declarators to have 'restrict' in themLinus Torvalds1-0/+1
Otherwise sparse is very unhappy about the current glibc header files (aio.h, netdb.h. regex.h and spawn.h at a minimum). It's a hack, and not a proper parsing with saving the information. It just ignores any "restrict" keyword at the start of an abstract array declaration, but it's better than what we have now. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Christopher Li <sparse@chrisli.org>
2009-07-18Fix __label__ handlingAl Viro1-0/+1
a) __label__ in gcc is not a type, it's a statement. Accepted in the beginning of compound-statement, has form __label__ ident-list; b) instead of crapping into NS_SYMBOL namespace (and consequent shadowing issues), reassign the namespace to NS_LABEL after we'd bound it. We'll get block scope and label namespace, i.e. what we get in gcc. c) MOD_LABEL can be dropped now. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Christopher Li <sparse@chrisli.org>
2009-07-17Rewrite and fix specifiers handlingAl Viro1-0/+1
Make sure that we accept the right set; kill ad-hackery around checks for banned combinations. Instead of that we keep a bitmap describing what we'd already seen (with several extra bits for 'long long' and for keeping track of can't-combine-with-anything stuff), check and update it using the values in ..._op and keep track of size modifiers more or less explicitly. Testcases added. A _lot_ of that used to be done wrong. Note that __attribute__((mode(...))) got more broken by this one; the next several changesets will take care of that. One more thing: we are -><- close to getting rid of MOD_SPECIFIER bits for good. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Christopher Li <sparse@chrisli.org>
2008-06-27Ignore "cold" and "hot" attributes, which appeared in gcc 4.3Pavel Roskin1-0/+2
They describe how likely the function is to be executed, which can affect optimization. Also ignore the attributes with underscores. Signed-off-by: Pavel Roskin <proski@gnu.org>
2007-11-13Handle ignored attribute mallocEmil Medve1-0/+1
This avoids error messages like this: error: attribute 'malloc': unknown attribute Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
2007-06-26[PATCH] implement __builtin_offsetof()Al Viro1-0/+1
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2007-05-22Add explanatory comment about direct use of __IDENT for preprocessor idents.Josh Triplett1-1/+3
Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-05-22Add no-double-underscore variant format_arg.Josh Triplett1-1/+1
Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-05-22Add double-underscore variant __syscall_linkage__.Josh Triplett1-1/+1
Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-05-22Add no-double-underscore variant "used", ignored like "__used__".Josh Triplett1-1/+1
Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-05-22Add double-underscore variant __noinline__.Josh Triplett1-1/+1
Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-05-22Add double-underscore variant __always_inline__.Josh Triplett1-1/+1
Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-05-22Reorganize attribute list for readability.Josh Triplett1-31/+32
Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-05-22Move the ident for defined() into the preprocessor section.Josh Triplett1-1/+2
Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-05-22Remove inaccurate comment designating some attributes as windows-specific.Josh Triplett1-2/+0
Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-05-22Ignore the GCC constructor and destructor attributesJosh Triplett1-0/+2
Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-05-22Add (more) support for WIN32 attribute namesRamsay Jones1-0/+7
In particular, the following identifiers (along with their __X__ variants) are now accepted as attribute names: fastcall, dllimport and dllexport. (cdecl and stdcall were added in baf2c5a84e by Michael Stefaniuc). For now, at least, these attributes are just ignored. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> [josh: modified to fix whitespace damage] Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-05-20__DATE__ & __TIME expansionDamien Lespiau1-0/+2
Makes __DATE__expand to a character string literal of the form "Mmm dd yyyy" where the names of the months are the same as those generated by the asctime function, and the first character of dd is a space character if the value is less than 10. Makes __TIME__ expand to a a character string literal of the form "hh:mm:ss" as in the time generated by the asctime function. Signed-off-by: Damien Lespiau <damien.lespiau@gmail.com>
2007-04-20Parse and ignore the __regparm__ attribute, just like regparm.Josh Triplett1-1/+2
pthreads from glibc 2.5 uses __attribute__ ((__regparm__ (1)) on some functions (indirectly through the macro __cleanup_fct_attribute). Sparse already parsed and ignored regparm, but not __regparm__. Signed-off-by: Josh Triplett <josh@freedesktop.org>
2006-10-17Recognize and ignore __alias__ and __visibility__Josh Triplett1-2/+2
They are equivalent to "alias" and "visibility" except that gcc won't complain about them in ANSI programs. Original patch from Pavel Roskin, modified by Josh Triplett. Signed-off-by: Josh Triplett <josh@freedesktop.org> Signed-off-by: Pavel Roskin <proski@gnu.org>
2006-07-05[PATCH] Ignore no_instrument_function attributesJosh Triplett1-0/+1
Ignore the GCC attributes no_instrument_function and __no_instrument_function__, used to turn off instrumentation for a particular function when using GCC's -finstrument-functions option. Signed-off-by: Josh Triplett <josh@freedesktop.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-05[PATCH] Add support for GCC's __builtin_types_compatible_p extensionJosh Triplett1-0/+1
Parse and support GCC's __builtin_types_compatible_p extension, which takes two types as arguments, and returns 1 for compatible types or 0 for incompatible types. Since sparse already supports comparisons with types as the operands, just transform __builtin_types_compatible_p(a, b) into the comparison a == b. Signed-off-by: Josh Triplett <josh@freedesktop.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-28[PATCH] Attribute "sentinel"Morten Welinder1-0/+1
This makes sparse ignore the "sentinel" attribute. Signed-off-by: Morten Welinder <terra@gnome.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-20[PATCH] __attribute__ handling for attributes used in the userlandPeter Jones1-2/+9
Here's a patch that adds stubs for several attributes used in userland. This version of the patch includes a warning, which defaults to on, if you use gcc's "transparent_union" attribute, and has a flag (-Wno-transparent-union) to turn the warning off.
2005-05-31[IDENT] Add some more attributesArnaldo Carvalho de Melo1-0/+4
And, like others, ignore it for now. Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2005-05-19Don't warn about undeclared "main()" function.Linus Torvalds1-0/+1
It obviously shouldn't be static, but we could add a test for it having one of the acceptable types if we wanted to. Right now I don't care enough.
2005-04-07Make "check" (aka sparse) check arguments to some functions.Linus Torvalds1-0/+4
Start out with the memset/memcpy/copy_to/from_user byte counts.
2005-04-07Add compile-time "range-check" infrastructure to sparseLinus Torvalds1-0/+1
2005-04-07[PATCH] Diff to make sparse not complain about __format_arg__santtu.hyrkko@gmail.com1-0/+1
Another gcc format thing...
2005-04-07Add an internal sparse "context" statement type.Linus Torvalds1-0/+3
It just ends up propagating the expression to the linearizer, which creates an internal "context" instruction for it.
2005-04-07Mark more identifiers reserved.Linus Torvalds1-6/+7
Also, add "__sizeof_ptr__" identifier for new addition..
2005-04-07Handle __func__, __FUNCTION__ and __PRETTY_FUNCTION__ the sameLinus Torvalds1-0/+2
way, and give them a real string. This means that __func__ actually works as a constant string, not as a pseudo-symbol, which is wrong. But hey, sue me.
2005-04-07Introduce the notion of "reserved" identifiers. Linus Torvalds1-18/+44
The only thing they do is to refuse to bind to the regular C namespaces (NS_TYPEDEF | NS_STRUCT | NS_LABEL | NS_SYMBOL) with a warning. You can mark any identifier you want reserved by just setting ident->reserved = 1. Sparse won't care.
2005-04-07[PATCH] trivial sparse patch - ignore model attributeDavid Mosberger1-1/+1
Teach sparse to ignore the "model" (aka "__model__") attribute used by ia64 linux. Signed-off-by: davidm@hpl.hp.com Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-07[PATCH] __attribute__((bitwise))Alexander Viro1-0/+1
Handling of __attribute__((bitwise)) in a way that should be easy to extend afterwards. Example of use: typedef __u32 __attribute__((bitwise)) __le32; That will create a new 32bit type that will be assignment-incompatible with anything else. The set of allowed operations is restricted to bitwise ones, the only allowed constant is 0 right now. Forced casts are allowed, so is cast from type to itself and cast to void. Any other cast will give a warning. Checks are triggered by -Wbitwise in command line; if it's not there, attribute will be silently ignored.
2005-04-07[PATCH] avoid matching idents with string comparesChristopher Li1-0/+38
Identifiers are unique objects, so we can just compare the pointers directly, if we just set up the identifiers first. Identifier setup simplified as suggested by Linus.