Commit Graph

873 Commits

Author SHA1 Message Date
Andrea Pappacoda 68eca11cc6 Use -Oz when optimization=s in Clang
-Oz is the appropriate flag to use when you want to produce the smallest
possible binary, and is one would expect when setting optimization to s
or using the minsize build type.
2021-09-21 09:58:48 -07:00
Rohit Goswami 32ba349f0a compilers: Use standards compliant test 2021-09-20 01:29:59 -04:00
miebka 59fe80602e C2000: Added depfile generation for incremental builds 2021-09-16 02:37:13 +03:00
Eli Schwartz 87e13af1c8
apply flake8 fixes for unused imports and missing imports 2021-09-14 15:55:07 -04:00
Eli Schwartz cbfdfca089
compilers: publicly export one more constant
It is imported from a subpackage in __init__ alongside a big list of
other things which are all exported. And elsewhere, this import is
re-imported by other code. It's pretty clearly an oversight that it
didn't get added to __all__
2021-09-14 15:50:29 -04:00
Mat Cross 85a5aed60f nagfor preprocessor flag. 2021-09-10 16:08:57 -04:00
Mat Cross 436a257c50 Comments on nagfor options setup. 2021-09-10 16:08:57 -04:00
Mat Cross 0e86258748 Implemented some missing operation for the NAG Fortran Compiler. 2021-09-10 16:08:57 -04:00
Eli Schwartz 3f796c43df objc/objcpp compiler: accept all gnu stds corresponding to c/c++ stds
The clang compiler now reimplements and re-checks the c_std and cpp_std
options in order to use them for objc as well, but it didn't
consistently support the same options. First it completely excluded all
the gnu ones, and then it added a handful of them but not for C++.

Be fully consistent -- or at least as consistent as we can be, given a
minimally working fix. (The C/C++ compiler mixin actually gates
different stds depending on detected clang version, we do not do that
here.)

Fixes regression in c54dd63547
Fixes incomplete fix from #8766 (which didn't fix objcpp at all)

Fixes #9237
2021-09-10 13:03:56 -07:00
Evan Miller b8cfb3d131 Support for appleframeworks with GCC and Intel
Fixes #8792
Fixes #8733
2021-09-04 01:29:35 +03:00
Dylan Baker 9bf669a016
Clang should error for all implicit function checks (#9165)
* compilers: improve docstring to `get_compiler_check_args()`

There was an incomplete list, which wasn't useful as it now takes an
enum anyway. Also add a new entry to the list of reasons to use this
function.

* clang: Add -Werror=implicit-function-declarations to check_args

Unlike GCC, clang warns but doesn't error when an implicit function
declaration happens. This means in checks like
`compiler.has_header_symbol('string.h', 'strlcat')` (on Linux, at least)
that GCC will fail, as there is no such function; clang will emit a
warning, but since it exists with a 0 status Meson interprets that as
success. To fix this, add `-Werror=implicit-function-declarations` to
clang's check arguments.

There seems to be something specific about functions that _may_ exist in
a header on a given system, as `cc.has_header_symbol('string.h',
'foobar')` will return false with clang, but `strlcat` will return true,
even though it's not defined. It is however, defined in some OSes, like
Solaris and the BSDs.

Fixes #9140
2021-09-01 22:25:32 +03:00
Xavier Claessens ea02c1c48a msvc: Assume UTF8 source by default
Currently every project that uses UTF8 for its source files must add
'/utf-8' argument otherwise they don't work non-English locale MSVC.

Since meson.build itself is assumed to be UTF8 by default, seems better
to assume it for source files by default too.

For example:
- https://gitlab.freedesktop.org/gstreamer/gst-build/-/blob/master/meson.build#L62
- https://gitlab.gnome.org/GNOME/glib/-/blob/main/meson.build#L29
2021-09-01 19:26:36 +03:00
Dylan Baker 4d7031437c pylint: turn on superflous-parens
We have a lot of these. Some of them are harmless, if unidiomatic, such
as `if (condition)`, others are potentially dangerous `assert(...)`, as
`assert(condtion)` works as expected, but `assert(condition, message)`
will result in an assertion that never triggers, as what you're actually
asserting is `bool(tuple[2])`, which will always be true.
2021-08-31 16:28:54 -04:00
Tristan Partin be92e37837 Add Java module
The Java module will serve as a source for easing Java development
within Meson. Currently it only supports generating native header files.
2021-08-22 07:57:29 -07:00
Dylan Baker a3c94956c8 compilers: Add get_no_warn_args to the base Compiler class
Because it should be defined there.
2021-08-20 18:57:19 +02:00
Dylan Baker 6d055b1e27 compilers/compilers: Fix some potential issues spotted by pyright
There are two changes here, one is to remove an `elif` that is
effectively an `else`, that helps the type checker and provides a small
speedup potentially. The second is a potentially unbound variable, that
currently isn't hit, but very much could be.
2021-08-16 16:21:51 -07:00
Dylan Baker e3c72ad7c7 compilers: Fix extra_args parameter
which can also be a callable taking a CompileChekcMode as an argumetn
and returning a list of strings.
2021-08-16 16:21:51 -07:00
Dylan Baker e9639be167 compilers: Fix annotations for run and cached_compile
Which absolutely should accept `str | File`, but the annotations claim
that only strings are accepted.
2021-08-16 16:21:51 -07:00
Jussi Pakkanen a90d2925dd Revert "compilers/c++: Add MSVC option to make the __cplusplus define accurate"
This reverts commit 0b97d58548.
2021-08-15 13:18:35 +03:00
Dylan Baker 0b97d58548 compilers/c++: Add MSVC option to make the __cplusplus define accurate
Otherwise it always returns the value for c++98, starting with MSVC 2017
15.7 or later. Earlier versions are not affected by this mis-feature
2021-08-11 21:54:16 +03:00
Jussi Pakkanen f2fe271198 Add support for finding Javascript source libraries with Emscripten. 2021-08-08 15:25:48 +03:00
miebka f8c4752cbc C2000 compiler also accepts *.cla files 2021-07-25 09:07:12 -07:00
David Seifert 28d13f4bfe
Cuda: Enable PGO 2021-07-18 23:14:38 +02:00
David Seifert d648f3497e
Cuda: Filter -isystem with system paths 2021-07-18 23:14:36 +02:00
David Seifert 631abce82f
Cuda: Pass -DNDEBUG through 2021-07-18 23:14:34 +02:00
Paolo Bonzini 3efed376c3 linkers: remove is_shared_module argument to get_soname_args
The argument is now unused, drop it.
2021-07-14 22:53:04 +02:00
Pamplemousse 762c073500 Clang: Apply `-O0`
Fix #8986
2021-07-13 16:40:40 -07:00
Andrea Pappacoda 81d9acab87 Fix unsupported linker error message
An `f` was dropped in bd6f46e723
2021-07-06 11:46:20 -04:00
Eli Schwartz bd6f46e723 condense lines 2021-07-05 17:55:04 +03:00
Eli Schwartz b4b488f33c simplify mesonlib imports for the sake of line lengths 2021-07-05 17:55:04 +03:00
Eli Schwartz dd31891c1f more f-strings too complex to be caught by pyupgrade 2021-07-05 17:55:04 +03:00
miebka 3021f256ea C2000: linker uses now binary setting defined within the cross-file 2021-07-01 01:58:24 +03:00
Daniel Mensinger 3e396b3782
fix: Always explicitly set encoding for text files (fixes #8263) 2021-06-29 11:28:08 +02:00
Ian Harvey 84b371c645 Update detect.py
Adjust Intel Fortran compiler detection to handle changes in ifort logo with the introduction of the oneapi toolkit.  See #8338.
2021-06-27 17:50:30 +03:00
Daniel Mensinger b95d6e319f typing: Annotate compilers.detect 2021-06-25 19:34:48 +02:00
Daniel Mensinger 3f889606c7 Split compiler detection from Environment
This moves all the compiler detection logic into the new
compilers.detect module. This dramatically reduces the size
and complexity of Environment.
2021-06-25 19:34:48 +02:00
Justin Handville e8e03cdc72 Fixed style issue as per comments on PR 8911. 2021-06-22 12:46:17 +02:00
Justin Handville 9f248c778d Fix for Issue 8910 (Meson filters CMake asm files) 2021-06-22 12:46:17 +02:00
Daniel Mensinger 66b32a4591 holders: Introduce HoldableObject 2021-06-18 23:48:33 +02:00
Daniel Mensinger 202e345dfb interpreter: Refactor interpreter.compiler to use ObjectHolder 2021-06-18 23:48:33 +02:00
Daniel Mensinger 9c40b33cf6 compilers: Fix missing functions in Compiler base class 2021-06-09 09:46:37 +02:00
Eli Schwartz 998076a192
upgrade percent formatted strings pyupgrade did not catch 2021-06-07 16:51:47 -04:00
Eli Schwartz 3eb1da1fa2
condense lines 2021-06-07 16:51:47 -04:00
Eli Schwartz 2c71b63e77
more f-strings everywhere
pyupgrade didn't catch many .format() methods which were too complex
(e.g. multiline or applied to templates rather than string literals)
2021-06-07 16:51:47 -04:00
Dylan Baker 0bc18f26a2 cython: Add an option for selecting python 3 vs python 2 output 2021-06-07 09:25:32 -07:00
Dylan Baker 4d1cbd1b8a compilers: Add cython file suffixes 2021-06-07 09:16:19 -07:00
Dylan Baker edf1a21722 compilers: Expose Cython compiler 2021-06-07 09:16:18 -07:00
Dylan Baker e9681b463d hack: compilers/cython: hardcode python 3 not 2 2021-06-07 09:15:13 -07:00
Dylan Baker 79e50caa7f compilers: Add a cython Compiler 2021-06-07 09:15:13 -07:00
Daniel Mensinger 240434b167 typing: Fully annotate dependencies.cuda 2021-06-05 12:35:48 +02:00