1. 19 Apr, 2021 1 commit
  2. 18 Apr, 2021 1 commit
  3. 16 Apr, 2021 2 commits
    • Aleksandr Mezin's avatar
      gmacros.h: raise minimum GCC version for attribute __noreturn__ · 56be1f8d
      Aleksandr Mezin authored
      `#define G_GNUC_NORETURN __attribute__((__noreturn__))` was previously under
      `#if G_GNUC_CHECK_VERSION(2, 4)`.
      But `# define G_NORETURN __attribute__ ((__noreturn__))` was under
      `#if G_GNUC_CHECK_VERSION(2, 8) || (0x5110 <= __SUNPRO_C)`.
      Take the latter for `g_macro__has_attribute(__noreturn__)` fallback. This will
      disable `G_GNUC_NORETURN` for GCC 2.4-2.7 though.
    • Aleksandr Mezin's avatar
      gmacros.h: use g_macro__has_attribute() where possible · 2b9bf7b1
      Aleksandr Mezin authored
      Fall back to compiler version checks only when `__has_attribute()` is not
      clang-cl doesn't define `__GNU__`, but still accepts attributes. This change
      gets rid of a lot of warnings when building GLib with clang-cl. For GCC and
      non-cl Clang nothing should change.
  4. 14 Apr, 2021 2 commits
  5. 09 Apr, 2021 2 commits
    • Dor Askayo's avatar
    • Jonas Ådahl's avatar
      refcount: Clarify when the ref count ends up undefined · 21cc8091
      Jonas Ådahl authored
      Calling g_atomic_ref_count_dec() or g_ref_count_dec() and the reference
      count reaches zero results in different side effects depending on
      whether the reference count is atomic or not.
      The intended side effect when this happens is undefined, i.e. one should
      not rely on the reference count actually reaching zero, or staying 1, or
      becoming something else, and one should treat the grefcount /
      gatomicrefcount to be unusable until reinitialized.
      This wasn't documented, so add a paragraph about this.
  6. 08 Apr, 2021 4 commits
    • Michael Catanzaro's avatar
      Implement G_ANALYZER_NORETURN for Coverity · f97ff20a
      Michael Catanzaro authored
      This change is proposed by Kamil Dudka. It teaches Coverity to assume
      that g_critical() will never return, which is desirable for the same
      reasons it is for scan-build: once you've triggered undefined behavior,
      the game is already lost, and there's limited benefit from trying to
      avoid every possible memory leak on such codepaths. Notably, this
      affects g_return_if_fail().
      Arguably it might be desirable to fix every such issue, but if we're
      already not doing so for scan-build, it doesn't make sense to hold
      developers working with Coverity to a higher standard. This allows
      focusing on more serious issues found by Coverity.
      Thanks Kamil!
    • Gaël Bonithon's avatar
      gmacros.h: Fix stringification in some macros · 52ad3ed7
      Gaël Bonithon authored
      print their arguments correctly.
    • Gaël Bonithon's avatar
      gmacros.h: Complete the use of GLIB_AVAILABLE_MACRO_IN_* · f20bcf29
      Gaël Bonithon authored
      This adds `GLIB_AVAILABLE_MACRO_IN_*` where needed, or a comment when
      such use is not possible.
      Fixes #2376.
    • Emmanuel Fleury's avatar
      Fix signedness warning in glib/gdate.c · b9e66a59
      Emmanuel Fleury authored
      glib/gdate.c: In function ‘convert_twodigit_year’:
      glib/gdate.c:1217:13: warning: comparison of integer expressions of
        different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
       1217 |       if (y < two)
            |             ^
  7. 07 Apr, 2021 2 commits
    • Aleksandr Mezin's avatar
      gmacros.h: use G_GNUC_CHECK_VERSION · 2539d70d
      Aleksandr Mezin authored
      Remove repeated `__GNUC__ > ... || (__GNUC__ == ... && __GNUC_MINOR__ >= ...)`.
      Also effectively adds (missing?) `defined(__GNUC__)` check before
      `__GNUC__ > ...` in a few places.
    • Emmanuele Bassi's avatar
      Split g_test_log() messages that contain multiple lines · 85eec6aa
      Emmanuele Bassi authored
      When using TAP we want every single line to be one of the following:
       - a valid TAP clause
       - a comment
       - a blank line
      Typical explicit test logs are single line comments, but in some cases
      we might end up printing debug messages from libraries, and those may
      contain multiple lines. When that happens, we break the TAP and fail the
      test in conditions entirely outside of our control.
      One option to avoid outright failure is to always prepend each line of a
      messge with `#`, to ensure that the whole thing is considered a comment.
  8. 30 Mar, 2021 2 commits
    • Chun-wei Fan's avatar
      gmacros.h: Improve check for C _Static_assert · f801c84c
      Chun-wei Fan authored
      Use the GCC/Clang macros __has_extension() and __has_feature() on
      c_static_assert, which is the documented way for GCC/CLang to check for
      _Static_assert if C11 mode is not enabled, as suggested by Aleksandr Mezin.
      As a result, add a private macro that is defined to be __has_extension if it
      exists, otherwise it is considered to be always false.
    • Chun-wei Fan's avatar
      gmacros.h: Use _Static_assert for clang · 7b769952
      Chun-wei Fan authored
      It appears that CLang supports _Static_assert() even when not in C11
      mode, since at least CLang 3.1, so let's just use that for CLang builds.
      Fixes issue #2338.
  9. 27 Mar, 2021 3 commits
  10. 25 Mar, 2021 1 commit
  11. 24 Mar, 2021 1 commit
  12. 23 Mar, 2021 3 commits
  13. 22 Mar, 2021 1 commit
  14. 20 Mar, 2021 1 commit
  15. 19 Mar, 2021 1 commit
  16. 18 Mar, 2021 2 commits
  17. 16 Mar, 2021 1 commit
  18. 11 Mar, 2021 1 commit
  19. 03 Mar, 2021 1 commit
  20. 01 Mar, 2021 1 commit
    • Iain Lane's avatar
      gatomic.h: Make `glib_typeof` API break opt in. · 5b3e4f94
      Iain Lane authored
      The changes in 4273c439 did not guard
      macros in `gatomic.h` which use `glib_typeof`. This meant that when
      552b8fd8 was committed, moving the
      include of `<type_traits>` under such a guard, these macros were still
      trying to use it. This broke the build of at least vte.
      Fix this by guarding the API break in `gatomic.h` too.
  21. 27 Feb, 2021 1 commit
    • Olivier Brunel's avatar
      GRWLock: Tweak doc to make things a bit clearer · ddb2b5fe
      Olivier Brunel authored
      The doc used different phrasing for the same thing, e.g. "if any thread"
      vs "any other thread."
      Also make it clear that trying to take a write lock while already having
      a lock, or trying to take a read lock while having a write lock, is
  22. 25 Feb, 2021 1 commit
    • Iain Lane's avatar
      glib/gmacros.h: Move `<type_traits>` include to consumers · 552b8fd8
      Iain Lane authored
      When included inside an `extern "C"` block, this causes build failures
      that look something like:
        /usr/include/c++/10/type_traits:2930:3: error: template with C linkage
         2930 |   template<typename _Fn, typename... _Args>
              |   ^~~~~~~~
        ../../disas/arm-a64.cc:20:1: note: ‘extern "C"’ linkage started here
           20 | extern "C" {
              | ^~~~~~~~~~
      Commit 4273c439 made this opt in for
      projects which are defining `GLIB_VERSION_MIN_REQUIRED`, but the include
      of `<type_traits>` via `gmacros.h` was not included in this. If we move
      the include out to the places where `glib_typeof` is called, we can make
      it covered by this macro too, and save a few consumers from FTBFSing.
      That also means that, if you don't want to fix your use of the headers,
      and as long as this version is sufficient for you, a quick workaround is
      to define `GLIB_VERSION_MIN_REQUIRED` to `GLIB_VERSION_2_66` or lower.
      Suggested by Simon Mc...
  23. 16 Feb, 2021 5 commits