Commit Graph

14 Commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
d7a6305ba4 glib/gnulib/meson: Disable some warnings on clang windows builds
We have gnulib warnings in windows under clang:
  ../glib/gnulib/vasnprintf.c:2429:21: warning: variable 'flags' set but not
    used [-Wunused-but-set-variable]
                int flags = dp->flags;
                    ^

  ../glib/gnulib/vasnprintf.c:4853:19: warning: unannotated fall-through
    between switch labels [-Wimplicit-fallthrough]
                  case TYPE_LONGINT:
                  ^

See: https://gitlab.gnome.org/3v1n0/glib/-/jobs/2361750
2022-10-31 12:00:53 +01:00
Marco Trevisan (Treviño)
681bb3cb21 gnulib: Add glib built headers to the gnulib_lib required sources
g-gnulib.h includes glib.h that requires some headers to be generated,
so ensure that this is always the case.

See: https://gitlab.gnome.org/GNOME/glib/-/jobs/2349167
2022-10-23 18:04:56 +02:00
Xavier Claessens
dcfc9f689e Fix symbol visibility macros on Windows
There is currently no `dllimport` attribute on any of our function,
which prevents MSVC to optimize function calls.

To fix that issue, we need to redeclare all our visibility macros for
each of our libraries, because when compiling e.g. GIO code, we need
dllimport in GLIB headers and dllexport in GIO headers. That means they
cannot use the same GLIB_AVAILABLE_* macro.

Since that's a lot of boilerplate to copy/paste after each version bump,
this MR generate all those macros using a python script.

Also simplify the meson side by using `gnu_symbol_visibility : 'hidden'`
keyword argument instead of passing the cflag manually.

This leaves only API index to add manually into glib-docs.xml when
bumping GLib version. That file cannot be generated because Meson does
not allow passing a buit file to gnome.gtkdoc()'s main_xml kwarg
unfortunately.
2022-10-13 20:53:56 -04:00
Chun-wei Fan
9b59c79e98 meson: Fix gnulib build where isnan*() is needed
We need to include the isnan*.c sources as necessary, if any of the
isnan*() functions cannot be found, so that builds on compilers that
lack these functions could be fixed.

Also, if we do have the isnan*() functions, improve the build by not
unnecessarily including the isnan*.c sources in the build.

If the isnan*() functions are found, make sure that the
HAVE_ISNAN*_IN_LIBC macros are defined in the CFLags, so that we do not
accidently require the gnulib implementations for these functions.
2020-06-14 23:59:37 +08:00
Martin Storsjö
fcc7489d46 meson: Fix the gnulib checks for isnan* functions
The gnulib math code uses __builtin_isnanf and __builtin_isnanl
within the __GNUC__ >= 4 ifdef, and clang doesn't provide those
builtins, only the one without a suffix. Make the meson check
match the code it controls, using the exactly right builtins.

Set REPLACE_ISNAN to 1 if either of the have_isnan* functions failed,
this matches how gnulib's m4 routines does it (in gnulib/m4/isnan.m4).

This fixes the isnan functions in the gnulib math header replacement
work on Clang.
2020-04-25 22:16:10 +03:00
Philip Withnall
65be80c3ed build: Rework path construction to reliably add prefix
There were a couple of custom paths which could end up being relative,
rather than absolute, due to not properly prefixing them with
`get_option('prefix')`.

The use of `join_paths()` here correctly drops all path components
before the final absolute path in the list of arguments. So if someone
configures GLib with an absolute path for `gio_module_dir`, that will be
used unprefixed; but if someone configures with a relative path, it will
be prefixed by `get_option('prefix)`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1919
2020-02-07 17:12:35 +00:00
Emmanuel Fleury
59882fb9e1 Fixing inlining bug in gnulib/xsize.h
See: https://lists.gnu.org/archive/html/bug-gettext/2013-01/msg00011.html

Courtesy to chrisawi (Chris William)
2019-09-17 19:48:56 +02:00
Chun-wei Fan
b532b9cecf build: Check for more math.h functions in gnulib
There are now C99 functions that the printf items want to use that may
not be necessarily supported by the math.h that is shipped by the
compiler, such as signbit(), isinf(), isnan() and isfinite() and their
double, long and float counterparts.

This checks for whether these functions are provided by the math.h
shipped by the compiler, and builds the gnulib implementations of them
if they cannot be found.  Currently no attempt is made to check whether
these, if available from the compiler's math.h, are compliant with the
specs.
2019-04-08 17:50:59 +08:00
Chun-wei Fan
a1fbeb3e4f build: Improve tests for frexpl() and ldexpl()
The test programs for those in the Meson build files will not work for
Visual Studio prior to 2013 (whereas the rest of the code does).
Improve the tests for these by:

-Adding a test to see whether we can re-define a prototype for these
 functions, using cc.compiles().  If so, set HAVE_DECL_xxxx to be 0,
 otherwise set HAVE_DECL_xxxx to be 1.

Also, for glib/gnulib/frexpl.c, don't undefine frexpl on Visual Studio,
otherwise we will not be able to compile/link it on Visual Studio
compilers.
2019-04-08 17:50:59 +08:00
Руслан Ижбулатов
8f27aa9965 glib: update internal gnulib from upstream
https://bugzilla.gnome.org/show_bug.cgi?id=795569

Related to issue #1371.
2019-03-13 12:38:42 +00:00
Christoph Reiter
97c28f7fe1 ci: fix warnings and enable --werror for the mingw build
Fix various warnings regarding unused variables, duplicated
branches etc by adjusting the ifdeffery and some missing casts.

gnulib triggers -Wduplicated-branches in one of the copied files,
disable as that just makes updating the code harder.

The warning indicating missing features are made none fatal through
pragmas. They still show but don't abort the build.

https://bugzilla.gnome.org/show_bug.cgi?id=793729
2018-04-25 17:23:50 +02:00
Christoph Reiter
d137cebf8f meson: Disable -Wformat-nonliteral for the embedded gnulib
glib enables -Werror=format-nonliteral by default which is triggered
by the embedded gnulib (in vasnprintf.c). Disable that warning
for gnulib alone. The gnulib code is there to handle user provided
format strings, so the warning doesn't add anything anyway.

This fixes the build under MinGW.

https://bugzilla.gnome.org/show_bug.cgi?id=793729
2018-04-25 17:23:49 +02:00
Nirbheek Chauhan
87122cae38 meson: Fix gnulib compilation on MSVC
glibinc is needed for including glibconfig.h, this was not noticed
during testing probably because a system-installed header got picked
up instead.
2017-11-24 12:41:53 +05:30
Chun-wei Fan
72528938b7 Meson: Check for HAVE_GOOD_PRINTF
The HAVE_GOOD_PRINTF config variable determines whether we are able to
use the CRT-supplied *printf() functions directly, by determining whether
the CRT-supplied vsnprintf() and snprintf() functions support C99 well
enough.

This means, we need to build the gnulib subdir as a static lib in GLib, and use
the gnulib *printf() functions when:

-We are on Windows
-The CRT's vsnprintf() and snprintf() is not sufficiently C99-compliant.

This will fix the problem when the *printf() functions cause a CRT
abort() call on pre-2015 Visual Studio builds at least, and ensures that
the Visual Studio 2015+ builds will pass the printf tests in GLib, since
the *printf() in Visual Studio 2015/2017's CRT does not support the %n
format specifier, nor the positional parameters (which requires
different _*printf_p*() functions), as indicated by
glib/tests/test-printf.c.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-08-17 17:46:37 +08:00