Commit Graph

215 Commits

Author SHA1 Message Date
Rodrigo Lourenço 76cd306204 Add b_colorout option for Clang compilers. 2017-02-19 16:36:49 +00:00
Nirbheek Chauhan ad8048aac3 compilers: Don't use CompilerArgs() for sanity checks
It's only useful to use those when you have to override include dirs
or library paths by appending them from various sources according to
the priority order, or if the compiler args need to be converted from
Unix/GCC-style to native (MSVC, for instance) style.

Sanity checks match neither of these.

Closes https://github.com/mesonbuild/meson/issues/1351
2017-02-02 19:40:12 +02:00
Nirbheek Chauhan a83c7b9ad5 Add get_no_stdinc_args() for C++ too 2017-01-28 05:09:59 +05:30
Nirbheek Chauhan dbcbf19ece compilers: New class CompilerArgs derived from list()
The purpose of this class is to make it possible to sanely generate
compiler command-lines by ensuring that new arguments appended or added
to a list of arguments properly override previous arguments.
For instance:

>>> a = CompilerArgs(['-Lfoo', '-DBAR'])
>>> a += ['-Lgah', '-DTAZ']
>>> print(a)
['-Lgah', '-Lfoo', '-DBAR', '-DTAZ']

Arguments will be de-duped if it is safe to do so. Currently, this is
only done for -I and -L arguments (previous occurances are removed when
a new one is added) and arguments that once added cannot be overriden
such as -pipe are removed completely.
2017-01-27 23:42:22 +05:30
Jussi Pakkanen b81d00b4b6 Merge pull request #1328 from centricular/has-function-prefix
Add prefix before including limits.h in has_function checks
2017-01-26 22:56:05 +02:00
Nirbheek Chauhan e084a47a0a compilers: Don't run built-in checks on MSVC
MSVC does not have built-ins, so this is totally useless. Instead, add
a test for intrinsics to ensure that we do find them.
2017-01-26 12:36:47 +05:30
Nirbheek Chauhan 85b8e92bc4 compilers: Fix has_function check for builtins
Use a single check for both cases when we have includes and when we
don't. This way we ensure three things:

1. Built-in checks are 100% reliable with clang and on macOS since clang
   implements __has_builtin
2. When the #include is present, this ensures that __builtin_func is not
   checked for (because of MSYS, and because it is faster)
3. We fallback to checking __builtin_func when all else fails
2017-01-26 12:36:47 +05:30
Nirbheek Chauhan 748fe80423 compilers: Add prefix before limits.h in has_function checks
prefix might define _GNU_SOURCE, which *must* be defined before your
first include of limits.h, so we must define it first.

There's not really any downsides to including limits.h after the
prefix.
2017-01-26 09:16:48 +05:30
Nirbheek Chauhan 3433fc54c9 compilers: Pass -fpermissive on all C++ compilers except MSVC 2017-01-26 09:16:48 +05:30
Nirbheek Chauhan bb2a6858d0 compilers: Use named placeholders for string formatting
This makes it much clearer what each placeholder will be formatted to.
2017-01-26 09:16:48 +05:30
Nirbheek Chauhan fbbfbfac7e compilers: Fix builtin checks with clang on Linux
Our "43 has function" test should also work with clang and icc on Linux,
so enable them. Also detect builtins with __has_builtin if available,
which is much faster on clang.

There is a feature request for the same with GCC too:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66970
2017-01-26 09:16:48 +05:30
Jussi Pakkanen 8cb5f28a8d Use --coverage rather than hardcoding -lgcov. Closes #1311. 2017-01-23 22:14:17 +02:00
Nirbheek Chauhan 7e1654bf08 compilers: Use __has_include macro for has_header checks
If it's available, it's much much faster than doing #include
+ preprocess. Speeds up has_header checks by about 40% for me.

Currently, only Clang supports this
2017-01-24 01:21:43 +05:30
Nirbheek Chauhan f49b50d432 compilers: Remove unnecessary arguments to super() 2017-01-24 01:21:42 +05:30
Jussi Pakkanen 469a758c32 Merge pull request #1320 from centricular/fix-llvmir-and-assembly
Fix llvmir and assembly
2017-01-23 20:42:47 +02:00
Nirbheek Chauhan 7b3957afbd Fix targets with generated LLVM IR and Assembly sources
These two are also C-like sources, so don't ignore them in
backends/ninjabackend.py:generate_target() when we call
is_source() on the list of generated sources for that target.

Closes #1318
2017-01-21 20:17:21 +05:30
Mike Sinkovsky 969be1f679 cleanup: Remove redundant parentheses 2017-01-18 21:22:47 +02:00
Mike Sinkovsky 5b626ab4cb style: [E1**] Indentation 2017-01-11 12:33:27 -05:00
Mike Sinkovsky f9344b03a8 style: [E721] do not compare types, use 'isinstance()' 2017-01-11 12:33:27 -05:00
Jussi Pakkanen 56e2c46ce1 Merge pull request #1272 from mesonbuild/ignatenko/lint
fix some linting errors
2017-01-03 16:04:24 -05:00
Nirbheek Chauhan 2589009d23 ifort: Derive from IntelCompiler base class
And fix the list of supported file suffixes, and use .f90 for all
fortran tests since ifort, the Intel Fortran compiler ignores files
ending with .f95, .f03, and .f08
2017-01-04 00:41:56 +05:30
Nirbheek Chauhan 6e5c87e380 icc: Always specify the language to use for PCH usage
Without this, ICC sometimes gets confused and thinks that the included
header is a C header instead of a C++ header.
2017-01-04 00:40:54 +05:30
Nirbheek Chauhan e31d067fed compilers.py: Use a common variable for warn args
Makes it totally clear what extra args are added by each warning level.
2017-01-04 00:40:54 +05:30
Nirbheek Chauhan 509bc30cdd compilers: gnu++03 is not a valid Clang C++ standard
It is not (no longer?) supported by Clang:

error: invalid value 'gnu++03' in '-std=gnu++03'
2017-01-04 00:40:54 +05:30
Nirbheek Chauhan 731aca216e icc: Fix C/C++ std options and add a unit test for them
Compiler versions 15.0 and later actually ignore invalid values for the
-std= option unless `-diag-error 10159` is passed, so we need to put
that in the unit test.

I have tested this with versions 14.0.3, 15.0.6, 16.0.4, and 17.0.1.
Would be great if someone could test with 13.x.y
2017-01-04 00:40:54 +05:30
Philipp Geier 54697b4130 ICC 17.0.0 working for Linux and Ninja Backend.
Added IntelCompiler, IntelCCompiler and IntelCCompiler.
environments.py has been changed to detect icc and icpc.
ninjabackend changed for proper pch generation.

ICC 17.0.0 does not support C++13 (that's why default arguments tests fails).
Test 25 object extraction fails due to some unescaped whitespaces.
Some test with vala fail because of successful build, although they
should fail, as warning do not exit with failure.
2017-01-04 00:40:54 +05:30
Mike Sinkovsky 079e43f70b fix 'unreachable code' warnings 2017-01-03 13:34:39 -05:00
Mike Sinkovsky 3b0eec7703 fix 'method signature does no match signature of overridden method' 2017-01-03 13:33:49 -05:00
Igor Gnatenko ef3cc6b3fa style: fix E127 violations
E127: continuation line over-indented for visual indent

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-02 19:16:56 +01:00
Igor Gnatenko dd36847c4b style: fix E202 violations
E202: whitespace before ']'

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-02 19:09:47 +01:00
Mike Sinkovsky 2d2e3b943c fix for cross-builds targeting macosx 2017-01-02 11:08:30 -05:00
Igor Gnatenko 969dc7e995 style: fix E124 violations
E124: closing bracket does not match visual indentation

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Igor Gnatenko ea570bcb67 style: fix E265 violations
E265: block comment should start with '# '

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Igor Gnatenko 5693758e46 style: fix E231 violations
E231: missing whitespace after ','

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Igor Gnatenko 2017d8578a style: fix E226 violations
E226: missing whitespace around arithmetic operator

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Igor Gnatenko f0b30baa39 style: fix E225 violations
E225: missing whitespace around operator

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Jussi Pakkanen b55235dfbd Fix space before :. 2016-12-31 16:28:15 +02:00
Matthias Klumpp 7eb96375ca gdc: Make dependency check work
The -fmake-deps command does not segfault anymore, and if it is used
with "=" there will also be no "file not found" error.
2016-12-23 19:01:15 +02:00
Matthias Klumpp c6fb5aec58 d: Correctly set SONAME on D shared libraries
All D compilers use the system linker, which is very convenient here.
2016-12-21 15:49:44 +01:00
Matthias Klumpp fc72aa1e65 ldc/dmd: Properly set warning arguments 2016-12-21 15:49:44 +01:00
Jussi Pakkanen a2528a8816 Merge pull request #1233 from mesonbuild/wip/ignatenko/code-style
Trivial cleanups in code
2016-12-21 00:09:44 +02:00
Nirbheek Chauhan 9bc07a0941 Fix several more lint errors
Found by Igor Gnatenko

************* Module mesonbuild.interpreter
E:1232,33: No value for argument 'interp' in constructor call (no-value-for-parameter)
************* Module mesonbuild.dependencies
E: 68, 4: An attribute defined in mesonbuild.dependencies line 39 hides this method (method-hidden)
************* Module mesonbuild.environment
E: 26, 0: class already defined line 19 (function-redefined)
E: 68,18: Undefined variable 'InterpreterException' (undefined-variable)
E:641,39: Undefined variable 'want_cross' (undefined-variable)
E:850,94: Undefined variable 'varname' (undefined-variable)
E:854,94: Undefined variable 'varname' (undefined-variable)
E:860,102: Undefined variable 'varname' (undefined-variable)
E:863,94: Undefined variable 'varname' (undefined-variable)
************* Module mesonbuild.modules.gnome
E:438,26: Undefined variable 'compilers' (undefined-variable)
2016-12-20 00:07:00 +02:00
Igor Gnatenko 971a3a3cd9 tree-wide: remove trailing whitespaces
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-19 18:34:02 +01:00
Elliott Sales de Andrade 51e6a3986a Fix undefined variables in cross-compile. 2016-12-19 14:07:25 +02:00
Jussi Pakkanen 949c5bb290 Merge pull request #1207 from centricular/has-header-preprocess-only
has_header: Don't compile, only preprocess
2016-12-18 12:35:47 +02:00
Nirbheek Chauhan 6981d29861 compilers: Always pass -pipe to compiler checks
This is obviously much faster. Not sure why we weren't doing it already.

Causes a speed-up of about 10-15%
2016-12-18 10:17:36 +05:30
Nirbheek Chauhan 6292122a19 has_header: Don't compile, only preprocess
Since we're checking for the existence of a header, just running the
preprocessor is enough. According to my benchmarks, doing this makes the
test roughly 2x faster.

I'm sure this will be useful for other checks too in the future.

This shaves off 7% on the configure time for glib on my machine.

This also fixes the issue that we had earlier where you had to specify
any extra headers needed to resolve symbols in the header being checked
for with `prefix`.
2016-12-18 10:17:36 +05:30
Nirbheek Chauhan 2b842de341 compilers: Ignore -pthread in link flags with MSVC
Sometimes .pc files add -pthread in Libs: instead of -lpthread, so
ignore that too when building with MSVC.
2016-12-17 12:56:01 +02:00
Jussi Pakkanen b01d2c35b7 Only add build dir inlude directives if the corresponding dir exists. Closes #1185. 2016-12-13 14:19:34 +02:00
Jussi Pakkanen de83e94b5a Merge pull request #1171 from centricular/fix-extracted-generated-prebuilt-object-targets-linking
Several fixes to how we handle objects in build targets
2016-12-13 12:22:11 +02:00