aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/predefine.c
AgeCommit message (Collapse)AuthorFilesLines
2022-06-14predefine __ATOMIC_ACQUIRE & friends as weakLuc Van Oostenryck1-6/+6
In kernel's arch/mips/Makefile the whole content of gcc's -dM is used for CHECKFLAGS. This conflict with some macros also defined internally: builtin:1:9: warning: preprocessor token __ATOMIC_ACQUIRE redefined builtin:0:0: this was the original definition Fix this by using a weak define for these macros. Reported-by: Randy Dunlap <rdunlap@infradead.org> Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2020-10-19builtin: add predefines for __ATOMIC_RELAXED & friendsLuc Van Oostenryck1-0/+7
The __atomic_*() builtins take an int argument to specify the desired memory ordering. The different admissible values are predefined by the compiler, so do that too for Sparse. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2020-07-16predefine: let predefine_width() take the usual interfaceLuc Van Oostenryck1-3/+3
All the helpers for type-related predefines directly take in argument the pointer to the type. All but predefine_width(). This must be an historical relic. So, let predefine_width() also take the pointer to the type as argument. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2020-07-14arch: allow target specific [u]intptr_t & ptrdiff_tLuc Van Oostenryck1-3/+3
These types are aliased to size_t & ssize_t but this is not correct for all architectures. So, add a variable for them so that target files can adjust them. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2020-07-14predefine: teach sparse about __SIG_ATOMIC_TYPE__Luc Van Oostenryck1-0/+1
This type is predefined by GCC so add it to sparse too. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2020-07-14arch: add predefines __INT_FAST${N}_TYPE__Luc Van Oostenryck1-0/+9
We just added __INT_LEAST${N}_TYPE__, so add these ones too as they looks slightly more useful. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2020-07-14arch: add predefines __INT_LEAST${N}_TYPE__Luc Van Oostenryck1-0/+9
These are used by some system headers (neon on arm64). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2020-07-13cygwin: add the predefines '__cdecl', ...Luc Van Oostenryck1-0/+9
For CygWin, GCC defines some pseudo-specifiers like '__cdecl', '__stdcall' or '_thiscall'. Some of these are already defined by cgcc. So, add these predefines to sparse itself. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2020-07-13arch: add predefines for OS identificationLuc Van Oostenryck1-0/+19
Predefine macros like '__OpenBSD__', ... for the three BSDs, CygWin and Darwin (those for Linus and SunOS were already defined). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2020-07-13predefine: no __unix__ for DarwinLuc Van Oostenryck1-1/+1
On Darwin, '__unix__' & '__unix' doesn't seem to be predefined. Don't ask me why. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2020-07-13predefine: add __linux__ & __linuxLuc Van Oostenryck1-1/+7
These are already defined in cgcc but not yet by sparse itself. So, add them now. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2020-07-06predefine: fix multi-token predefineLuc Van Oostenryck1-1/+1
The function predefine() and its variants are only valid if they define a single-token value. However, when a type is signed, predefine_min() will produce a multi-token value. Fix this by using add_pre_buffer() instead of predefine(). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2020-07-02cleanup: move predefines in a separate fileLuc Van Oostenryck1-0/+225
Now that option parsing have moved to a separate file, move everything related to predefined macros to a separate file too. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>