1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 17:51:22 +03:00
The systemd System and Service Manager
Go to file
Lennart Poettering 3e4ca3940d json: rework JSON_BUILD_XYZ() macros to use compound literals instead of compound statements
Compound statements is this stuff: ({ … })

Compound literals is this stuff: (type) { … }

We use compound statements a lot in macro definitions: they have one
drawback though: they define a code block of their own, hence if macro
invocations are nested within them that use compound literals their
lifetime is limited to the code block, which might be unexpected.

Thankfully, we can rework things from compound statements to compund
literals in the case of json.h: they don't open a new codeblack, and
hence do not suffer by the problem explained above.

The interesting thing about compound statements is that they also work
for simple types, not just for structs/unions/arrays. We can use this
here for a typechecked implicit conversion: we want to superficially
typecheck arguments to the json_build() varargs function, and we do that
by assigning the specified arguments to our compound literals, which
does the minimal amount of typechecks and ensures that types are
propagated on correctly.

We need one special tweak for this: sd_id128_t is not a simple type but
a union. Using compound literals for initialzing that would mean
specifiying the components of the union, not a complete sd_id128_t. Our
hack around that: instead of passing the object directly via the stack
we now take a pointer (and thus a simple type) instead.

Nice side-effect of all this: compound literals is C99, while compound
statements are a GCC extension, hence we move closer to standard C.

Fixes: #20501
Replaces: #20512
2021-08-23 16:07:28 +01:00
.github ci: Add openSUSE Tumbleweed among tested distros 2021-08-04 11:16:48 +02:00
.lgtm/cpp-queries
.mkosi mkosi: Fix openSUSE Jinja2 package name 2021-07-09 10:49:30 +02:00
.semaphore ci: drop py2 lxml, pull in jinja2 2021-05-19 10:25:26 +09:00
catalog units: added factory-reset.target 2021-08-10 17:08:00 +02:00
coccinelle coccinelle: filter out a couple of 'false-positive' transformations 2021-03-18 11:59:53 +01:00
docs docs: Add documentation on how to use VSCode to debug systemd via mkosi 2021-08-21 10:31:32 +01:00
factory/etc pam: fix typo try_authtok → use_authtok 2021-05-12 12:14:17 +02:00
hwdb.d hwdb: Add Lenovo Thinkpad P14s Gen1/2 rule 2021-08-10 13:28:18 +09:00
man tree-wide: fix typo 2021-08-22 09:46:22 +01:00
mkosi.default.d
modprobe.d meson: install the right README file in modprobe.d 2021-07-07 14:52:05 +02:00
network meson: use a/b instead of join_paths(a,b) 2021-07-27 19:32:35 +02:00
po po: Added translation using Weblate (Finnish) 2021-08-22 15:20:22 +02:00
presets boot: optionally update sd-boot on boot 2021-07-30 17:19:55 +02:00
rules.d udev: Fix by-uuid symlink for ubifs volumes 2021-07-02 14:26:18 +01:00
shell-completion systemd-analyze: add new 'security' option to compare unit's overall exposure level with 2021-08-20 10:59:13 -07:00
src json: rework JSON_BUILD_XYZ() macros to use compound literals instead of compound statements 2021-08-23 16:07:28 +01:00
sysctl.d meson: use a/b instead of join_paths(a,b) 2021-07-27 19:32:35 +02:00
sysusers.d meson: allow "soft-static" allocations for uids and gids in the initrd 2021-06-17 09:48:28 +02:00
test test-network: add testcases that gateway address is IPv6 link local 2021-08-22 15:35:22 +09:00
tmpfiles.d meson: use a/b instead of join_paths(a,b) 2021-07-27 19:32:35 +02:00
tools git-contrib: copypaste-friendly output 2021-07-19 15:39:26 +09:00
units units: added factory-reset.target 2021-08-10 17:08:00 +02:00
xorg
.clang-format
.ctags
.dir-locals.el
.editorconfig
.gitattributes
.gitignore
.lgtm.yml ci: bump meson version in LGTM 2021-07-28 11:26:10 +02:00
.mailmap mailmap: two more names 2021-03-30 13:17:58 +02:00
.packit.yml ci: add ppc64le Rawhide chroot to the Packit chroot set 2021-07-19 12:16:36 +01:00
.vimrc
.ycm_extra_conf.py
configure
LICENSE.GPL2
LICENSE.LGPL2.1
Makefile
meson_options.txt sd-boot: Draw custom edit cursor 2021-08-17 13:59:13 +02:00
meson.build Add support for systemd-pkcs11 libcryptsetup plugin. 2021-08-19 13:58:10 +02:00
mkosi.build mkosi: initialize /usr/lib/os-release' IMAGE_ID + IMAGE_VERSION fields from build 2021-07-03 11:07:00 +01:00
NEWS NEWS: finalize for v249 2021-07-07 18:41:29 +01:00
README README: add requirements for RestrictNetworkInterfaces= 2021-08-19 07:25:01 -05:00
README.md docs: add ARCHITECTURE.md with code map 2021-06-03 22:14:19 +02:00
TODO update TODO 2021-08-10 15:07:44 +02:00

Systemd

System and Service Manager

Count of open issues over time Count of open pull requests over time Semaphore CI 2.0 Build Status
Coverity Scan Status
OSS-Fuzz Status
CIFuzz
CII Best Practices
Language Grade: C/C++
CentOS CI - CentOS 7
CentOS CI - Arch
CentOS CI - Arch (sanitizers)
Fossies codespell report
Packaging status

Details

Most documentation is available on systemd's web site.

Assorted, older, general information about systemd can be found in the systemd Wiki.

Information about build requirements is provided in the README file.

Consult our NEWS file for information about what's new in the most recent systemd versions.

Please see the Code Map for information about this repository's layout and content.

Please see the Hacking guide for information on how to hack on systemd and test your modifications.

Please see our Contribution Guidelines for more information about filing GitHub Issues and posting GitHub Pull Requests.

When preparing patches for systemd, please follow our Coding Style Guidelines.

If you are looking for support, please contact our mailing list or join our IRC channel.

Stable branches with backported patches are available in the stable repo.