Commit Graph

32 Commits

Author SHA1 Message Date
Eli Schwartz 8947352889 fix various flake8 whitespace errors 2021-10-27 09:51:52 -04:00
Eli Schwartz 4ab70c5512
fix extra whitespace
discovered via flake8 --select E303
2021-10-04 16:29:31 -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
Jussi Pakkanen c54dd63547 Make objective C use C standard version. Closes #5495. 2021-05-11 22:47:17 +03:00
Ralf Gommers a48a89374a Clean up unused imports 2021-05-02 22:27:40 +03:00
Ralf Gommers d0325c898a Use sanity_check_impl for objc/objpp
This gets rid of compile warnings, and simplifies the code.
Note that `work_dir` in sanity_check_impl was incorrect,
it was used both to prepend to file names and as cwd=work_dir
argument to Popen. This is fixed here.

Closes gh-7344
2021-05-02 22:27:40 +03:00
Dylan Baker 40e3577a65 split program related classes and functions out of dependencies
Dependencies is already a large and complicated package without adding
programs to the list. This also allows us to untangle a bit of spaghetti
that we have.
2021-03-19 08:47:10 -04:00
Dylan Baker fe973d9fc4 use OptionKey for compiler_options 2021-01-04 12:20:39 -08:00
Dylan Baker da4c1945fc compilers/objcpp: add type annotations 2020-09-24 12:14:13 -07:00
Dylan Baker 2c0fbe161d compilers: make is_cross part of the base Compiler class
Every class needs to set this, so it should be part of the base. For
classes that require is_cross, the positional argument remains in their
signature. For those that don't, they just allow the base class to set
their value to it's default of False.
2020-09-24 12:14:13 -07:00
Dylan Baker b6c28d282c compilers: Add Apple subclasses for ObjC and ObjC++
These are needed because in some cases we need to be able to know if
we're using vanilla clang or Apple's clang.
2020-08-22 10:49:35 -07:00
Yevhenii Kolesnikov 9dc3ca2c1c compilers: add fetching of define list for clang
Simmilar to gcc, the list of pre-processor defines can be fetched with
`-dM -E` option. The way cpu_family is determined on linux relies on
this list.

Fixes incorrect value of cpu_family on linux, when crosscompiling:

```
CC="clang -m32" meson ./build
```

Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
2020-05-22 16:58:12 +03:00
Ole André Vadla Ravnås 7195c0ee9c compilers: Fix accidental coredata mutations 2020-03-29 20:55:35 +03:00
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01:00
Dylan Baker 7460e4ccda compilers: Make get_display_language a class or static method
Currently this is done at the instance level, but we need it at the
class level to allow compiler "lang" args to be gotten early enough.
This patch also removes a couple of instance of branch/leaf classes
providing their own implementation that is identical to the Compiler
version.
2019-12-12 09:35:32 -08:00
Dylan Baker ee6e249f65 compilers: move language attribute to the class level
We know that if a compiler class inherits CCompiler it's language will
be C, so doing this at the class level makes more sense.
2019-12-12 09:35:30 -08:00
Michael Hirsch, Ph.D 83b4e981c4 Use strict function prototypes 2019-11-18 22:21:36 +02:00
Dylan Baker 0c22798b1a compilers: replace CompilerType with MachineInfo
Now that the linkers are split out of the compilers this enum is
only used to know what platform we're compiling for. Which is
what the MachineInfo class is for
2019-10-07 12:08:20 -07:00
Dylan Baker e7db288e19 compilers/objc[pp]: Pass extra keyword arguments to Compiler constructor 2019-08-14 13:13:23 -07:00
Dylan Baker bc4438b34f compilers: Put clang mixin in a module 2019-07-15 10:59:22 -07:00
Dylan Baker cd5360821a compilers: split gnu and gnulike compilers out of compilers
I debated a bit whether both classes really belong in the same module,
and decided that they do because the share a number of helpers.
2019-07-15 10:59:22 -07:00
Dylan Baker d483da46a9 compilers: Move clike into a mixins directory
The compilers module is rather large and confusing, with spaghetti
dependencies going every which way. I'm planning to start breaking out
the internal representations into a mixins submodule, for things that
shouldn't be required outside of the compilers module itself.
2019-07-15 10:59:22 -07:00
David Seifert fcf27c2a2d Do not fail on passing `-Werror=unused-parameter` from environment 2019-07-14 15:12:16 +00:00
Nirbheek Chauhan 9042130e9a compilers: Fix bitcode and other options for objc code
We were setting the base options for the Objective-C compiler
manually, due to which options such as b_bitcode and b_ndebug were not
getting set at all.

The base options here are the same as for C code with the Clang
compiler, so just use the same inherited list.

Also expand the bitcode test to ObjC and ObjC++ so this doesn't happen
again.
2019-06-23 16:50:24 +03:00
John Ericson 07777e15d4 Purge `is_cross` and friends without changing user interfaces
In most cases instead pass `for_machine`, the name of the relevant
machines (what compilers target, what targets run on, etc). This allows
us to use the cross code path in the native case, deduplicating the
code.

As one can see, environment got bigger as more information is kept
structured there, while ninjabackend got a smaller. Overall a few amount
of lines were added, but the hope is what's added is a lot simpler than
what's removed.
2019-06-09 13:13:25 -04:00
Dylan Baker 541523eeba compilers: Split C-Like functionality into a mixin classes
Currently C++ inherits C, which can lead to diamond problems. By pulling
the code out into a standalone mixin class that the C, C++, ObjC, and
Objc++ compilers can inherit and override as necessary we remove one
source of diamonding. I've chosen to split this out into it's own file
as the CLikeCompiler class is over 1000 lines by itself. This also
breaks the VisualStudio derived classes inheriting from each other, to
avoid the same C -> CPP inheritance problems. This is all one giant
patch because there just isn't a clean way to separate this.

I've done the same for Fortran since it effectively inherits the
CCompiler (I say effectively because was it actually did was gross
beyond explanation), it's probably not correct, but it seems to work for
now. There really is a lot of layering violation going on in the
Compilers, and a really good scrubbing would do this code a lot of good.
2019-05-03 10:36:50 -07:00
John Ericson f4da210f46 Sanity check with external args
Previously cross, but not native, external args were used. Then in
d451a4bd97 the cross special cases were
removed, so external args are never used.

This commit switches that so they are always used. Sanity checking works
just the same as compiler checks like has header / has library.
2019-03-27 10:54:56 -04:00
jml1795 a9e63568fe Add warning level zero 2019-02-19 00:06:27 +02:00
John Ericson d451a4bd97 Remove get_cross_extra_flags
This is no longer needed, we just remove conditionals around it.
2019-02-15 09:17:24 -08:00
David Seifert 69ec001b06 Use enum instead of `int` for compiler variants
* Enums are strongly typed and make the whole
  `gcc_type`/`clang_type`/`icc_type` distinction
  redundant.
* Enums also allow extending via member functions,
  which makes the code more generalisable.
2018-09-16 00:47:32 +03:00
Guillaume Poirier-Morency fab5634916 Add 'Compiler.get_display_language'
Use this when we print language-related information to the console and
via the Ninja backend.
2017-06-26 14:15:44 -04:00
Alistair Thomas 117f4ab8b5 Split out languages from compilers.py 2017-06-23 00:42:41 +01:00