Merge pull request #12130 from keszybz/fix-ndebug-builds
Fix ndebug builds
This commit is contained in:
commit
e8413b651b
10
meson.build
10
meson.build
|
@ -383,6 +383,16 @@ if get_option('buildtype') != 'debug'
|
|||
possible_link_flags += '-Wl,--gc-sections'
|
||||
endif
|
||||
|
||||
if get_option('b_ndebug') == 'true'
|
||||
# With asserts disabled with get a bunch of warnings about variables which
|
||||
# are used only in the asserts. This is not useful at all, so let's just silence
|
||||
# those warnings.
|
||||
possible_cc_flags += [
|
||||
'-Wno-unused-variable',
|
||||
'-Wno-unused-but-set-variable',
|
||||
]
|
||||
endif
|
||||
|
||||
add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
|
||||
add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c')
|
||||
|
||||
|
|
|
@ -7,12 +7,10 @@
|
|||
#include "hexdecoct.h"
|
||||
|
||||
void initialize_libgcrypt(bool secmem) {
|
||||
const char *p;
|
||||
if (gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P))
|
||||
return;
|
||||
|
||||
p = gcry_check_version("1.4.5");
|
||||
assert(p);
|
||||
assert_se(gcry_check_version("1.4.5"));
|
||||
|
||||
/* Turn off "secmem". Clients which wish to make use of this
|
||||
* feature should initialize the library manually */
|
||||
|
|
|
@ -1919,7 +1919,7 @@ static int mount_kill(Unit *u, KillWho who, int signo, sd_bus_error *error) {
|
|||
|
||||
assert(m);
|
||||
|
||||
return unit_kill_common(u, who, signo, -1, MOUNT(u)->control_pid, error);
|
||||
return unit_kill_common(u, who, signo, -1, m->control_pid, error);
|
||||
}
|
||||
|
||||
static int mount_control_pid(Unit *u) {
|
||||
|
|
|
@ -428,7 +428,6 @@ static bool match_tag(sd_device_enumerator *enumerator, sd_device *device) {
|
|||
static bool match_parent(sd_device_enumerator *enumerator, sd_device *device) {
|
||||
const char *syspath_parent, *syspath;
|
||||
Iterator i;
|
||||
int r;
|
||||
|
||||
assert(enumerator);
|
||||
assert(device);
|
||||
|
@ -436,8 +435,7 @@ static bool match_parent(sd_device_enumerator *enumerator, sd_device *device) {
|
|||
if (set_isempty(enumerator->match_parent))
|
||||
return true;
|
||||
|
||||
r = sd_device_get_syspath(device, &syspath);
|
||||
assert(r >= 0);
|
||||
assert_se(sd_device_get_syspath(device, &syspath) >= 0);
|
||||
|
||||
SET_FOREACH(syspath_parent, enumerator->match_parent, i)
|
||||
if (path_startswith(syspath, syspath_parent))
|
||||
|
|
|
@ -64,14 +64,10 @@ static int netdev_fill_fou_tunnel_message(NetDev *netdev, sd_netlink_message **r
|
|||
static int netdev_fou_tunnel_create(NetDev *netdev) {
|
||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL;
|
||||
uint32_t serial;
|
||||
FouTunnel *t;
|
||||
int r;
|
||||
|
||||
assert(netdev);
|
||||
|
||||
t = FOU(netdev);
|
||||
|
||||
assert(t);
|
||||
assert(FOU(netdev));
|
||||
|
||||
r = netdev_fill_fou_tunnel_message(netdev, &m);
|
||||
if (r < 0)
|
||||
|
|
|
@ -430,11 +430,8 @@ static void resolve_endpoints(NetDev *netdev) {
|
|||
}
|
||||
|
||||
static int netdev_wireguard_post_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
|
||||
Wireguard *w;
|
||||
|
||||
assert(netdev);
|
||||
w = WIREGUARD(netdev);
|
||||
assert(w);
|
||||
assert(WIREGUARD(netdev));
|
||||
|
||||
(void) wireguard_set_interface(netdev);
|
||||
resolve_endpoints(netdev);
|
||||
|
|
|
@ -20,14 +20,12 @@ static inline bool fstab_test_option(const char *opts, const char *names) {
|
|||
int fstab_find_pri(const char *options, int *ret);
|
||||
|
||||
static inline bool fstab_test_yes_no_option(const char *opts, const char *yes_no) {
|
||||
int r;
|
||||
const char *opt;
|
||||
|
||||
/* If first name given is last, return 1.
|
||||
* If second name given is last or neither is found, return 0. */
|
||||
|
||||
r = fstab_filter_options(opts, yes_no, &opt, NULL, NULL);
|
||||
assert(r >= 0);
|
||||
assert_se(fstab_filter_options(opts, yes_no, &opt, NULL, NULL) >= 0);
|
||||
|
||||
return opt == yes_no;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include "util.h"
|
||||
|
||||
static void test_default_term_for_tty(void) {
|
||||
log_info("/* %s */", __func__);
|
||||
|
||||
puts(default_term_for_tty("/dev/tty23"));
|
||||
puts(default_term_for_tty("/dev/ttyS23"));
|
||||
puts(default_term_for_tty("/dev/tty0"));
|
||||
|
@ -36,7 +38,9 @@ static void test_read_one_char(void) {
|
|||
bool need_nl;
|
||||
char name[] = "/tmp/test-read_one_char.XXXXXX";
|
||||
|
||||
assert(fmkostemp_safe(name, "r+", &file) == 0);
|
||||
log_info("/* %s */", __func__);
|
||||
|
||||
assert_se(fmkostemp_safe(name, "r+", &file) == 0);
|
||||
|
||||
assert_se(fputs("c\n", file) >= 0);
|
||||
rewind(file);
|
||||
|
@ -62,8 +66,12 @@ static void test_getttyname_malloc(void) {
|
|||
_cleanup_free_ char *ttyname = NULL;
|
||||
_cleanup_close_ int master = -1;
|
||||
|
||||
log_info("/* %s */", __func__);
|
||||
|
||||
assert_se((master = posix_openpt(O_RDWR|O_NOCTTY)) >= 0);
|
||||
assert_se(getttyname_malloc(master, &ttyname) >= 0);
|
||||
log_info("ttyname = %s", ttyname);
|
||||
|
||||
assert_se(PATH_IN_SET(ttyname, "ptmx", "pts/ptmx"));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue