Migrate feature detection macro checks from #ifdef to #if.
The #if predicate evaluates to false if the macro is undefined, or defined to 0. #ifdef (and its synonym #if defined) evaluates to false only if the macro is undefined. The new setup allows differentiating between setting a macro to 0 (to express that the capability definitely does not exist / should not be used) and leaving a macro undefined (to express not knowing whether a capability exists / not caring if a capability is used). PiperOrigin-RevId: 391094241
This commit is contained in:
committed by
Victor Costan
parent
a8400f1fab
commit
cbb83a1d64
@@ -66,7 +66,7 @@ namespace snappy {
|
||||
|
||||
namespace {
|
||||
|
||||
#if defined(HAVE_FUNC_MMAP) && defined(HAVE_FUNC_SYSCONF)
|
||||
#if HAVE_FUNC_MMAP && HAVE_FUNC_SYSCONF
|
||||
|
||||
// To test against code that reads beyond its input, this class copies a
|
||||
// string to a newly allocated group of pages, the last of which
|
||||
@@ -112,7 +112,7 @@ class DataEndingAtUnreadablePage {
|
||||
size_t size_;
|
||||
};
|
||||
|
||||
#else // defined(HAVE_FUNC_MMAP) && defined(HAVE_FUNC_SYSCONF)
|
||||
#else // HAVE_FUNC_MMAP && HAVE_FUNC_SYSCONF
|
||||
|
||||
// Fallback for systems without mmap.
|
||||
using DataEndingAtUnreadablePage = std::string;
|
||||
|
||||
Reference in New Issue
Block a user