Merge pull request #28599 from keszybz/two-compilation-fixes

Two compilation fixes
This commit is contained in:
Luca Boccassi
2023-07-31 15:37:59 +01:00
committed by GitHub
2 changed files with 30 additions and 27 deletions
+27 -27
View File
@@ -487,33 +487,6 @@ static int slash_boot_in_fstab(void) {
return cache;
}
static int slash_efi_in_fstab(void) {
static int cache = -1;
if (cache >= 0)
return cache;
cache = fstab_is_mount_point("/efi");
if (cache < 0)
return log_error_errno(cache, "Failed to parse fstab: %m");
return cache;
}
static bool slash_boot_exists(void) {
static int cache = -1;
if (cache >= 0)
return cache;
if (access("/boot", F_OK) >= 0)
return (cache = true);
if (errno != ENOENT)
log_error_errno(errno, "Failed to determine whether /boot/ exists, assuming no: %m");
else
log_debug_errno(errno, "/boot/: %m");
return (cache = false);
}
static int add_partition_xbootldr(DissectedPartition *p) {
_cleanup_free_ char *options = NULL;
int r;
@@ -562,6 +535,33 @@ static int add_partition_xbootldr(DissectedPartition *p) {
}
#if ENABLE_EFI
static int slash_efi_in_fstab(void) {
static int cache = -1;
if (cache >= 0)
return cache;
cache = fstab_is_mount_point("/efi");
if (cache < 0)
return log_error_errno(cache, "Failed to parse fstab: %m");
return cache;
}
static bool slash_boot_exists(void) {
static int cache = -1;
if (cache >= 0)
return cache;
if (access("/boot", F_OK) >= 0)
return (cache = true);
if (errno != ENOENT)
log_error_errno(errno, "Failed to determine whether /boot/ exists, assuming no: %m");
else
log_debug_errno(errno, "/boot/: %m");
return (cache = false);
}
static int add_partition_esp(DissectedPartition *p, bool has_xbootldr) {
const char *esp_path = NULL, *id = NULL;
_cleanup_free_ char *options = NULL;
+3
View File
@@ -213,6 +213,8 @@ TEST(bits) {
assert_se(_u64 == u64);
/* Verify these use cases are constant-folded. */
#if !defined(__clang__) || (__clang_major__ >= 13)
/* Clang 11 doesn't grok those; skip them. */
assert_cc(__builtin_constant_p(INDEX_TO_MASK(uint8_t, 1)));
assert_cc(__builtin_constant_p(INDEX_TO_MASK(uint16_t, 1)));
assert_cc(__builtin_constant_p(INDEX_TO_MASK(uint32_t, 1)));
@@ -222,6 +224,7 @@ TEST(bits) {
assert_cc(__builtin_constant_p(BIT_SET((uint16_t)2, 1)));
assert_cc(__builtin_constant_p(BIT_SET((uint32_t)2, 1)));
assert_cc(__builtin_constant_p(BIT_SET((uint64_t)2, 1)));
#endif
}
DEFINE_TEST_MAIN(LOG_INFO);