mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-29 06:13:20 +00:00
Fix -Wundef warnings
Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
ca57bcbb00
commit
6ab2da0e25
9 changed files with 19 additions and 19 deletions
|
@ -60,7 +60,7 @@ static const struct woption long_options[] = {{L"background", required_argument,
|
|||
{L"print-colors", no_argument, nullptr, 'c'},
|
||||
{nullptr, 0, nullptr, 0}};
|
||||
|
||||
#if __APPLE__
|
||||
#ifdef __APPLE__
|
||||
static char sitm_esc[] = "\x1B[3m";
|
||||
static char ritm_esc[] = "\x1B[23m";
|
||||
static char dim_esc[] = "\x1B[2m";
|
||||
|
@ -73,7 +73,7 @@ int builtin_set_color(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
|||
|
||||
// Hack in missing italics and dim capabilities omitted from MacOS xterm-256color terminfo
|
||||
// Helps Terminal.app/iTerm
|
||||
#if __APPLE__
|
||||
#ifdef __APPLE__
|
||||
const auto term_prog = parser.vars().get(L"TERM_PROGRAM");
|
||||
if (!term_prog.missing_or_empty() &&
|
||||
(term_prog->as_string() == L"Apple_Terminal" || term_prog->as_string() == L"iTerm.app")) {
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/sysctl.h>
|
||||
#elif __APPLE__
|
||||
#elif defined(__APPLE__)
|
||||
#include <mach-o/dyld.h>
|
||||
#endif
|
||||
|
||||
|
@ -2219,13 +2219,13 @@ bool valid_func_name(const wcstring &str) {
|
|||
std::string get_executable_path(const char *argv0) {
|
||||
char buff[PATH_MAX];
|
||||
|
||||
#if __APPLE__
|
||||
#ifdef __APPLE__
|
||||
// On OS X use it's proprietary API to get the path to the executable.
|
||||
// This is basically grabbing exec_path after argc, argv, envp, ...: for us
|
||||
// https://opensource.apple.com/source/adv_cmds/adv_cmds-163/ps/print.c
|
||||
uint32_t buffSize = sizeof buff;
|
||||
if (_NSGetExecutablePath(buff, &buffSize) == 0) return std::string(buff);
|
||||
#elif __FreeBSD__
|
||||
#elif defined(__FreeBSD__)
|
||||
// FreeBSD does not have /proc by default, but it can be mounted as procfs via the
|
||||
// Linux compatibility layer. Per sysctl(3), passing in a process ID of -1 returns
|
||||
// the value for the current process.
|
||||
|
|
|
@ -48,8 +48,8 @@
|
|||
#include "wcstringutil.h"
|
||||
#include "wutil.h"
|
||||
|
||||
#if __APPLE__
|
||||
#define FISH_NOTIFYD_AVAILABLE 1
|
||||
#ifdef __APPLE__
|
||||
#define FISH_NOTIFYD_AVAILABLE
|
||||
#include <notify.h>
|
||||
#endif
|
||||
|
||||
|
@ -1186,7 +1186,7 @@ class universal_notifier_shmem_poller_t : public universal_notifier_t {
|
|||
|
||||
/// A notifyd-based notifier. Very straightforward.
|
||||
class universal_notifier_notifyd_t : public universal_notifier_t {
|
||||
#if FISH_NOTIFYD_AVAILABLE
|
||||
#ifdef FISH_NOTIFYD_AVAILABLE
|
||||
int notify_fd;
|
||||
int token;
|
||||
std::string name;
|
||||
|
@ -1435,7 +1435,7 @@ class universal_notifier_named_pipe_t : public universal_notifier_t {
|
|||
};
|
||||
|
||||
universal_notifier_t::notifier_strategy_t universal_notifier_t::resolve_default_strategy() {
|
||||
#if FISH_NOTIFYD_AVAILABLE
|
||||
#ifdef FISH_NOTIFYD_AVAILABLE
|
||||
return strategy_notifyd;
|
||||
#elif defined(__CYGWIN__)
|
||||
return strategy_shmem_polling;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#ifdef SunOS
|
||||
#include <procfs.h>
|
||||
#endif
|
||||
#if __APPLE__
|
||||
#ifdef __APPLE__
|
||||
#include <sys/time.h> // Required to build with old SDK versions
|
||||
// proc.h needs to be included *after* time.h, this comment stops clang-format from reordering.
|
||||
#include <sys/proc.h>
|
||||
|
|
|
@ -113,7 +113,7 @@ int fish_mkstemp_cloexec(char *name_template) {
|
|||
return wcsncasecmp_fallback(a + 1, b + 1, count - 1);
|
||||
}
|
||||
|
||||
#if __APPLE__
|
||||
#ifdef __APPLE__
|
||||
#if __DARWIN_C_LEVEL >= 200809L
|
||||
// Note parens avoid the macro expansion.
|
||||
wchar_t *wcsdup_use_weak(const wchar_t *a) {
|
||||
|
|
|
@ -73,7 +73,7 @@ char *tparm_solaris_kludge(char *str, long p1 = 0, long p2 = 0, long p3 = 0, lon
|
|||
// these functions only exist on 10.7+.
|
||||
//
|
||||
// On other platforms, use what's detected at build time.
|
||||
#if __APPLE__
|
||||
#ifdef __APPLE__
|
||||
// Avoid warnings about unknown `clang::weak_import` attribute (e.g. GCC 8.2.0 on macOS 10.10)
|
||||
#if __DARWIN_C_LEVEL >= 200809L && __clang__ && __has_attribute(weak_import)
|
||||
// We have to explicitly redeclare these as weak, since we are forced to set the MIN_REQUIRED
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#if FISH_USE_POSIX_SPAWN
|
||||
#ifdef FISH_USE_POSIX_SPAWN
|
||||
#include <spawn.h>
|
||||
#endif
|
||||
#include <cwchar>
|
||||
|
|
|
@ -40,7 +40,7 @@ pid_t execute_fork();
|
|||
void safe_report_exec_error(int err, const char *actual_cmd, const char *const *argv,
|
||||
const char *const *envv);
|
||||
|
||||
#if FISH_USE_POSIX_SPAWN
|
||||
#ifdef FISH_USE_POSIX_SPAWN
|
||||
/// Initializes and fills in a posix_spawnattr_t; on success, the caller should destroy it via
|
||||
/// posix_spawnattr_destroy.
|
||||
bool fork_actions_make_spawn_properties(posix_spawnattr_t *attr,
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
// block) and use use select() to poll it.
|
||||
#if defined(__has_feature)
|
||||
#if __has_feature(thread_sanitizer)
|
||||
#define TOPIC_MONITOR_TSAN_WORKAROUND 1
|
||||
#define TOPIC_MONITOR_TSAN_WORKAROUND
|
||||
#endif
|
||||
#endif
|
||||
#if __SANITIZE_THREAD__
|
||||
#define TOPIC_MONITOR_TSAN_WORKAROUND 1
|
||||
#ifdef __SANITIZE_THREAD__
|
||||
#define TOPIC_MONITOR_TSAN_WORKAROUND
|
||||
#endif
|
||||
|
||||
/// Implementation of the principal monitor. This uses new (and leaks) to avoid registering a
|
||||
|
@ -49,7 +49,7 @@ topic_monitor_t::topic_monitor_t() {
|
|||
// The read end must block to avoid spinning in await.
|
||||
DIE_ON_FAILURE(make_fd_nonblocking(pipes_.write.fd()));
|
||||
|
||||
#if TOPIC_MONITOR_TSAN_WORKAROUND
|
||||
#ifdef TOPIC_MONITOR_TSAN_WORKAROUND
|
||||
DIE_ON_FAILURE(make_fd_nonblocking(pipes_.read.fd()));
|
||||
#endif
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ generation_list_t topic_monitor_t::await_gens(const generation_list_t &input_gen
|
|||
assert(gens == input_gens &&
|
||||
"Generations should not have changed if we are the reader.");
|
||||
int fd = pipes_.read.fd();
|
||||
#if TOPIC_MONITOR_TSAN_WORKAROUND
|
||||
#ifdef TOPIC_MONITOR_TSAN_WORKAROUND
|
||||
// Under tsan our notifying pipe is non-blocking, so we would busy-loop on the read()
|
||||
// call until data is available (that is, fish would use 100% cpu while waiting for
|
||||
// processes). The select prevents that.
|
||||
|
|
Loading…
Reference in a new issue