summaryrefslogtreecommitdiff
path: root/glib/tests/macros.c
Commit message (Collapse)AuthorAgeFilesLines
* macros: Add a generic way to get and check the supported C standardMarco Trevisan (Treviño)2022-11-221-0/+79
| | | | | Try to get the value of __STDC_VERSION__ if supported, if not just fallback to the oldest standard that any compiler should handle.
* gmacros: Define G_CXX_STD_VERSION and check macrosMarco Trevisan (Treviño)2022-11-211-0/+6
| | | | | | | | | | | | | | | | | Sadly, in C++ there's not an universal way to get what language standard is used to compile GLib-based programs, in fact while most compilers relies on `__cplusplus`, MSVC is defining that, but it does not use it to expose such information (unless `/Zc:__cplusplus` arg is used). On the other side, MSVC reports the language standard via _MSVC_LANG [1]. This complication makes us defining some macros in a very complex way (such as glib_typeof()), because we need to perform many checks just to understand if a C++ compiler is used and what standard is expecting. To avoid this, define multiple macros that can be used to figure out what C++ standard is being used. [1] https://docs.microsoft.com/en-us/cpp/build/reference/zc-cplusplus?view=msvc-170
* Revert "meson: Define G_OS_DARWIN when compiling under OSX or iOS"Philip Withnall2022-11-071-11/+0
| | | | | | | | This reverts commit e85635daa07e9c669ded75c476d67d02aa85c7c1. See the previous revert for rationale. Fixes: #2802
* meson: Define G_OS_DARWIN when compiling under OSX or iOSMarco Trevisan (Treviño)2022-10-201-0/+11
| | | | It has enough differences to expose it as an unix-subtype.
* tests: Add SPDX license headers automaticallyPhilip Withnall2022-05-181-0/+2
| | | | | | | | | | | | | | Add SPDX license (but not copyright) headers to all files which follow a certain pattern in their existing non-machine-readable header comment. This commit was entirely generated using the command: ``` git ls-files glib/tests/*.c | xargs perl -0777 -pi -e 's/\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/\n \*\n \* SPDX-License-Identifier: LGPL-2.1-or-later\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/igs' ``` Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Helps: #1415
* Add and use G_SIZEOF_MEMBER() macroMarc-André Lureau2020-01-211-0/+8
| | | | | | A convenient macro present in the Linux kernel, named FIELD_SIZE() there. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* gmacros: Use _Static_assert only for non-expr static assertNirbheek Chauhan2019-07-011-0/+10
| | | | | | | | We can't actually use it inside an expression, so keep the old macro for that. Also add a test so that this doesn't break the next time we change it. See: https://gitlab.gnome.org/GNOME/glib/merge_requests/955#note_542646
* tests: Add test for G_ALIGNOF()Philip Withnall2018-12-211-0/+53
To guarantee that its behaviour is always the same as the G_STRUCT_OFFSET fallback. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://gitlab.gnome.org/GNOME/glib/issues/1055