Commit Graph

72 Commits

Author SHA1 Message Date
Ole André Vadla Ravnås 859dc4255a Fix outdated cross-compilation checks 2020-05-13 15:51:54 +00:00
Christoph Reiter c4fa0fac3d Fix has_function() for clang on 64bit Windows
has_function() tries to link an example program using the function
to see if it is available, but with clang on 64bit Windows this
example always already failed at the compile step:

error: cast from pointer to smaller type 'long' loses information
            long b = (long) a;

This is due to long!=pointer with LLP64

Change from "long" to "long long" which is min 64bit and should always
fit a pointer. While "long long" is strictly a C99 feature every
non super ancient compiler should still support it.
2020-05-13 08:16:54 +00:00
Christoph Reiter d7e20b1543 Fix builtin check in has_function() with GCC 10 on Windows
The builtin check had a special case that if a header was provided and
the function wasn't defined, it would ignore the builtin to avoid
non-functional builtins (for example __builtin_posix_memalign in MSYS2).

GCC 10 gained support for __has_builtin() which now skipps this check
and because __has_builtin(__builtin_posix_memalign) returns true the
non functional builtin is now reported as available.

To get the old behaviour back move the special case in front of the actual
availability check.

Fixes #7113
2020-05-11 14:53:25 -07:00
Andrew Udvare 39ca178d21 compilers: fix type issue
mesonlib.darwin_get_object_archs() only accepts a string argument so convert
it.
2020-04-23 10:00:27 -07:00
Nirbheek Chauhan dc19b13202 compilers: Silence warning about gnu_inline with clang
The warning is due to a change in behaviour in Clang 10 and newer:

https://releases.llvm.org/10.0.0/tools/clang/docs/ReleaseNotes.html#c-language-changes-in-clang

This was already fixed for clang++, but not for clang for some reason.
It was also fixed incorrectly; by adding `extern` instead of moving
from `-Werror` to `-Werror=attributes`.
2020-04-20 19:30:57 +03:00
Ole André Vadla Ravnås c0a8abc580 compilers: Honor <lang>_ld when linking C-like outputs 2020-04-17 18:23:40 +03:00
Dylan Baker b5e077fce8 compilers: Move things out of clike
One method belongs in the base Compiler class, the other belongs in
the GnuLikeCompiler class.
2020-04-10 12:33:34 -07:00
Michael Hirsch, Ph.D 5b4ebb5641 quality / test: Fortran type hinting
enhance fortran args tests
2020-04-05 13:43:53 +03:00
Andrei Alexeyev 96ed64caa1 Make cc.has_function work on GCC/Clang __builtins 2020-04-04 20:51:35 +03:00
Richard Weinberger 12fa8d06e2 Fix exe_wrapper usage in EmptyExternalProgram case
If no exe_wrapper is set in the meson cross file the exe_wrapper
object will be an instance of EmptyExternalProgram.
So, found is True and prorgram is an empty list.

This will cause meson to tun the compiler sanity check because
it checks only for self.is_cross and self.exe_wrapper being
not None.

I ran into that situation while cross compiling for ia32 on a
x64_64 host. The host had no ia32 userspace installed, so the
self test failed.

As workaround I currently set exe_wrapper to 'true'.

Signed-off-by: Richard Weinberger <richard@nod.at>
2020-03-19 19:09:18 +02:00
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01:00
Daniel Mensinger e4a0ee205d lgtm: Fix redundant code 2019-12-05 00:22:10 +02:00
Xavier Claessens e4e5f981eb Fix compute_int() when the value is -1 2019-11-21 01:32:11 +02:00
Michael Hirsch, Ph.D 83b4e981c4 Use strict function prototypes 2019-11-18 22:21:36 +02:00
Aleksey Gurtovoy 6ac5db50c9 CUDA support on Windows 2019-09-24 14:22:20 -07:00
Jehan 179861ccd1 mesonbuild: fix exception name.
CrossNoRunException is in compilers module, not mesonlib.
2019-09-23 13:25:53 -04:00
Dylan Baker 06dcbd50ee compilers: Dispatch to dynamic linker class
Most of the cuda code is from Olexa Bilaniuk.
Most of the PGI code is from Michael Hirsc
2019-08-14 13:13:23 -07:00
Michael Hirsch, Ph.D 7eebb6749a
no special shared lib args for PGI 2019-07-30 15:29:51 -04:00
Martin Liska c1870889b1 Fix missing return statements that are seen with -Werror=return-type.
Error example:

Code:

        #include <locale.h>
        int main () {
            /* If it's not defined as a macro, try to use as a symbol */
            #ifndef LC_MESSAGES
                LC_MESSAGES;
            #endif
        }
Compiler stdout:

Compiler stderr:
 In file included from /usr/include/locale.h:25,
                 from /tmp/tmpep_i4iwg/testfile.c:2:
/usr/include/features.h:382:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
  382 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
      |    ^~~~~~~
/tmp/tmpep_i4iwg/testfile.c: In function 'main':
/tmp/tmpep_i4iwg/testfile.c:8:9: error: control reaches end of non-void function [-Werror=return-type]
    8 |         }
      |         ^
cc1: some warnings being treated as errors
2019-07-16 09:49:03 +02:00
Dylan Baker f574beffb4 compilers/mixins/elbrus: add type annotations and fix types
There is a pretty big error in here, trying to return a tuple
comperhension: (a for a in []) is not a tuple, it's a generator. This
has profound type annotations: generators don't support most tuple or
list methods, and they can only be iterated once. Beyond that tuples are
meant for heterogenous types, ie, position matters for types. I've
converted the output to a list in all cases.
2019-07-15 10:59:22 -07:00
Dylan Baker 214ab455d3 compilers: Move the VisualStudioLikeCompiler class into mixins 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