aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/cgcc
AgeCommit message (Collapse)AuthorFilesLines
2022-06-06cgcc: do not die on '-x assembler'Luc Van Oostenryck1-3/+2
Currently cgcc will die if the option '-x' is used with any argument other than 'c'. It makes sense since sparse can only handle C files but it can be useful in a project to simply use something like: make CC=cgcc So, instead of die()ing, avoid calling sparse if such '-x' option is used, like already done by default for non .c files. Original-patch-by: Tom Rix <trix@redhat.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2022-05-22cgcc: add Xtensa supportGuennadi Liakhovetski1-0/+7
Add support for the Xtensa architecture. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2020-07-13cgcc: remove now unneeded options & definesLuc Van Oostenryck1-24/+8
Now that the OS can be specified to sparse via an option (--os=$OS) and that sparse knows about their specificities, it's no more needed or useful to also define them in cgcc. So, remove from cgcc the OS-specificities known to sparse (a few few exotic ones remain for now) but ensure that the info about the correct OS is passed to sparse. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-12-16cgcc: rename 'ppc64+{be,le}' to 'ppc64{be,le}'Luc Van Oostenryck1-5/+5
The spec names 'ppc64+{be,le}' had the '+' to force them to be internal names but are also useful as external names (it helps to make systematic testing of the arch-specific code). So rename them to 'ppc64{be,le}'. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-12-16cgcc: add support for riscv32Luc Van Oostenryck1-0/+3
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-12-04cgcc: only define __CYGWIN32__ for -m32 buildsRamsay Jones1-1/+3
'__CYGWIN32__' is wrongly defined on 64-bit Cygwin. Fix this by only defining it when $m32 is set and set $m32 when i386 is selected. Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-11-28cgcc: fix definition of 'linux' macroRamsay Jones1-1/+1
During a call to add_specs('linux'), cgcc adds several macro definitions to the sparse command line. In particular, it provides the incorrect definition: '-Dlinux=linux'. This bug was introduced in commit 807f74466b (<no title>, 2004-08-13), while moving some calls to add_pre_buffer() around in lib.c. This was then moved out of sparse, into cgcc, by commit cf2bde63a6 (<no title>, 2004-10-05), where the definition was copied verbatum. Fix this macro definition to read '-Dlinux=1' instead. Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-11-28cgcc: add support for riscv64Luc Van Oostenryck1-0/+3
Sparse itself already add support for it, so add support for it in the wrapper too. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-11-28cgcc: filter-out -msize-long & -msize-llp64Luc Van Oostenryck1-0/+1
These options are sparse-specific and shouldn't be passed to GCC. Reported-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-11-27Merge branch 'arm-hf' into masterLuc Van Oostenryck1-1/+1
2019-11-27cgcc: use -mfloat-abi=hard for armhfLuc Van Oostenryck1-1/+1
Now that sparse understands -mfloat-abi and set the related predefines (__ARM_PCS_VFP, __ARM_PCS & __SOFTFP) it's not cgcc can make good use of it. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-11-15cgcc: let cygwin use -fshort-wcharLuc Van Oostenryck1-0/+1
Cygwin uses 'unsigned short' for its wchar_t. So, use -fshort-wchar for it. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-11-12Add -Wexternal-function-has-definitionJohn Levon1-1/+1
Some older codebases hit this warning all the time, so it's useful to be able to disable it. Signed-off-by: John Levon <john.levon@joyent.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-11-09cgcc: let sparse define _BIG_ENDIANLuc Van Oostenryck1-2/+1
In addition of __BIG_ENDIAN__, gcc defines _BIG_ENDIAN on powerpc (32 & 64-bit). cgcc does that too but this may also beeneeded when using sparse itself. So, move this define the the sparse code. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-11-08cgcc: remove _STRING_ARCH_unalignedLuc Van Oostenryck1-2/+2
As far as I can see, the macro '_STRING_ARCH_unaligned' may be defined by glibc, not gcc. So, there is no reason for cgcc to define it. Worse, cgcc defines it to '1' while on some platorms (at least the few ppc64 I've access to) the installed glibc defines it to '0'. So, do not let cgcc define this macro. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-10-30cgcc: removed unneeded predefines for integersLuc Van Oostenryck1-48/+4
Now that the arch is passed to sparse via '--arch=ARCH', all predefines for integers and pointers are defined in sparse itself. So, integer_types() & define_size_t() are now unneeded. Remove these functions and -D__SIZEOF_POINTER__. Note: sparc64 had also an entry for 128-bit integers (with name 'LONG_LONG_LONG' and suffix 'LLL'); GCC only predefines the SIZEOF macros which sparse also does (but for all archs). So, it's fine to remove these also. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-10-30cgcc: specify the arch via --archLuc Van Oostenryck1-4/+11
Now that it's possible to specify the architecture via the --arch=ARCH option, let cgcc make use of it. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-09-02cgcc: fix wrong processing of -MD & -MMDLuc Van Oostenryck1-1/+1
In commit bb1bf7485 ("cgcc: gendeps for -MM, -MD & -MMD too"), the flags -MD & -MMD were treated as -M (and -MM): inhibit calling the checker/sparse because the command is only used to generate dependencies. But while this behaviour is correct for -MM, it's not for -MD & -MMD since these flags are only used to generate the dependencies *in addition* to the normal processing. Fixes: bb1bf748580d1794f8da7200ba83ccfc2f2f3a8a Reported-by: Ilya Maximets <i.maximets@samsung.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-02-25cgcc: use strict & warningsLuc Van Oostenryck1-0/+3
Better to declare undeclared or unintialized vars early, so use the 'strict' & 'warnings' pragmas. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-02-25Merge branch 'cgcc-dumpmachine' into tipLuc Van Oostenryck1-11/+39
* cgcc: add support for x86-x32 * cgcc: favor using 'gcc -dumpmachine' to determine specifics * cgcc: simpler handling of hard-float ARM * cgcc: add pseudo-archs for ppc64be/ppc64le * cgcc: -dumpmachine should be fetched with '$ccom'
2019-02-25cgcc: add support for x86-x32Luc Van Oostenryck1-1/+3
Detect when the target is x86-x32 and pass the appropriate flag '-mx32'. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-02-25cgcc: favor using 'gcc -dumpmachine' to determine specificsUwe Kleine-König1-5/+28
`uname -m` returns information about the host machine but this information is useless when cgcc is used with a non-native compiler since it's information about the target machine that is needed. So, first try to determine the target machine via `gcc -dumpmachine` and default to `uname -m`. Note: this should fix problems with Debian build when armhf builder is run on a arm64 environment. Originally-by: Uwe Kleine-König <uwe@kleine-koenig.org> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-02-25cgcc: simpler handling of hard-float ARMLuc Van Oostenryck1-8/+7
There is an ABI for ARM with hard floats and one for soft floats (as well as one for a sort of mix between hard & soft). For hard floats, the preprocessor symbol '__ARM_PCS_VFP' needs to be defined. This is added as an additional check in the code returning the 'specs' for ARM. To facilitate some upcoming changes and code reuse here, create a pseudo-arch 'arm+hf' using '-D__ARM_PCS_VFP=1' in addition to the usual options for ARM. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-02-25cgcc: add pseudo-archs for ppc64be/ppc64leLuc Van Oostenryck1-2/+6
Platforms having an uname's machine 'ppc64' or 'ppc64le' need to have their endianness set (as well as the 'ELF' version). To facilitate some future changes and code reuse here, create entries for 2 pseudo-archs 'ppc64+be' & 'ppc64+le'. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-02-25cgcc: -dumpmachine should be fetched with '$ccom'Luc Van Oostenryck1-1/+1
The variable '$ccom' is used to hold the compiler command only while '$cc' hold the compiler and it's options. So, use '$ccom' to fetch '-dumpmachine' instead of '$cc'. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-02-25Merge branch 'fix-cgcc-gendeps' into tipLuc Van Oostenryck1-5/+5
* cgcc: -MF, -MQ & -MT need an argument * cgcc: gendeps for -MM, -MD & -MMD too
2019-02-25cgcc: define __APPLE_CC__ on OSXLuc Van Oostenryck1-1/+1
It seems that some header files somehow need this. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-02-20cgcc: -MF, -MQ & -MT need an argumentLuc Van Oostenryck1-4/+4
These flags expect an argument. So, the following element in '@ARGV' must then not be considered as an option or an input file, exactly like done for '-o FILE'. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-02-20cgcc: gendeps for -MM, -MD & -MMD tooLuc Van Oostenryck1-1/+1
These flags must set '$gendeps', just like a plain '-M' do, since they implies '-M'. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-02-07cgcc: teach cgcc about Hurd/GNULuc Van Oostenryck1-0/+3
cgcc fails if it doesn't know about the system/OS as returned by `uname -s`. This creates a build failure for Debian since Hurd is one of their non-official 'ports' but unknown to cgcc. So, teach cgcc about 'GNU' (the OS/system name returned on Hurd) and add the few predefines used to identify it. Reported-by: Uwe Kleine-König <uwe@kleine-koenig.org> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2019-02-07predefs: add arch-specific predefinesLuc Van Oostenryck1-10/+8
Predefined macros like '__x86_64__', '__arm__', ... are used in systems headers (and surely at other places too). So, when appropriate, define the following symbols which seems to be somehow needed by glibc: m68k: __m68k__ mips: __mpis64, __mips ppc: __ppc64__, __powerpc, __ppc__ riscv: __riscv__, __riscv_xlen__ s390: __zarch__ sparc: __sparc_v9__, __sparcv9 x86-64: __x86_64__, __x86_64 Also, the following symbols, which were previously only defined in cgcc, are now defined in Sparse itself: i386 __i386, __i386__ sparc __sparc, __sparc__, __arch64__, __sparc64__, __sparcv9__ s390 __s390__, __s390x__ ppc __PPC__, __powerpc__, __PPC64__, __powerpc64__ arm __arm__ arm64 __aarch64__ Note: these are only tested on i386, x86-64, arm, arm64, mips64 (ABI O32), ppc, ppc64 (power7), ppc64el (power8) and sparc64, most of them on a not-so-new OS version. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2018-12-06cgcc: use 'i386' for the arch instead of 'i86'Luc Van Oostenryck1-2/+2
cgcc can be used when cross-compiling if the target architecture is given with '-target=<arch>'. However, the name that needs to be given for the i386 arch is 'i86'. Fix this by changing the name 'i86' into 'i386'. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2018-11-24cgcc: teach about '-x c'Luc Van Oostenryck1-0/+8
Currently, cgcc only checks input files if their names end with '.c' or if given as stdout. Other files are explicitly ignored. This generally corresponds to what is wanted but GCC allows arbitrary input files if the option '-x <language>' is given. Some projects use this mechanism, for example to use the C pre-processor on non-C files. This fails when cgcc is used as wrapper around sparse + GCC. Fix this by teaching cgcc about the '-x c' option. Reported-by: Antonio Ospite <ao2@ao2.it> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2018-11-24cgcc: teach about '-o <file>'Luc Van Oostenryck1-0/+8
The option '-o', in itself, doesn't need to be handled specially by cgcc but this option takes an argument and option arguments need to be ignored by cgcc (otherwise they can be interpreted and filtered-out by cgcc). Avoid potential problems with -o's argument by simply ignoring it. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2018-11-24cgcc: add support to ignore argument(s) of optionsLuc Van Oostenryck1-2/+9
cgcc only does a minimal processing and filtering of its command line and most options are simply forwarded to sparse and gcc. However, if one of the ignored options takes an argument that matches one of the non-ignored options, this argument will be processed as an option with undesirable effect. Allow options to specify the number of arguments they're taking and avoid any processing or filtering of these arguments while still forwarding them to sparse and gcc. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2018-11-23constant: add -Wconstant-suffix warningRamsay Jones1-1/+1
Currently, when used on the kernel, sparse issues a bunch of warnings like: warning: constant 0x100000000 is so big it is long These warning are issued when there is a discrepancy between the type as indicated by the suffix (or the absence of a suffix) and the real type as selected by the type suffix *and* the value of the constant. Since there is nothing incorrect with this discrepancy, (no bits are lost) these warnings are more annoying than useful. So, make them depending on a new warning flag -Wconstant-suffix and make it off by default. Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2018-06-16add support for -fdiagnostic-prefix[=prefix]Luc Van Oostenryck1-1/+1
When using sparse it's common to compile a file and directly run sparse on the same file, like it is done for the kernel. In this case, error messages from sparse are interspersed with those from the compiler. It's thus not always easy to know from which tools they come. Fix this by allowing to prefix all the diagnostic messages by some configurable string, by default "sparse". More exactly, an error message that was emitted like: file.c:<line>:<col>: error: this is invalid code can now be emitted as: file.c:<line>:<col>: sparse: error: this is invalid code Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Reviewed-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
2018-05-01let cgcc use sparse's predefines for i386 & x86-64Luc Van Oostenryck1-9/+2
Currently, cgcc contains the logic to add predefined symbols like __INT_MAX or __SIZEOF_POINTER, but: 1) this logic is now completly present in sparse itself 2) cgcc hasn't the logic needed for x86-64-x32 which sparse now has. So, drop these defines in cgcc and let cgcc simply use the ones predefined by sparse itself. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Acked-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
2017-11-13Merge branch 'dump-ir' into tipLuc Van Oostenryck1-1/+2
2017-11-13dump-ir: rename -fdump-linearize to -fdump-irLuc Van Oostenryck1-1/+1
as it will be used for dumping the IR not only just after linearization but after other passes too. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2017-11-12dump-ir: allow to specify the passes to execute via cli's optionsLuc Van Oostenryck1-0/+1
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2017-11-07cgcc: teach cgcc about freebsd & netbsdLuc Van Oostenryck1-0/+6
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2017-10-03fix cgcc ELF version for ppc64/pcc64leLuc Van Oostenryck1-3/+2
Commit e0306fe0 "cgcc: teach cgcc about ppc64[le]" add support for PPC64 to cgcc by adding the needed options like '-m64' & '-m{little,big}-endian' and defines likes '-D__PPC64__=1'. In this commit the defined '-D_CALL_ELF=2' was also added but the value of 2 is for ELF v2 ABI, normally used for ppc64le, while the older ELF ABI, normally used for plain ppc64 should use '-D_CALL_ELF=2'. Fix this by using the value of 1 or 2 for '_CALL_ELF' depending if the architecture is ppc64 or ppc64le. Fixes: e0306fe0b725af6e2e7ff59d7f0d99c96315791a Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Tested-by: Uwe Kleine-König <uwe@kleine-koenig.org> Signed-off-by: Christopher Li <sparse@chrisli.org>
2017-10-03cgcc: provide __ARM_PCS_VFP for armhfUwe Kleine-König1-2/+9
This fixes: $ uname -m armv8l $ env CHECK=./sparse ./cgcc -no-compile memops.c /usr/include/arm-linux-gnueabihf/gnu/stubs.h:7:12: error: unable to open 'gnu/stubs-soft.h' Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org> Signed-off-by: Christopher Li <sparse@chrisli.org>
2017-10-02cgcc: teach cgcc about GNU/kFreeBSDUwe Kleine-König1-0/+3
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org> Signed-off-by: Christopher Li <sparse@chrisli.org>
2017-06-21cgcc: teach cgcc about armLuc Van Oostenryck1-0/+5
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2017-06-21cgcc: teach cgcc about ppc64[le]Luc Van Oostenryck1-0/+10
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2017-06-21cgcc: teach cgcc about arm64Luc Van Oostenryck1-0/+5
This is needed to use sparse on the git tree on an arm64 machine (where a bug in the __builtin_bswapXX() expansion was discovered). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2017-06-15add support for -fmemcpy-max-countLuc Van Oostenryck1-1/+1
By default, sparse will warn if memcpy() (or memset(), copy_from_user(), copy_to_user()) is called with a very large static byte-count. But the limit is currently fixed at 100000, which may be fine for some uses but not for others. For example, this value is too low for sparse to be used on the git tree where, for example, some array used to sort the index is cleared with memset(). Change this by making the limit configurable via a new flag: -fmemcpy-max-count. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2017-06-15add support for -Wmemcpy-max-countLuc Van Oostenryck1-1/+1
sparse will warn if memcpy() (or memset(), copy_from_user(), copy_to_user()) is called with a very large static byte-count. But this warning is given unconditionaly while there are projects where this warning may not be not desired. Change this by making this warning conditional on a new warning flag: -W[no-]memcpy-max-count Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2017-06-15cgcc: filter-out '-fdump-linearize[=...]'Luc Van Oostenryck1-0/+1
This was forgotten when adding this option. Reported-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2017-06-15cgcc: add missing warning names to check_only_option()Luc Van Oostenryck1-1/+1
The missing ones were: * init-cstring * override-init-all * sizeof-bool * unknown-attribute Reported-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2017-06-15cgcc: alphasort warning names in check_only_option()Luc Van Oostenryck1-1/+1
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2017-05-28teach cgcc about OSX aka darwinLuc Van Oostenryck1-0/+3
cgcc knows about a few unix OSes but not yet about OSX/darwin. Fix this by adding the two needed defines to cgcc's specs. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2017-02-13cgcc should not define non-reserved identifiersLuc Van Oostenryck1-4/+4
Since the original x86-64 support in cgcc (commit 0fcbcbf4: "Implement x86-64 support in cgcc") cgcc define some non-reserved identifiers like i386, x86_64, ... It should not since these are valid identifiers which could be used for some variable names. Current versions of gcc only define those prefixed with a double underscore and cgcc also define those. So ... Remove the defines of the non-prefixed ones. Reported-by: Joe Lawrence <joe.lawrence@redhat.com> Investigated-by: Joe Lawrence <joe.lawrence@redhat.com> Originally-From: Linus Torvalds <torvalds@linux-foundation.org> Tested-by: Joe Lawrence <joe.lawrence@redhat.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
2015-01-28s390x: add the proper defines for data typesChristian Borntraeger1-0/+8
This patch fixes several issues when compiling code under s390x (64bit) with cgcc, e.g. /usr/include/gnu/stubs.h:8:12: error: unable to open 'gnu/stubs-32.h' by providing the proper defines. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
2014-11-10cgcc: avoid passing a sparse-only option to ccRamsay Jones1-2/+2
Passing the '-Wsparse-error' to cgcc can cause that option to be passed to the C compiler (usually gcc), if the given source file does not provoke any sparse warnings, which in turn results in a failure to compile that file. In order to avoid passing this sparse option to the compiler, we add the '-Wsparse-error' option to the regular expression check in the 'check_only_option' function. In addition, we replace the plain call to 'die' when sparse exits with non-zero status (maybe due to -Wsparse-error), with a simple 'exit 1'. This suppresses an 'Died at ./cgcc line 86.' message on exit from cgcc. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Christopher Li <sparse@chrisli.org>
2014-10-10cgcc: use $ccom to set $multiarch_dir if not specifiedRamsay Jones1-0/+2
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Christopher Li <sparse@chrisli.org>
2014-10-10cgcc: use only the cc command to determine $gcc_base_dirRamsay Jones1-1/+2
Capture the c-compiler command, in the $ccom variable, in order to later invoke the compiler without extraneous command-line options. In particular, use the $ccom variable in order to cleanly invoke the compiler when setting the $gcc_base_dir variable. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Christopher Li <sparse@chrisli.org>
2014-10-10Add support for multiarch system header filesRamsay Jones1-0/+10
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Christopher Li <sparse@chrisli.org>
2014-09-28sparse: Make -Werror turn warnigns into errorsThomas Graf1-1/+1
Make sparse fail and return an error code if a warning is encountered and -Werror is specified or a hard error is found. This allows to use sparse in automated build systems to more easily catch new sparse warnings. The validation script is extended to parse the expected output message for an error message and validate the a non zero return value if such a error message is found. Also changes cgcc to die if the checker fails. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Christopher Li <sparse@chrisli.org>
2013-04-21Define __SIZEOF_POINTER__Josh Triplett1-5/+10
GCC defines a macro __SIZEOF_POINTER__ to the size of a pointer in bytes. Define it in sparse as well. Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Christopher Li <sparse@chrisli.org>
2010-03-28possible fix to cgcc issue in sparse 0.4.2:Joel Soete1-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>
2010-03-28New attribute designated_init: mark a struct as requiring designated initJosh Triplett1-1/+1
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>
2010-03-28Rename -Wall to Wsparse-all, so it doesn't get turned on unintentionallyJosh Triplett1-15/+2
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>
2009-08-01Define __LP64__ for x86_64 unless in 32 bit modeBlue Swirl1-1/+1
Signed-off-by: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
2009-08-01Add support for TImode type (__int128_t)Blue Swirl1-3/+4
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>
2008-12-18Let cgcc pass -gcc-base-dir to sparse.Alexey Zaytsev1-1/+13
Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
2008-12-18OpenBSD supportBlue Swirl1-0/+3
This patch adds OpenBSD support to sparse. Acked-by: Christopher Li <sparse@chrisli.org> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2008-12-18Sparc64 (Sparc V9, LP64) supportBlue Swirl1-0/+7
This patch adds support for Sparc64 (Sparc V9, LP64). Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2008-12-18Replace the -specs cgcc option with -targetAlexey Zaytsev1-1/+1
-spesc is just confusing, as gcc takes the same option for something compeltely different. Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
2008-08-26don't call sparse when called to generate dependenciesAlexander Shishkin1-0/+7
I have a situation here when $(CC) is called with -M options with slighly different set of -I/-D/etc arguments, which causes all sorts of funny reports from sparse. Also, this increases the overall build time because every compilation unit if sparsed twice. Signed-off-by: Alexander Shishkin <alexander.shishckin@gmail.com>
2008-04-07cgcc: handle ppc archJohannes Berg1-0/+7
I'm not sure this is exactly the right thing to do because I'm unfamiliar with the default CFLAGS, but it seems to at least make it mostly work on powerpc. Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
2007-08-31cgcc: Sparse accepts -Wundef, not -Wundefined-preprocessorJosh Triplett1-1/+1
cgcc's regex of Sparse warning options listed -Wundefined-preprocessor, which doesn't exist; change it to -Wundef. Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-08-31cgcc: Sparse accepts -Wcast-to-as, not -Wcast-to-address-spaceJosh Triplett1-1/+1
cgcc's regex of Sparse warning options listed -Wcast-to-address-space, which doesn't exist; change it to -Wcast-to-as. Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-08-22Make cgcc filter out all sparse warning related optionsYura Pakhuchiy1-1/+1
Signed-off-by: Yura Pakhuchiy <pakhuchiy@gmail.com>
2007-06-27cgcc: preserve sparse exit code if -no-compile is usedPavel Roskin1-2/+5
Signed-off-by: Pavel Roskin <proski@gnu.org>
2007-05-23Fix old typo: s/wierd/weird/Josh Triplett1-2/+2
Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-05-23Sparse always defines __STDC__ 1, so cgcc does not need to do soJosh Triplett1-3/+2
Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-05-23Add cygwin support to cgccRamsay Jones1-0/+10
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
2007-05-22Add -Wno-non-pointer-null to turn off warning about using a plain integer as ↵Josh Triplett1-1/+1
a NULL pointer Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-05-22Add -Wno-old-initializer to turn off warnings about non-C99 struct initializersJosh Triplett1-1/+1
Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-05-01Implement x86-64 support in cgcc.Alberto Bertogli1-0/+9
This patch makes cgcc run on x86-64 machines by extending add_specs(). [original patch] Signed-off-by: Alberto Bertogli <albertito@gmail.com> [integer and size_t size fixes, -m32 support] Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-05-01Teach cgcc about -ventry and -vdeadJosh Triplett1-0/+1
Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-05-01Teach cgcc about all currently existing sparse warning optionsJosh Triplett1-1/+1
Ideally these wouldn't need to exist in more than one place. Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-05-01Make cgcc not pass -Wall to sparse even if passing it to ccJosh Triplett1-1/+14
-Wall turns on all Sparse warnings, including experimental and noisy ones. Don't include it just because a project wants to pass -Wall to cc. If you really want cgcc to run sparse with -Wall, use CHECK="sparse -Wall". Signed-off-by: Josh Triplett <josh@freedesktop.org>
2007-04-20Teach cgcc about -Wtransparent-union and -Wno-transparent-unionJosh Triplett1-1/+1
Signed-off-by: Josh Triplett <josh@freedesktop.org>
2005-08-15Make 'cgcc' work at least half-way betterLinus Torvalds1-1/+1
Mark it executable, and use "sparse" instead of "check" by default, since that's what sparse gets installed as.
2005-04-07check.c:welinder@troll.com1-0/+3
Teach check that "-" is stdin. cgcc: Teach cgcc that "-" is a file.
2005-04-07Reorganize integer and floating point defines into specs.welinder@troll.com1-23/+25
2005-04-07lib.c:welinder@troll.com1-4/+26
Handle -U. cgcc: Teach cgcc about "-v". Teach cgcc not to run compiler when "-E" is seen. Add define for __SIZE_TYPE__.
2005-04-07Add -no-compilewelinder@troll.com1-20/+33
2005-04-07Handle predefines for integer types, floating point types,welinder@troll.com1-1/+146
and system in cgcc.
2005-04-07Teach cgcc about -Wbitwise and -Wtypesign.welinder@troll.com1-1/+1
2005-04-07Teach cgcc about flags that are for sparse only.welinder@troll.com1-10/+31
2005-04-07Wrapper to run check and gcc in series.welinder@troll.com1-0/+22