Commit Graph

28084 Commits

Author SHA1 Message Date
getsnoopy
5422d2fdb8 gutils: Use international symbol for bits 2023-10-16 08:25:03 +00:00
Philip Withnall
0a0f1f662c Merge branch 'g-strv-builder-take' into 'main'
gstrvbuilder: Add g_strv_builder_take

See merge request GNOME/glib!3637
2023-10-16 08:21:34 +00:00
Guido Günther
bc4ba05d34 gstrvbuilder: Add g_strv_builder_take
g_strv_builder_take() allows to transfer ownership of the passed in
string.

This can be useful to avoid additional allocations when using functions
that transfer ownership to the caller like g_strdup_printf().

The testcase uses g_strv_builder_take and g_strv_builder_add to demo
that calls can be mixed.
2023-10-15 15:45:58 +02:00
Michael Catanzaro
046f70cc0d Merge branch 'wip/kabus/task-return' into 'main'
Use g_task_return in task threads

See merge request GNOME/glib!3633
2023-10-12 12:27:29 +00:00
Khalid Abu Shawarib
dc0af83486 Use g_task_return in task threads 2023-10-12 12:27:28 +00:00
Luca Bacci
dfeb671c36 tests/win32: Initialize DWORD with the right constant
We were initializing a DWORD (unsigned 32 bit) with a constant
of bigger rank (G_MAXSIZE) on 64 bit systems.

Fixes the following warnings on CLang when compiling for x64:

  ../glib/glib/tests/win32.c:47:14: warning: implicit conversion from 'unsigned long long' to 'DWORD' (aka 'unsigned long') changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
    DWORD bp = G_MAXSIZE;
          ~~   ^~~~~~~~~
  glib/glibconfig.h:88:19: note: expanded from macro 'G_MAXSIZE'
  #define G_MAXSIZE       G_MAXUINT64
                          ^~~~~~~~~~~
  ../glib/glib/gtypes.h:107:21: note: expanded from macro 'G_MAXUINT64'
  #define G_MAXUINT64     G_GUINT64_CONSTANT(0xffffffffffffffff)
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  glib/glibconfig.h:69:52: note: expanded from macro 'G_GUINT64_CONSTANT'
  #define G_GUINT64_CONSTANT(val) (G_GNUC_EXTENSION (val##ULL))
                                                     ^~~~~~~~
  <scratch space>:96:1: note: expanded from here
  0xffffffffffffffffULL
  ^~~~~~~~~~~~~~~~~~~~~
2023-10-12 11:45:33 +02:00
Luca Bacci
8264b13737 tests/cxx: Do not assume that NULL is a pointer type starting with C++11
Many toolchain did not change the definition of NULL to avoid introducing
breaking changes in existing codebases. For example, on Windows NULL is
0 (int) regardless of the C++ standard in use.

Fixes the following warnings on CLang when compiling for Windows:

  ../glib/glib/tests/cxx.cpp:539:34: warning: missing sentinel in function call [-Wsentinel]
    g_test_init (&argc, &argv, NULL);
                                   ^
                                   , nullptr
  ../glib/glib/gtestutils.h:298:9: note: function has been explicitly marked sentinel here
  void    g_test_init                     (int            *argc,
          ^

  ../glib/gio/tests/cxx.cpp:62:34: warning: missing sentinel in function call [-Wsentinel]
    g_test_init (&argc, &argv, NULL);
                                   ^
                                   , nullptr
  ../glib/glib/gtestutils.h:298:9: note: function has been explicitly marked sentinel here
  void    g_test_init                     (int            *argc,
          ^
2023-10-12 11:45:03 +02:00
Luca Bacci
107311afce glib/gtimezone.c: Declare Unix-only functions under G_OS_UNIX
Fixes the following warnings on CLang when compiling for Windows:

  ../glib/glib/gtimezone.c:95:22: warning: unused function 'gint64_from_be' [-Wunused-function]
  static inline gint64 gint64_from_be (const gint64_be be) {
                       ^
  ../glib/glib/gtimezone.c:99:22: warning: unused function 'gint32_from_be' [-Wunused-function]
  static inline gint32 gint32_from_be (const gint32_be be) {
                       ^
  ../glib/glib/gtimezone.c:103:23: warning: unused function 'guint32_from_be' [-Wunused-function]
  static inline guint32 guint32_from_be (const guint32_be be) {
                        ^
2023-10-12 11:44:59 +02:00
Luca Bacci
5400f4e128 glib/gmessages.c: Remove unused function
Fixes the follwing warning on CLang:

  ../glib/glib/gmessages.c:433:1: warning: unused function 'dowrite' [-Wunused-function]
  dowrite (int          fd,
  ^
2023-10-12 11:44:56 +02:00
Luca Bacci
f075db637a glib/giowin32.c: Add G_GNUC_FALLTHROUGH annotation
Fixes the following warning on CLang:

  ../glib/glib/giowin32.c:1665:7: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
        default:
        ^
  ../glib/glib/giowin32.c:1665:7: note: insert '__attribute__((fallthrough));' to silence this warning
        default:
        ^
        __attribute__((fallthrough));
  ../glib/glib/giowin32.c:1665:7: note: insert 'break;' to avoid fall-through
        default:
        ^
        break;
2023-10-12 11:44:48 +02:00
Luca Bacci
985cab7737 gio/gregistrysettingsbackend.c: Use unsigned data type for bitfields that are only one-bit wide
Fixes the following warnings on CLang:

  ../glib/gio/gregistrysettingsbackend.c:1503:32: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
            child_item->readable = TRUE;
                                 ^ ~~~~
  ../glib/gio/gregistrysettingsbackend.c:1567:28: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
        child_item->readable = TRUE;
                             ^ ~~~~
2023-10-12 11:44:37 +02:00
Luca Bacci
337912072a Windows: Compile with the UNICODE / _UNICODE macros
It's the recommended way to build C/C++ projects on Windows, see
https://learn.microsoft.com/en-us/windows/win32/intl/conventions-for-function-prototypes
2023-10-12 11:32:03 +02:00
Philip Withnall
20b0d292ca Merge branch 'migrate-to-gi-docgen2' into 'main'
Switch to using gi-docgen for docs (batch 2)

See merge request GNOME/glib!3634
2023-10-11 16:54:27 +00:00
Matthias Clasen
f679a784d2 docs: Drop the GQuark SECTION
Move the content to the struct docs.

Helps: #3037
2023-10-11 17:38:31 +01:00
Matthias Clasen
5a2a0aeaf9 docs: Move the GStringChunk SECTION
Move the contents to the struct docs.

Helps: #3037
2023-10-11 17:38:31 +01:00
Matthias Clasen
57219c14a0 docs: Move the GTimer SECTION
Move the contents to the struct docs.

Helps: #3037
2023-10-11 17:38:31 +01:00
Matthias Clasen
a47bdb2638 docs: Move GRegex SECTION
Move the contents to the struct docs.

Helps: #3037
2023-10-11 17:38:31 +01:00
Matthias Clasen
45f6f43fc6 docs: Mark all GWakeup docs as private
This is not public API.

Helps: #3037
2023-10-11 17:38:31 +01:00
Matthias Clasen
ccfedf08cb docs: Move the GPatternSpec SECTION
Move the contents to the struct docs.

Helps: #3037
2023-10-11 17:38:31 +01:00
Matthias Clasen
f2b1e4d936 docs: Move the GKeyFile SECTION
Move the contents to the struct docs.

Helps: #3037
2023-10-11 17:38:31 +01:00
Matthias Clasen
f27af99233 docs: Move the unicode SECTION
Move the content to the new unicode.md file.

Helps: #3037
2023-10-11 17:38:31 +01:00
Matthias Clasen
6052639a5c docs: Update Unicode version history
Unicode 14 and 15 were missing from this list.
2023-10-11 17:38:31 +01:00
Matthias Clasen
55a844a465 docs: Move the GDate SECTION
Move the contents to the struct docs.

Helps: #3037
2023-10-11 17:38:31 +01:00
Matthias Clasen
1dae4fc618 docs: Move the GPathBuf SECTION
Move the contents to the struct docs.

Helps: #3037
2023-10-11 17:38:31 +01:00
Matthias Clasen
be9a463a10 docs: Move the GStrvBuilder SECTION
Move the contents to the struct docs.

Helps: #3037
2023-10-11 17:38:31 +01:00
Matthias Clasen
c50f94e41e docs: Move the GScanner SECTION
Not much here to begin with.

Helps: #3037
2023-10-11 17:38:31 +01:00
Matthias Clasen
5a415ee93f docs: Move the GTimeZone SECTION
Move the contents to the struct docs.

Helps: #3037
2023-10-11 17:38:31 +01:00
Matthias Clasen
7b4d00e0a4 docs: Move GDateTime SECTION
Move the contents to the struct comment.

Helps: #3037
2023-10-11 17:38:30 +01:00
Matthias Clasen
7fd50be9d0 docs: Move bookmarkfile SECTION
Move the content to the struct docs.

Helps: #3037
2023-10-11 17:38:30 +01:00
Matthias Clasen
d028759903 docs: Drop the threadpool SECTION
Move the contents to the GThreadPool struct docs.

Helps: #3037
2023-10-11 17:38:30 +01:00
Matthias Clasen
2e47610560 docs: Drop the GString SECTION
Move the contents to the GString struct docs.

Helps: #3037
2023-10-11 17:38:30 +01:00
Matthias Clasen
97cb9fa220 docs: Move the refstring SECTION
Move the contents to the data-structures.md file.

Helps: #3037
2023-10-11 17:38:30 +01:00
Matthias Clasen
8164220213 docs: Move the sequence SECTION
Add the contents to the data-structures.md file.

Helps: #3037
2023-10-11 17:38:30 +01:00
Matthias Clasen
c226088028 docs: Move the GNode SECTION
Move the contents to the data-structures.md file.

Helps: #3037
2023-10-11 17:38:30 +01:00
Matthias Clasen
2191c6024a docs: Move the tree SECTION
Move the content to the new data-structures.md file.

Helps: #3037
2023-10-11 17:38:30 +01:00
Matthias Clasen
0ce33a6fee docs: Move the asyncqueue SECTION
Move the contents to the new data-structures.md file.

Helps: #3037
2023-10-11 17:38:30 +01:00
Matthias Clasen
25aeddd2a7 docs: Move the queue SECTION
Add the content to the new data-structures.md file.

Helps: #3037
2023-10-11 17:38:30 +01:00
Matthias Clasen
f88d96e2ad docs: Move the GHashTable SECTION
Move the content to the new data-structures.md file.

Helps: #3037
2023-10-11 17:38:30 +01:00
Matthias Clasen
ed1bc3228b docs: Move list SECTIONs
Move the content to the data-structures.md file.

Helps: #3037
2023-10-11 17:38:30 +01:00
Matthias Clasen
09733b6531 docs: Move the array SECTIONs
Move the content to the new data-structures.md file.

Helps: #3037
2023-10-11 17:38:30 +01:00
Philip Withnall
fd7396ee29 ci: Add an additional git config to avoid permissions warnings
And tidy up the existing one for consistency.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-10-11 17:38:30 +01:00
Philip Withnall
d96695fef9 fixup! ci: Upgrade CI images to the new oldest-supported OS versions
This was accidentally missed out of the above commit, due to pushing
a new version of the image to test, without also pushing the git branch.
2023-10-11 16:34:20 +01:00
Philip Withnall
c140f83922 Merge branch 'migrate-to-gi-docgen' into 'main'
Switch to using gi-docgen for docs (batch 1)

See merge request GNOME/glib!3591
2023-10-11 15:21:10 +00:00
Philip Withnall
eed0b26de3 Merge branch 'no-enums-in-bitfields' into 'main'
Stop using enums in bitfields

See merge request GNOME/glib!3632
2023-10-11 13:21:02 +00:00
Matthias Clasen
ab066d4856 docs: Move the GOption SECTION
Move the content to the new goption.md file.

Helps: #3037
2023-10-11 14:01:29 +01:00
Matthias Clasen
8b9c4cfb87 docs: Move the GMarkup SECTION
Move the content to the new markup.md file.

Helps: #3037
2023-10-11 14:01:29 +01:00
Matthias Clasen
3d55be0b82 docs: Move the GObject tutorial to Markdown
Helps: #3037
2023-10-11 14:01:29 +01:00
Matthias Clasen
682e9c9f56 docs: Move migrating-gdbus.xml to Markdown
This copies the test code inline into the Markdown, which means it could
diverge from the test code which is compiled and run as part of the
tests. That needs improving, but that can happen in a subsequent commit.

Helps: #3037
2023-10-11 14:01:29 +01:00
Matthias Clasen
e1d6168e5b docs: Move the auto-cleanup documentation to Markdown
Helps: #3037
2023-10-11 14:01:29 +01:00
Matthias Clasen
c2798e6c2a docs: Move building documentation to Markdown
Helps: #3037
2023-10-11 14:01:29 +01:00