summaryrefslogtreecommitdiff
path: root/cflags.SH
Commit message (Collapse)AuthorAgeFilesLines
* cflags.SH - add -Wno-use-after-free on gcc 12/13Yves Orton2023-02-131-0/+13
| | | | | | | | | | | | | This works around an overly eager/buggy use-after-free warning detection in gcc 12/13, which gets upset if we copy a pointer into a UV and then realloc the pointer and then use the UV value for diagnostics. Since the copied value is no longer a pointer gcc should not warn, as we are not "using" the pointer, just printing it out as a number. The gcc folks have been informed. See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108115 Fixes #20601.
* cflags.sh should not add -std=c99 if -std=gnu99 is already setNicholas Clark2021-10-131-1/+5
| | | | | | | | | | | | Having both looks like it ought to cause the build to fail, as with -std=c99 second it will override any previous -std=gnu99, and some platforms need the former to both compile C99 code and have correct includes during Configure probing. However testing on those platforms without this change doesn't show any errors. So this change doesn't seem to strictly be necessary. But it does prevent our generated compiler command lines having contradictory flags, and hence looking daft.
* Teach Configure and cflags.SH about C99Nicholas Clark2021-10-131-62/+27
| | | | | | Probe to see whether we need -std=gnu99 or -std=c99 to get C99 code to compile. In cflags.SH, remove code that added gcc warning flags that were compatible with C89 but are not compatible with C99.
* Add -Werror=vla by default. C99 variable-length arrays are dangerous.Nicholas Clark2021-06-111-0/+1
| | | | | C11 makes them optional, and MSVC doesn't support them. We can't use them (but even if we could, we should not).
* properly quote the definition of warnsTony Cook2020-01-071-2/+2
|
* don't use -Werror=declaration-after-statement with C++Tony Cook2019-12-171-5/+11
| | | | | | | | declaration after statement is normal for C++ and C++ compilers rightly complain if we try to warn (or error) on them, so don't try to. fixes #17353
* Adapt Configure to GCC version 10Petr Písař2019-11-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | I got a notice from Jeff Law <law@redhat.com>: Your particular package fails its testsuite. This was ultimately tracked down to a Configure problem. The perl configure script treated gcc-10 as gcc-1 and turned on -fpcc-struct-return. This is an ABI changing flag and caused Perl to not be able to interact properly with the dbm libraries on the system leading to a segfault. His proposed patch corrected only this one instance of the version mismatch. Reading the Configure script revealed more issues. This patch fixes all of them I found. Please note I do not have GCC 10 available, I tested it by faking the version with: --- a/Configure +++ b/Configure @@ -4672,7 +4672,7 @@ $cat >try.c <<EOM int main() { #if defined(__GNUC__) && !defined(__INTEL_COMPILER) #ifdef __VERSION__ - printf("%s\n", __VERSION__); + printf("%s\n", "10.0.0"); #else printf("%s\n", "1"); #endif
* Rely on C89 <limits.h>Aaron Crane2017-10-211-2/+0
| | | | This requires newer metaconfig units that also rely on C89 <limits.h>.
* Rely on C89 <stddef.h>Aaron Crane2017-10-211-2/+0
|
* Rely on C89 <stdlib.h>Aaron Crane2017-10-211-2/+0
| | | | | | | | The Configure changes here were generated using a version of metaconfig that copies U/modified/i_stdlib.U from dist/U/vaproto.U, and changes it to unconditionally define the i_stdlib Configure variable. That variable is used by a large number of other Configure units, so it's not actually practical to try and remove the relevant unit entirely.
* Rely on C89 <stdarg.h>Aaron Crane2017-10-211-2/+0
|
* Don't pretend to determine whether ansi2knr is neededAaron Crane2017-10-211-1/+0
|
* Add -Werror=pointer-arith by defaultDagfinn Ilmari Mannsåker2017-08-171-1/+13
| | | | The core is already clean for this.
* cflags.SH: omit a needless process in generated fileAaron Crane2017-01-071-4/+4
| | | | | Using the shell "case" statement rather than grep(1) will save a process on every core C file compiled.
* Pull in unnecessarily duplicated case "$opt".Jarkko Hietaniemi2016-07-301-22/+20
|
* Add the -Wthread-safety also only for clang 3.6 (6.1) or later.Jarkko Hietaniemi2015-12-031-4/+4
| | | | (follow-up to bdc795f4, suggested by Aaron Crane)
* add -Wthread-safety for clang 3.5 or laterJarkko Hietaniemi2015-11-231-0/+23
| | | | | | | With this change there is no need to explicitly e.g. Configure ... -Accflags='-Wthread-safety' since doing just -Dusethreads with recent enough clang will automatically add the -Wthread-safety
* For perl #126468: protect quotes in myccflags.Jarkko Hietaniemi2015-10-291-1/+5
| | | | | Fixes a problem introduced by 57d2761b where ccflags contents with quotes got broken by the quotes getting stripped.
* Prefer -std=c89 over -ansi.Jarkko Hietaniemi2014-11-241-2/+15
|
* Revert "Drop -std=c89."Jarkko Hietaniemi2014-11-241-8/+2
| | | | This reverts commit 0d55a45a6f024919f13cbe70fc861f5eb6d757ee.
* Drop -std=c89.Jarkko Hietaniemi2014-11-201-2/+8
| | | | | | | | (1) It doesn't mean "strict C89" on its own, -pedantic would also be needed. (2) Using C99 features like long long or inline becomes harder. The downside of this change is that C99-isms can more easily creep into the core code, breaking it for non-gcc C89 compilers.
* Downgrade the optimization of regcomp.c on mips and mipsel due to a gcc-4.9 bugNiko Tyni2014-09-201-0/+5
| | | | | | | | | | | | | | | % cat ~/t.pl print ( (q{foo'} =~ /[^']+'/) ? "ok\n" : "not ok\n" ); % perl ~/t.pl ok % ./miniperl ~/t.pl not ok This only happens with -fPIC -ftree-vrp builds. It is a regression from gcc-4.8. Bug-Debian: http://bugs.debian.org/754054 Patch-Name: debian/regcomp-mips-optim.diff
* quadmath Q format specifier and gcc -Wformat do not mix.Jarkko Hietaniemi2014-09-191-0/+15
|
* For older clang versions put back -Wno-unused-value.Jarkko Hietaniemi2014-08-121-0/+11
| | | | | | Logical revert of b679cac0, but redone. Apple versions only for now; situation on Linux side unknown.
* Allow enabling -pedantic(-errors) (with -std=c89) for the core.Jarkko Hietaniemi2014-06-221-34/+91
| | | | | | | | | | | | | | | | | | The core was already -pedantic clean (with default config, with DEBUGGING almost), cflags just needed some juggling, somewhat complicated by the logic of -Werror=declaration-after-statement. Still requires -Dgccansipedantic to enable the -pedantic because otherwise we do not use things like gcc brace groups and C99 variadic macros, which are nice. Also, see below about usedtrace complications. (the gccansipedantic logic was odd, probably not used for a while.) Under -DDEBUGGING the -pedantic requires quieting the warnings about overlong string literals. Disable -pedantic et al if usedtrace is enabled, it uses too many non-standard features (and it depends on code generated by an external framework).
* In case someone manages to call g++ with -Wc++-compat.Jarkko Hietaniemi2014-06-191-0/+1
|
* The g++ flags removal was not right.Jarkko Hietaniemi2014-06-191-3/+5
|
* Add note about the -std=c89 needing -pedantic.Jarkko Hietaniemi2014-06-181-2/+7
|
* Echo also these added options.Jarkko Hietaniemi2014-06-181-3/+12
|
* -Wextra is the new -W, do not use both.Jarkko Hietaniemi2014-06-181-2/+12
|
* -Wendif-labels is actually the default.Jarkko Hietaniemi2014-06-181-1/+1
| | | | | Has been AFAICT for years / always, the documentation just had it wrong in pre-4.0 gccs.
* Enable -Werror=declaration-after-statement.Jarkko Hietaniemi2014-06-181-3/+12
| | | | | For C89 compliancy, this is the most common thinko people make. While waiting for -pedantic -std=c89, which will catch the same.
* Comment tweaking.Jarkko Hietaniemi2014-06-181-2/+13
|
* Make also cflags.SH clean with g++ -Wunused-*Jarkko Hietaniemi2014-06-181-33/+0
| | | | "clean" as in "not needed anymore".
* Looks like the core is now -Wunused-value clean with clang.Jarkko Hietaniemi2014-06-181-20/+0
| | | | | | Another possibility is that clang has become smarter, and that needs to be made dependent on clang version. But for now, let's opt for simplicity and less logic.
* cflags.SH: Whitespace only.Jarkko Hietaniemi2014-06-181-6/+6
|
* Move ccflags edits to extraction time.Jarkko Hietaniemi2014-06-181-56/+92
| | | | | | | | (Except for the possible toke_cflags customizations.) Do the -Wno-unused-... edits only if -Wall. Echo the edits done during extraction time, to make the magic more visible.
* Allow cflags.SH edits to ccflags to stick.Jarkko Hietaniemi2014-06-181-5/+3
|
* Some low-hanging -Wunreachable-code fruits.Jarkko Hietaniemi2014-06-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | - after return/croak/die/exit, return/break are pointless (break is not a terminator/separator, it's a goto) - after goto, another goto (!) is pointless - in some cases (usually function ends) introduce explicit NOT_REACHED to make the noreturn nature clearer (do not do this everywhere, though, since that would mean adding NOT_REACHED after every croak) - for the added NOT_REACHED also add /* NOTREACHED */ since NOT_REACHED is for gcc (and VC), while the comment is for linters - declaring variables in switch blocks is just too fragile: it kind of works for narrowing the scope (which is nice), but breaks the moment there are initializations for the variables (the initializations will be skipped since the flow will bypass the start of the block); in some easy cases simply hoist the declarations out of the block and move them earlier Note 1: Since after this patch the core is not yet -Wunreachable-code clean, not enabling that via cflags.SH, one needs to -Accflags=... it. Note 2: At least with the older gcc 4.4.7 there are far too many "unreachable code" warnings, which seem to go away with gcc 4.8, maybe better flow control analysis. Therefore, the warning should eventually be enabled only for modernish gccs (what about clang and Intel cc?)
* The clang frontend says "unknown" for -Wunknown.Jarkko Hietaniemi2014-06-151-0/+1
| | | | "unknown warning option" (for -W...) or "unknown argument" (for -...).
* do cflags on stdout, not stderrDavid Mitchell2013-12-251-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current UNIX build system does a strange thing to generate the appropriate command-line to compile a particular src file. It calls the cflags shell script, which 1) echoes to stdout the command line needed to compile the specified file (excluding the name of the src file itself), e.g. cc -c -Dfoo -Wbar ... 2) echoes the same thing to stderr, prefixied with ' CCCMD =' Make then does `sh cflags foo.o` foo.c the cflags output to stdout is captured by the backticks, and is used by make as the command line to run (with the foo.c appended). This run is silent. The output to stderr isn't captured, and gets displayed. So the user sees: $ make `sh cflags foo.o` foo.c CCCMD = cc -c -Dfoo -Wbar ... ... This is annoying for 2 reasons: 1) you don't get a simple command-line displayed which you could do a simple cut and paste with (e.g. when you want to recompile a specific source file, but alter the flags). 2) The make generates output on stderr, even when then there aren't any errors. So "make 2>errs" can't be used to quickly spot warnings and errors. This commit fixes this by making cflags just output the cc command and flags to stdout, then get Makefile to call it twice, once to echo the command-line (on stdout), and once to execute it with backticks. So the make output is now: $ make cc -c -Dfoo -Wbar ... foo.c ... There is some stuff in Makefile.SH related to cross-compiling, which this commit make have broken. Specifically the CCCMD and CCCMDSRC macros have been changed in the normal case to remove backticks (and add them to the make rules instead), but not for the cross compilation route. The CC* defs in the cross-compilation case have a trailing -I$(CROSS_LIB) outside of the backticks, which compilates matters. However, in the subdir Cross/, there appears to be separate (and divergent) copies of Makefile.SH and cflags, so maybe the files I edited are no longer used for cross-compilation???? (followup: according to <20131204170112.GA2490@iabyn.com> the cross-compiling stuff I mentioned above has bit-rotted, and I don't need to worry about it)
* cflags/cflags.SH: use '#' commentsDavid Mitchell2013-12-251-19/+19
| | | | | | | | | These scripts had a mixture of old-style ':' comments and new-style '#' comments. Since they have both, the old ones can't be needed for portability reasons, so standardise on the modern form. The old-style were just too confusing, especially as my syntax highlighter didn't know about them.
* cflags.SH - add commentaryDavid Mitchell2013-12-251-0/+17
| | | | | | Add comments to the top of cflags.SH to explain what it does. Also make it output comments at the top of the generated cflags script explaining that its auto-generated.
* cflags.SH: Fix a typo, cflags should be ccflagsBrian Fraser2013-12-111-1/+1
| | | | | This went undetected for the longest time since most flags are irrelevant at this point, but is vital if you are using --sysroot.
* Exempt clang from -Wunused-value when run as ccFather Chrysostomos2013-07-281-0/+9
| | | | | | | We already have an exception for it when called as clang or clang-1.2.3, but not when called as cc or anything else. Mac OS X Mountain Lion therefore ends up spitting out lots of warnings, as cc is a symlink to clang.
* Use -Wno-unused-value also on other clang compilersReini Urban2013-06-271-1/+1
| | | | clang++ or clang-3.2, ...
* If PERL_NO_INLINE_FUNCTIONS is defined, don't include "inline.h"Nicholas Clark2013-05-031-1/+1
| | | | | | | | | | | | | | This permits test code to include the perl headers for definitions without creating a link dependency on the perl library (which may not exist yet). Some of the static inline functions in inline.h reference functions in the perl object files, and some compilers aren't smart enough to eliminate unused static inline functions, hence including the inline.h in probe code can cause link errors even though the probe code uses none of the functions it declares. When probing, a failed link is taken as meaning that the probed-for function is not present, as the assumption is that the link fails because of it. Hence other causes of link failures cause the probing code to generate incorrect results, and action (and bugs) at a distance.
* add shebangs where missingSawyer X2012-09-221-0/+2
|
* In cflags.SH trim the case statement of file basenames.Nicholas Clark2012-06-191-47/+14
| | | | | | | | | | | | | | Add examples showing how to use cflags.SH to tweak the compiler flags used for individual object files. Previously cflags.SH contained a somewhat stale pre-canned list of file basenames including removed files such as usersub (deleted before 5.000 shipped), and a partial list of 5.000 XS extensions. Whilst it's possible to generate the correct list in cflags by parsing MANIFEST (and adding a few fixups), it's still not actually *useful*, as cflags gets overwritten as soon as config.sh changes. Hence the most end-user useful solution with minimal maintenance is to eliminate the list entirely, and document how the user should add to it as necessary.
* cflags: clang complains a lot about -Wunused-value which are not fixableReini Urban2012-06-081-0/+4
|