1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-05 12:21:48 +02:00

Add -Wundef to make #if FOO an error if not defined

This commit has all the straightforward stuff.
This commit is contained in:
Robert Hensing 2025-04-05 00:45:19 +02:00
parent cb972c789a
commit 59ced3da96
23 changed files with 40 additions and 33 deletions

View file

@ -17,7 +17,7 @@ namespace nix {
struct ArchiveSettings : Config
{
Setting<bool> useCaseHack{this,
#if __APPLE__
#ifdef __APPLE__
true,
#else
false,

View file

@ -98,7 +98,7 @@ void AutoCloseFD::fsync() const
result =
#ifdef _WIN32
::FlushFileBuffers(fd)
#elif __APPLE__
#elif defined(__APPLE__)
::fcntl(fd, F_FULLFSYNC)
#else
::fsync(fd)

View file

@ -576,7 +576,7 @@ Path createTempDir(const Path & tmpRoot, const Path & prefix,
, mode
#endif
) == 0) {
#if __FreeBSD__
#ifdef __FreeBSD__
/* Explicitly set the group of the directory. This is to
work around around problems caused by BSD's group
ownership semantics (directories inherit the group of

View file

@ -4,7 +4,7 @@
#include "nix/util/config-global.hh"
#include "nix/util/fs-sink.hh"
#if _WIN32
#ifdef _WIN32
# include <fileapi.h>
# include "nix/util/file-path.hh"
# include "nix/util/windows-error.hh"

View file

@ -18,7 +18,7 @@ struct Source;
* Operating System capability
*/
using Descriptor =
#if _WIN32
#ifdef _WIN32
HANDLE
#else
int
@ -26,7 +26,7 @@ using Descriptor =
;
const Descriptor INVALID_DESCRIPTOR =
#if _WIN32
#ifdef _WIN32
INVALID_HANDLE_VALUE
#else
-1

View file

@ -2,7 +2,7 @@
#include "nix/util/environment-variables.hh"
#include "nix/util/sync.hh"
#if _WIN32
#ifdef _WIN32
# include <io.h>
# define WIN32_LEAN_AND_MEAN
# include <windows.h>

View file

@ -78,7 +78,7 @@ int Pid::kill()
/* On BSDs, killing a process group will return EPERM if all
processes in the group are zombies (or something like
that). So try to detect and ignore that situation. */
#if __FreeBSD__ || __APPLE__
#if defined(__FreeBSD__) || defined(__APPLE__)
if (errno != EPERM || ::kill(pid, 0) != 0)
#endif
logError(SysError("killing process %d", pid).info());