[PR #6217] [MERGED] build: move errExit macro into inline function #5878

Closed
opened 2026-05-05 10:46:37 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netblue30/firejail/pull/6217
Author: @kmk3
Created: 2/19/2024
Status: Merged
Merged: 2/23/2024
Merged by: @kmk3

Base: masterHead: build-errexit-func


📝 Commits (1)

  • f7da0e7 build: move errExit macro into inline function

📊 Changes

1 file changed (+9 additions, -7 deletions)

View changed files

📝 src/include/common.h (+9 -7)

📄 Description

Move most of the errExit macro into a new _errExit inline function
and use the former just to forward arguments to the latter.

This reduces the noise in the build output when using -fanalyzer, as
it causes the errExit macro to stop being expanded.

For example, the complete output of the following warning in
src/firejail/dbus.c is reduced from 243 lines to 141 lines (a ~41%
reduction):

$ pacman -Q gcc
gcc 13.2.1-5
$ ./configure --enable-apparmor --enable-analyzer >/dev/null &&
  make clean >/dev/null && make >/dev/null
[...]
../../src/firejail/dbus.c: In function ‘dbus_proxy_start’:
../../src/firejail/dbus.c:311:36: warning: leak of file descriptor ‘dup2(output_fd, 1)’ [CWE-775] [-Wanalyzer-fd-leak]
  311 |                                 if (dup2(output_fd, STDOUT_FILENO) != STDOUT_FILENO)
[...]
         ‘dbus_create_user_dir’: event 5
           |
           |../../src/firejail/../include/common.h:42:25:
           |   42 | #define errExit(msg) do { \
           |      |                         ^
           |      |                         |
           |      |                         (5) ...to here
../../src/firejail/dbus.c:239:17: note: in expansion of macro ‘errExit’
           |  239 |                 errExit("asprintf");
           |      |                 ^~~~~~~
[...]

Relates to #6190.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netblue30/firejail/pull/6217 **Author:** [@kmk3](https://github.com/kmk3) **Created:** 2/19/2024 **Status:** ✅ Merged **Merged:** 2/23/2024 **Merged by:** [@kmk3](https://github.com/kmk3) **Base:** `master` ← **Head:** `build-errexit-func` --- ### 📝 Commits (1) - [`f7da0e7`](https://github.com/netblue30/firejail/commit/f7da0e74d717bf668740233f72e3f2c1ec882129) build: move errExit macro into inline function ### 📊 Changes **1 file changed** (+9 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `src/include/common.h` (+9 -7) </details> ### 📄 Description Move most of the `errExit` macro into a new `_errExit` inline function and use the former just to forward arguments to the latter. This reduces the noise in the build output when using `-fanalyzer`, as it causes the `errExit` macro to stop being expanded. For example, the complete output of the following warning in src/firejail/dbus.c is reduced from 243 lines to 141 lines (a ~41% reduction): $ pacman -Q gcc gcc 13.2.1-5 $ ./configure --enable-apparmor --enable-analyzer >/dev/null && make clean >/dev/null && make >/dev/null [...] ../../src/firejail/dbus.c: In function ‘dbus_proxy_start’: ../../src/firejail/dbus.c:311:36: warning: leak of file descriptor ‘dup2(output_fd, 1)’ [CWE-775] [-Wanalyzer-fd-leak] 311 | if (dup2(output_fd, STDOUT_FILENO) != STDOUT_FILENO) [...] ‘dbus_create_user_dir’: event 5 | |../../src/firejail/../include/common.h:42:25: | 42 | #define errExit(msg) do { \ | | ^ | | | | | (5) ...to here ../../src/firejail/dbus.c:239:17: note: in expansion of macro ‘errExit’ | 239 | errExit("asprintf"); | | ^~~~~~~ [...] Relates to #6190. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 10:46:37 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#5878
No description provided.