From 9eb47153d45d73fa60ebbdadf2c7b1414b7f1a69 Mon Sep 17 00:00:00 2001 From: jsteube Date: Wed, 7 Sep 2016 22:29:57 +0200 Subject: [PATCH] Replace all #ifdef with #if defined (...) for convention --- include/affinity.h | 8 +-- include/common.h | 16 ++++- include/data.h | 4 +- include/dynloader.h | 8 +-- include/ext_ADL.h | 2 +- include/ext_OpenCL.h | 10 +-- include/ext_nvapi.h | 2 +- include/ext_nvml.h | 2 +- include/ext_xnvctrl.h | 2 +- include/folder.h | 6 +- include/locking.h | 2 +- include/restore.h | 4 +- include/shared.h | 10 +-- include/terminal.h | 6 +- include/thread.h | 12 ++-- include/timer.h | 10 +-- include/types.h | 6 +- include/types_int.h | 4 +- src/Makefile | 10 +-- src/affinity.c | 12 ++-- src/ext_OpenCL.c | 2 +- src/ext_nvapi.c | 4 +- src/ext_nvml.c | 4 +- src/ext_xnvctrl.c | 2 +- src/folder.c | 6 +- src/hashcat.c | 156 +++++++++++++++++++++--------------------- src/hwmon.c | 4 +- src/interface.c | 2 +- src/locking.c | 2 +- src/logfile.c | 2 +- src/logging.c | 2 +- src/mpsp.c | 2 +- src/restore.c | 10 +-- src/rp_cpu.c | 2 +- src/shared.c | 10 +-- src/terminal.c | 4 +- src/usage.c | 2 +- 37 files changed, 182 insertions(+), 170 deletions(-) diff --git a/include/affinity.h b/include/affinity.h index 89b5ff7da..44f614cf3 100644 --- a/include/affinity.h +++ b/include/affinity.h @@ -9,21 +9,21 @@ #include #include -#ifdef _POSIX +#if defined (_POSIX) #include #include #endif // _POSIX -#ifdef __APPLE__ +#if defined (__APPLE__) #include #include #endif // __APPLE__ -#ifdef _WIN +#if defined (_WIN) #include #endif // _WIN -#ifdef __APPLE__ +#if defined (__APPLE__) typedef struct cpu_set { uint32_t count; diff --git a/include/common.h b/include/common.h index 190f1ef90..d1568fd40 100644 --- a/include/common.h +++ b/include/common.h @@ -8,6 +8,18 @@ #ifndef _COMMON_H #define _COMMON_H +#if defined (__linux__) +#define _POSIX +#elif defined (__APPLE__) +#define _POSIX +#elif defined (__FreeBSD__) +#define _POSIX +#elif defined (_WIN32) || defined (_WIN64) +#define _WIN +#else +#error Your Operating System is not supported or detected +#endif + #define _GNU_SOURCE #define _FILE_OFFSET_BITS 64 @@ -32,11 +44,11 @@ #define CEIL(a) ((a - (int) (a)) > 0 ? a + 1 : a) -#ifdef __APPLE__ +#if defined (__APPLE__) #define __stdcall #endif -#ifdef _WIN +#if defined (_WIN) #define WIN32_LEAN_AND_MEAN #endif diff --git a/include/data.h b/include/data.h index aff9a64f0..1e641e86c 100644 --- a/include/data.h +++ b/include/data.h @@ -71,7 +71,7 @@ typedef struct * hardware watchdog */ - #ifdef HAVE_HWMON + #if defined (HAVE_HWMON) void *hm_adl; void *hm_nvml; void *hm_nvapi; @@ -192,7 +192,7 @@ typedef struct uint dgst_pos2; uint dgst_pos3; - #ifdef HAVE_HWMON + #if defined (HAVE_HWMON) uint gpu_temp_disable; uint gpu_temp_abort; uint gpu_temp_retain; diff --git a/include/dynloader.h b/include/dynloader.h index f5463fd6a..5933c3650 100644 --- a/include/dynloader.h +++ b/include/dynloader.h @@ -8,18 +8,18 @@ #include -#ifdef _POSIX +#if defined (_POSIX) #include -#ifdef __APPLE__ +#if defined (__APPLE__) #include #endif // __APPLE__ #endif // _POSIX -#ifdef _WIN +#if defined (_WIN) #include #endif // _WIN -#ifdef _WIN +#if defined (_WIN) #define hc_dlopen LoadLibrary #define hc_dlclose FreeLibrary #define hc_dlsym GetProcAddress diff --git a/include/ext_ADL.h b/include/ext_ADL.h index d33052b70..1dbff1445 100644 --- a/include/ext_ADL.h +++ b/include/ext_ADL.h @@ -304,7 +304,7 @@ typedef int (ADL_API_CALL *ADL_OVERDRIVE6_TARGETTEMPERATUREDATA_GET) (int, int * typedef int (ADL_API_CALL *ADL_OVERDRIVE6_TARGETTEMPERATURERANGEINFO_GET) (int, ADLOD6ParameterRange *); typedef int (ADL_API_CALL *ADL_OVERDRIVE6_FANSPEED_RESET) (int); -#ifdef _POSIX +#if defined (_POSIX) typedef void *ADL_LIB; #else typedef HINSTANCE ADL_LIB; diff --git a/include/ext_OpenCL.h b/include/ext_OpenCL.h index fdb0891e5..fcc401bee 100644 --- a/include/ext_OpenCL.h +++ b/include/ext_OpenCL.h @@ -11,19 +11,19 @@ #define CL_USE_DEPRECATED_OPENCL_1_2_APIS #define CL_USE_DEPRECATED_OPENCL_2_0_APIS -#ifdef __APPLE__ +#if defined (__APPLE__) #include #endif -#ifdef _WIN +#if defined (_WIN) #include #endif -#ifdef __linux__ +#if defined (__linux__) #include #endif -#ifdef __FreeBSD__ +#if defined (__FreeBSD__) #include #endif @@ -62,7 +62,7 @@ typedef cl_int (CL_API_CALL *OCL_CLRELEASEPROGRAM) (cl_progra typedef cl_int (CL_API_CALL *OCL_CLSETKERNELARG) (cl_kernel, cl_uint, size_t, const void *); typedef cl_int (CL_API_CALL *OCL_CLWAITFOREVENTS) (cl_uint, const cl_event *); -#ifdef _POSIX +#if defined (_POSIX) typedef void *OCL_LIB; #else typedef HINSTANCE OCL_LIB; diff --git a/include/ext_nvapi.h b/include/ext_nvapi.h index eebf0e70f..158254f46 100644 --- a/include/ext_nvapi.h +++ b/include/ext_nvapi.h @@ -233,7 +233,7 @@ typedef int (*NVAPI_API_CALL NVAPI_GPU_GETPERFPOLICIESSTATUS) (NvPhysicalGpuHand typedef int (*NVAPI_API_CALL NVAPI_GPU_SETCOOLERLEVELS) (NvPhysicalGpuHandle, NvU32, NV_GPU_COOLER_LEVELS *); typedef int (*NVAPI_API_CALL NVAPI_GPU_RESTORECOOLERSETTINGS) (NvPhysicalGpuHandle, NvU32); -#ifdef _POSIX +#if defined (_POSIX) typedef void *NVAPI_LIB; #else typedef HINSTANCE NVAPI_LIB; diff --git a/include/ext_nvml.h b/include/ext_nvml.h index 2cd50cc41..7d5417d58 100644 --- a/include/ext_nvml.h +++ b/include/ext_nvml.h @@ -189,7 +189,7 @@ typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_GET_POWERMANAGEMENTLIMITCONSTRA typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_SET_POWERMANAGEMENTLIMIT) (nvmlDevice_t, unsigned int); typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_GET_POWERMANAGEMENTLIMIT) (nvmlDevice_t, unsigned int *); -#ifdef _POSIX +#if defined (_POSIX) typedef void *NVML_LIB; #else typedef HINSTANCE NVML_LIB; diff --git a/include/ext_xnvctrl.h b/include/ext_xnvctrl.h index e6b2fb5ef..ec3c133cb 100644 --- a/include/ext_xnvctrl.h +++ b/include/ext_xnvctrl.h @@ -49,7 +49,7 @@ typedef int HM_ADAPTER_XNVCTRL; typedef int (*XNVCTRL_API_CALL XNVCTRLQUERYTARGETATTRIBUTE) (void *, int, int, unsigned int, unsigned int, int *); typedef void (*XNVCTRL_API_CALL XNVCTRLSETTARGETATTRIBUTE) (void *, int, int, unsigned int, unsigned int, int); -#ifdef _POSIX +#if defined (_POSIX) typedef void *XNVCTRL_LIB; #else typedef HINSTANCE XNVCTRL_LIB; diff --git a/include/folder.h b/include/folder.h index 5a7e4250c..24eb84ced 100644 --- a/include/folder.h +++ b/include/folder.h @@ -10,14 +10,14 @@ #include #include -#ifdef _POSIX +#if defined (_POSIX) #include -#ifdef __APPLE__ +#if defined (__APPLE__) #include #endif // __APPLE__ #endif // _POSIX -#ifdef _WIN +#if defined (_WIN) #include #endif diff --git a/include/locking.h b/include/locking.h index 740a72c4c..12cb57e12 100644 --- a/include/locking.h +++ b/include/locking.h @@ -13,7 +13,7 @@ #include #include -#ifdef F_SETLKW +#if defined (F_SETLKW) void lock_file (FILE *fp); void unlock_file (FILE *fp); diff --git a/include/restore.h b/include/restore.h index 614f38d52..fe2572229 100644 --- a/include/restore.h +++ b/include/restore.h @@ -10,12 +10,12 @@ #include #include -#ifdef _POSIX +#if defined (_POSIX) #include #include #endif // _POSIX -#ifdef _WIN +#if defined (_WIN) #include #include #endif // _WIN diff --git a/include/shared.h b/include/shared.h index 09f1e698d..80256fe8c 100644 --- a/include/shared.h +++ b/include/shared.h @@ -20,13 +20,13 @@ * OS specific includes */ -#ifdef _POSIX +#if defined (_POSIX) #include #include #include #endif // _POSIX -#ifdef _WIN +#if defined (_WIN) #include #endif // _WIN @@ -37,9 +37,9 @@ -#ifdef _WIN +#if defined (_WIN) #define hc_sleep(x) Sleep ((x) * 1000); -#elif _POSIX +#elif defined (_POSIX) #define hc_sleep(x) sleep ((x)); #endif @@ -136,7 +136,7 @@ void naive_escape (char *s, size_t s_max, const u8 key_char, const u8 escape_cha void check_checkpoint (void); -#ifdef _WIN +#if defined (_WIN) BOOL WINAPI sigHandler_default (DWORD sig); BOOL WINAPI sigHandler_benchmark (DWORD sig); diff --git a/include/terminal.h b/include/terminal.h index 2cd0a1cf2..ebba754aa 100644 --- a/include/terminal.h +++ b/include/terminal.h @@ -13,14 +13,14 @@ #include #include -#ifdef _POSIX +#if defined (_POSIX) #include -#ifdef __APPLE__ +#if defined (__APPLE__) #include #endif // __APPLE__ #endif // _POSIX -#ifdef _WIN +#if defined (_WIN) #include #endif // _WIN diff --git a/include/thread.h b/include/thread.h index 08ce0c728..a89f425b4 100644 --- a/include/thread.h +++ b/include/thread.h @@ -6,23 +6,23 @@ #ifndef _THREAD_H #define _THREAD_H -#ifdef _POSIX +#if defined (_POSIX) #include #include #endif // _POSIX -#ifdef _WIN +#if defined (_WIN) #include #endif // _WIN -#ifdef _WIN +#if defined (_WIN) typedef HANDLE hc_thread_t; typedef CRITICAL_SECTION hc_thread_mutex_t; -#elif _POSIX +#elif defined (_POSIX) typedef pthread_t hc_thread_t; typedef pthread_mutex_t hc_thread_mutex_t; #endif -#ifdef _WIN +#if defined (_WIN) #define hc_thread_create(t,f,a) t = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) &f, a, 0, NULL) #define hc_thread_wait(n,a) for (uint i = 0; i < n; i++) WaitForSingleObject ((a)[i], INFINITE) @@ -33,7 +33,7 @@ typedef pthread_mutex_t hc_thread_mutex_t; #define hc_thread_mutex_init(m) InitializeCriticalSection (&m) #define hc_thread_mutex_delete(m) DeleteCriticalSection (&m) -#elif _POSIX +#elif defined (_POSIX) #define hc_thread_create(t,f,a) pthread_create (&t, NULL, f, a) #define hc_thread_wait(n,a) for (uint i = 0; i < n; i++) pthread_join ((a)[i], NULL) diff --git a/include/timer.h b/include/timer.h index 2b7a38439..0100f7f17 100644 --- a/include/timer.h +++ b/include/timer.h @@ -6,23 +6,23 @@ #ifndef _TIMER_H #define _TIMER_H -#ifdef _POSIX +#if defined (_POSIX) #include #else #endif -#ifdef _WIN +#if defined (_WIN) typedef LARGE_INTEGER hc_timer_t; -#elif _POSIX +#elif defined (_POSIX) typedef struct timeval hc_timer_t; #endif -#ifdef _WIN +#if defined (_WIN) #define hc_timer_get(a,r) { hc_timer_t hr_freq; QueryPerformanceFrequency (&hr_freq); hc_timer_t hr_tmp; hc_timer_set (&hr_tmp); (r) = (double) ((double) (hr_tmp.QuadPart - (a).QuadPart) / (double) (hr_freq.QuadPart / 1000)); } #define hc_timer_set(a) { QueryPerformanceCounter ((a)); } -#elif _POSIX +#elif defined (_POSIX) #define hc_timer_get(a,r) { hc_timer_t hr_tmp; hc_timer_set (&hr_tmp); (r) = (double) (((hr_tmp.tv_sec - (a).tv_sec) * 1000) + ((double) (hr_tmp.tv_usec - (a).tv_usec) / 1000)); } #define hc_timer_set(a) { gettimeofday ((a), NULL); } diff --git a/include/types.h b/include/types.h index 520608fd3..32f6f9189 100644 --- a/include/types.h +++ b/include/types.h @@ -13,7 +13,7 @@ #include #include -#ifdef _WIN +#if defined (_WIN) #define EOL "\r\n" #else #define EOL "\n" @@ -210,11 +210,11 @@ typedef struct { u64 cnt; - #ifdef _POSIX + #if defined (_POSIX) struct stat stat; #endif - #ifdef _WIN + #if defined (_WIN) struct __stat64 stat; #endif diff --git a/include/types_int.h b/include/types_int.h index 0b78b1889..2503d500c 100644 --- a/include/types_int.h +++ b/include/types_int.h @@ -9,9 +9,9 @@ #include #include -#ifdef _WIN +#if defined (_WIN) #include -#ifdef _BASETSD_H +#if defined (_BASETSD_H) #else typedef UINT8 uint8_t; typedef UINT16 uint16_t; diff --git a/src/Makefile b/src/Makefile index c8dbd9ff6..c1d04c6a1 100644 --- a/src/Makefile +++ b/src/Makefile @@ -113,14 +113,14 @@ BINARY_NATIVE := $(PROG_NAME) ifeq ($(UNAME),Darwin) export MACOSX_DEPLOYMENT_TARGET=10.9 -CFLAGS_NATIVE := -D_POSIX +CFLAGS_NATIVE := CFLAGS_NATIVE += $(CFLAGS) LFLAGS_NATIVE := -lpthread LFLAGS_NATIVE += $(LDFLAGS) endif # darwin ifeq ($(UNAME),Linux) -CFLAGS_NATIVE := -D_POSIX +CFLAGS_NATIVE := ifndef DEBUG CFLAGS_NATIVE += -s endif @@ -131,7 +131,7 @@ LFLAGS_NATIVE += $(LDFLAGS) endif # linux ifeq ($(UNAME),FreeBSD) -CFLAGS_NATIVE := -D_POSIX +CFLAGS_NATIVE := CFLAGS_NATIVE += $(CFLAGS) LFLAGS_NATIVE := -lpthread LFLAGS_NATIVE += $(LDFLAGS) @@ -141,7 +141,7 @@ endif # freebsd ## Cross compilation target ## -CFLAGS_CROSS_LINUX := -D_POSIX +CFLAGS_CROSS_LINUX := ifndef DEBUG CFLAGS_CROSS_LINUX += -s endif @@ -149,7 +149,7 @@ CFLAGS_CROSS_LINUX += $(CFLAGS) CFLAGS_CROSS_LINUX += -DHAVE_HWMON #CFLAGS_CROSS_WIN := -D_WIN -DWIN -D__MSVCRT__ -D__USE_MINGW_ANSI_STDIO=1 -CFLAGS_CROSS_WIN := -D_WIN +CFLAGS_CROSS_WIN := ifndef DEBUG CFLAGS_CROSS_WIN += -s endif diff --git a/src/affinity.c b/src/affinity.c index 7df13dacc..2de135cc7 100644 --- a/src/affinity.c +++ b/src/affinity.c @@ -3,7 +3,7 @@ * License.....: MIT */ -#ifdef __APPLE__ +#if defined (__APPLE__) #include #endif @@ -13,7 +13,7 @@ #include "logging.h" #include "affinity.h" -#ifdef __APPLE__ +#if defined (__APPLE__) static void CPU_ZERO (cpu_set_t *cs) { cs->count = 0; @@ -77,9 +77,9 @@ void set_cpu_affinity (char *cpu_affinity) if (cpu_id == 0) { - #ifdef _WIN + #if defined (_WIN) aff_mask = 0; - #elif _POSIX + #elif defined (_POSIX) CPU_ZERO (&cpuset); #endif @@ -93,9 +93,9 @@ void set_cpu_affinity (char *cpu_affinity) exit (-1); } - #ifdef _WIN + #if defined (_WIN) aff_mask |= 1u << (cpu_id - 1); - #elif _POSIX + #elif defined (_POSIX) CPU_SET ((cpu_id - 1), &cpuset); #endif diff --git a/src/ext_OpenCL.c b/src/ext_OpenCL.c index 23cf3e847..ce92f61b8 100644 --- a/src/ext_OpenCL.c +++ b/src/ext_OpenCL.c @@ -87,7 +87,7 @@ int ocl_init (OCL_PTR *ocl) log_info (""); log_info ("ATTENTION! Can't find OpenCL ICD loader library"); log_info (""); - #ifdef __linux__ + #if defined (__linux__) log_info ("You're probably missing the \"ocl-icd-libopencl1\" package (Debian/Ubuntu)"); log_info (" sudo apt-get install ocl-icd-libopencl1"); log_info (""); diff --git a/src/ext_nvapi.c b/src/ext_nvapi.c index 3f7a7d60b..910b4c691 100644 --- a/src/ext_nvapi.c +++ b/src/ext_nvapi.c @@ -17,7 +17,7 @@ int nvapi_init (NVAPI_PTR *nvapi) memset (nvapi, 0, sizeof (NVAPI_PTR)); - #ifdef _WIN + #if defined (_WIN) #if defined (WIN64) nvapi->lib = hc_dlopen ("nvapi64.dll"); #elif defined (WIN32) @@ -194,7 +194,7 @@ int hm_NvAPI_GPU_RestoreCoolerSettings (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hP return NvAPI_rc; } -#ifdef __MINGW64__ +#if defined (__MINGW64__) void __security_check_cookie (uintptr_t _StackCookie) { diff --git a/src/ext_nvml.c b/src/ext_nvml.c index 526775cc1..8a519c254 100644 --- a/src/ext_nvml.c +++ b/src/ext_nvml.c @@ -17,7 +17,7 @@ int nvml_init (NVML_PTR *nvml) memset (nvml, 0, sizeof (NVML_PTR)); - #ifdef _WIN + #if defined (_WIN) nvml->lib = hc_dlopen ("nvml.dll"); if (!nvml->lib) @@ -61,7 +61,7 @@ int nvml_init (NVML_PTR *nvml) myfree (Buffer); } - #elif _POSIX + #elif defined (_POSIX) nvml->lib = hc_dlopen ("libnvidia-ml.so", RTLD_NOW); #endif diff --git a/src/ext_xnvctrl.c b/src/ext_xnvctrl.c index eebe0a141..7eeca3da8 100644 --- a/src/ext_xnvctrl.c +++ b/src/ext_xnvctrl.c @@ -59,7 +59,7 @@ void xnvctrl_close (XNVCTRL_PTR *xnvctrl) { if (xnvctrl) { - #ifdef _POSIX + #if defined (_POSIX) if (xnvctrl->lib_x11) { diff --git a/src/folder.c b/src/folder.c index 28da59643..34c033dbe 100644 --- a/src/folder.c +++ b/src/folder.c @@ -5,7 +5,7 @@ * License.....: MIT */ -#ifdef __APPLE__ +#if defined (__APPLE__) #include #endif @@ -13,7 +13,7 @@ #include "memory.h" #include "folder.h" -#ifdef __APPLE__ +#if defined (__APPLE__) #include "types_int.h" #include "logging.h" #endif @@ -152,7 +152,7 @@ char **scan_directory (const char *path) if ((d = opendir (tmp_path)) != NULL) { - #ifdef __APPLE__ + #if defined (__APPLE__) struct dirent e; diff --git a/src/hashcat.c b/src/hashcat.c index ad7d84b64..bbdff0f18 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -6,7 +6,7 @@ * License.....: MIT */ -#ifdef __APPLE__ +#if defined (__APPLE__) #include #endif @@ -20,7 +20,7 @@ #include #include -#ifdef _POSIX +#if defined (_POSIX) #include #include #endif // _POSIX @@ -270,7 +270,7 @@ static const char ST_0009[] = "Running (stop at checkpoint)"; static const char ST_0010[] = "Autotuning"; -#ifdef _WIN +#if defined (_WIN) #define mkdir(name,mode) mkdir (name) #endif @@ -666,7 +666,7 @@ void status_display_machine_readable () * temperature */ - #ifdef HAVE_HWMON + #if defined (HAVE_HWMON) if (data.gpu_temp_disable == 0) { fprintf (out, "TEMP\t"); @@ -1059,7 +1059,7 @@ void status_display () ms_paused += ms_paused_tmp; } - #ifdef _WIN + #if defined (_WIN) __time64_t sec_run = (__time64_t) ms_running / 1000; @@ -1077,7 +1077,7 @@ void status_display () struct tm *tmp = NULL; - #ifdef _WIN + #if defined (_WIN) tmp = _gmtime64 (&sec_run); @@ -1172,7 +1172,7 @@ void status_display () { if (data.devices_status != STATUS_CRACKED) { - #ifdef _WIN + #if defined (_WIN) __time64_t sec_etc = 0; #else time_t sec_etc = 0; @@ -1205,7 +1205,7 @@ void status_display () struct tm *tmp = NULL; - #ifdef _WIN + #if defined (_WIN) tmp = _gmtime64 (&sec_etc); #else tmp = gmtime (&sec_etc); @@ -1236,7 +1236,7 @@ void status_display () time (&runtime_cur); - #ifdef _WIN + #if defined (_WIN) __time64_t runtime_left = data.proc_start + data.runtime + data.prepare_time + (ms_paused / 1000) - runtime_cur; @@ -1433,7 +1433,7 @@ void status_display () } } - #ifdef HAVE_HWMON + #if defined (HAVE_HWMON) if (data.devices_status == STATUS_EXHAUSTED) return; if (data.devices_status == STATUS_CRACKED) return; @@ -3590,7 +3590,7 @@ static int autotune (hc_device_param_t *device_param) device_param->kernel_power = kernel_power; - #ifdef DEBUG + #if defined (DEBUG) if (data.quiet == 0) { @@ -3619,14 +3619,14 @@ static int run_cracker (hc_device_param_t *device_param, const uint pws_cnt) uint speed_pos = device_param->speed_pos; - #ifdef _POSIX + #if defined (_POSIX) if (device_param->timer_speed.tv_sec == 0) { hc_timer_set (&device_param->timer_speed); } #endif - #ifdef _WIN + #if defined (_WIN) if (device_param->timer_speed.QuadPart == 0) { hc_timer_set (&device_param->timer_speed); @@ -4157,11 +4157,11 @@ static void get_next_word (wl_data_t *wl_data, FILE *fd, char **out_buf, uint *o get_next_word (wl_data, fd, out_buf, out_len); } -#ifdef _POSIX +#if defined (_POSIX) static u64 count_words (wl_data_t *wl_data, FILE *fd, char *dictfile, dictstat_t *dictstat_base, size_t *dictstat_nmemb) #endif -#ifdef _WIN +#if defined (_WIN) static u64 count_words (wl_data_t *wl_data, FILE *fd, char *dictfile, dictstat_t *dictstat_base, uint *dictstat_nmemb) #endif { @@ -4171,11 +4171,11 @@ static u64 count_words (wl_data_t *wl_data, FILE *fd, char *dictfile, dictstat_t d.cnt = 0; - #ifdef _POSIX + #if defined (_POSIX) fstat (fileno (fd), &d.stat); #endif - #ifdef _WIN + #if defined (_WIN) _fstat64 (fileno (fd), &d.stat); #endif @@ -4186,7 +4186,7 @@ static u64 count_words (wl_data_t *wl_data, FILE *fd, char *dictfile, dictstat_t d.stat.st_rdev = 0; d.stat.st_atime = 0; - #ifdef _POSIX + #if defined (_POSIX) d.stat.st_blksize = 0; d.stat.st_blocks = 0; #endif @@ -4315,7 +4315,7 @@ static void *thread_monitor (void *p) uint remove_left = data.remove_timer; uint status_left = data.status_timer; - #ifdef HAVE_HWMON + #if defined (HAVE_HWMON) uint hwmon_check = 0; int slowdown_warnings = 0; @@ -4359,7 +4359,7 @@ static void *thread_monitor (void *p) status_check = 1; } - #ifdef HAVE_HWMON + #if defined (HAVE_HWMON) if (data.gpu_temp_disable == 0) { time (&last_temp_check_time); @@ -4370,7 +4370,7 @@ static void *thread_monitor (void *p) if ((runtime_check == 0) && (remove_check == 0) && (status_check == 0) && (restore_check == 0)) { - #ifdef HAVE_HWMON + #if defined (HAVE_HWMON) if (hwmon_check == 0) #endif return (p); @@ -4382,7 +4382,7 @@ static void *thread_monitor (void *p) if (data.devices_status != STATUS_RUNNING) continue; - #ifdef HAVE_HWMON + #if defined (HAVE_HWMON) if (hwmon_check == 1) { @@ -4524,11 +4524,11 @@ static void *thread_monitor (void *p) } else if (device_param->device_vendor_id == VENDOR_ID_NV) { - #ifdef _WIN + #if defined (_WIN) hm_set_fanspeed_with_device_id_nvapi (device_id, fan_speed_new, 1); #endif - #ifdef __linux__ + #if defined (__linux__) hm_set_fanspeed_with_device_id_xnvctrl (device_id, fan_speed_new); #endif } @@ -4629,7 +4629,7 @@ static void *thread_monitor (void *p) } } - #ifdef HAVE_HWMON + #if defined (HAVE_HWMON) myfree (fan_speed_chgd); myfree (temp_diff_old); @@ -4752,13 +4752,13 @@ static void *thread_outfile_remove (void *p) { //hc_thread_mutex_lock (mux_display); - #ifdef _POSIX + #if defined (_POSIX) struct stat outfile_stat; fstat (fileno (fp), &outfile_stat); #endif - #ifdef _WIN + #if defined (_WIN) struct stat64 outfile_stat; _fstat64 (fileno (fp), &outfile_stat); @@ -5916,7 +5916,7 @@ static void *HC_API_CALL ADL_Main_Memory_Alloc (const int iSize) * main */ -#ifdef _WIN +#if defined (_WIN) static void SetConsoleWindowSize (const int x) { HANDLE h = GetStdHandle (STD_OUTPUT_HANDLE); @@ -5944,7 +5944,7 @@ static void SetConsoleWindowSize (const int x) int main (int argc, char **argv) { - #ifdef _WIN + #if defined (_WIN) SetConsoleWindowSize (132); #endif @@ -6095,7 +6095,7 @@ int main (int argc, char **argv) uint kernel_loops = KERNEL_LOOPS; uint nvidia_spin_damp = NVIDIA_SPIN_DAMP; uint gpu_temp_disable = GPU_TEMP_DISABLE; - #ifdef HAVE_HWMON + #if defined (HAVE_HWMON) uint gpu_temp_abort = GPU_TEMP_ABORT; uint gpu_temp_retain = GPU_TEMP_RETAIN; uint powertune_enable = POWERTUNE_ENABLE; @@ -6254,7 +6254,7 @@ int main (int argc, char **argv) {"kernel-loops", required_argument, 0, IDX_KERNEL_LOOPS}, {"nvidia-spin-damp", required_argument, 0, IDX_NVIDIA_SPIN_DAMP}, {"gpu-temp-disable", no_argument, 0, IDX_GPU_TEMP_DISABLE}, - #ifdef HAVE_HWMON + #if defined (HAVE_HWMON) {"gpu-temp-abort", required_argument, 0, IDX_GPU_TEMP_ABORT}, {"gpu-temp-retain", required_argument, 0, IDX_GPU_TEMP_RETAIN}, {"powertune-enable", no_argument, 0, IDX_POWERTUNE_ENABLE}, @@ -6414,7 +6414,7 @@ int main (int argc, char **argv) char cpath[1024] = { 0 }; - #ifdef _WIN + #if defined (_WIN) snprintf (cpath, sizeof (cpath) - 1, "%s\\OpenCL\\", shared_dir); @@ -6452,7 +6452,7 @@ int main (int argc, char **argv) putenv (tmp); } - #ifdef _WIN + #if defined (_WIN) naive_replace (cpath_real, '\\', '/'); @@ -6536,9 +6536,9 @@ int main (int argc, char **argv) myargc = rd->argc; myargv = rd->argv; - #ifdef _POSIX + #if defined (_POSIX) rd->pid = getpid (); - #elif _WIN + #elif defined (_WIN) rd->pid = GetCurrentProcessId (); #endif } @@ -6639,7 +6639,7 @@ int main (int argc, char **argv) case IDX_NVIDIA_SPIN_DAMP: nvidia_spin_damp = atoi (optarg); nvidia_spin_damp_chgd = 1; break; case IDX_GPU_TEMP_DISABLE: gpu_temp_disable = 1; break; - #ifdef HAVE_HWMON + #if defined (HAVE_HWMON) case IDX_GPU_TEMP_ABORT: gpu_temp_abort = atoi (optarg); break; case IDX_GPU_TEMP_RETAIN: gpu_temp_retain = atoi (optarg); break; case IDX_POWERTUNE_ENABLE: powertune_enable = 1; break; @@ -7401,7 +7401,7 @@ int main (int argc, char **argv) data.custom_charset_2 = custom_charset_2; data.custom_charset_3 = custom_charset_3; data.custom_charset_4 = custom_charset_4; - #ifdef HAVE_HWMON + #if defined (HAVE_HWMONO) data.powertune_enable = powertune_enable; #endif data.logfile_disable = logfile_disable; @@ -7484,7 +7484,7 @@ int main (int argc, char **argv) logfile_top_uint (kernel_loops); logfile_top_uint (nvidia_spin_damp); logfile_top_uint (gpu_temp_disable); - #ifdef HAVE_HWMON + #if defined (HAVE_HWMON) logfile_top_uint (gpu_temp_abort); logfile_top_uint (gpu_temp_retain); #endif @@ -7606,7 +7606,7 @@ int main (int argc, char **argv) gpu_temp_disable = 1; outfile_check_timer = 0; - #ifdef HAVE_HWMON + #if defined (HAVE_HWMON) if (powertune_enable == 1) { gpu_temp_disable = 0; @@ -11719,11 +11719,11 @@ int main (int argc, char **argv) dictstat_t *dictstat_base = (dictstat_t *) mycalloc (MAX_DICTSTAT, sizeof (dictstat_t)); - #ifdef _POSIX + #if defined (_POSIX) size_t dictstat_nmemb = 0; #endif - #ifdef _WIN + #if defined (_WIN) uint dictstat_nmemb = 0; #endif @@ -11739,13 +11739,13 @@ int main (int argc, char **argv) if (dictstat_fp) { - #ifdef _POSIX + #if defined (_POSIX) struct stat tmpstat; fstat (fileno (dictstat_fp), &tmpstat); #endif - #ifdef _WIN + #if defined (_WIN) struct stat64 tmpstat; _fstat64 (fileno (dictstat_fp), &tmpstat); @@ -13118,12 +13118,12 @@ int main (int argc, char **argv) { if (data.hashfile != NULL) { - #ifdef _POSIX + #if defined (_POSIX) struct stat tmpstat_outfile; struct stat tmpstat_hashfile; #endif - #ifdef _WIN + #if defined (_WIN) struct stat64 tmpstat_outfile; struct stat64 tmpstat_hashfile; #endif @@ -13132,11 +13132,11 @@ int main (int argc, char **argv) if (tmp_outfile_fp) { - #ifdef _POSIX + #if defined (_POSIX) fstat (fileno (tmp_outfile_fp), &tmpstat_outfile); #endif - #ifdef _WIN + #if defined (_WIN) _fstat64 (fileno (tmp_outfile_fp), &tmpstat_outfile); #endif @@ -13147,11 +13147,11 @@ int main (int argc, char **argv) if (tmp_hashfile_fp) { - #ifdef _POSIX + #if defined (_POSIX) fstat (fileno (tmp_hashfile_fp), &tmpstat_hashfile); #endif - #ifdef _WIN + #if defined (_WIN) _fstat64 (fileno (tmp_hashfile_fp), &tmpstat_hashfile); #endif @@ -13174,7 +13174,7 @@ int main (int argc, char **argv) tmpstat_hashfile.st_rdev = 0; tmpstat_hashfile.st_atime = 0; - #ifdef _POSIX + #if defined (_POSIX) tmpstat_outfile.st_blksize = 0; tmpstat_outfile.st_blocks = 0; @@ -13182,7 +13182,7 @@ int main (int argc, char **argv) tmpstat_hashfile.st_blocks = 0; #endif - #ifdef _POSIX + #if defined (_POSIX) if (memcmp (&tmpstat_outfile, &tmpstat_hashfile, sizeof (struct stat)) == 0) { log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file"); @@ -13191,7 +13191,7 @@ int main (int argc, char **argv) } #endif - #ifdef _WIN + #if defined (_WIN) if (memcmp (&tmpstat_outfile, &tmpstat_hashfile, sizeof (struct stat64)) == 0) { log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file"); @@ -14761,7 +14761,7 @@ int main (int argc, char **argv) char *device_name_chksum = (char *) mymalloc (INFOSZ); - #ifdef __x86_64__ + #if defined (__x86_64__) snprintf (device_name_chksum, INFOSZ - 1, "%u-%u-%u-%s-%s-%s-%u", 64, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, COMPTIME); #else snprintf (device_name_chksum, INFOSZ - 1, "%u-%u-%u-%s-%s-%s-%u", 32, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, COMPTIME); @@ -14788,11 +14788,11 @@ int main (int argc, char **argv) { need_nvml = 1; - #ifdef __linux__ + #if defined (__linux__) need_xnvctrl = 1; #endif - #ifdef _WIN + #if defined (_WIN) need_nvapi = 1; #endif } @@ -14938,7 +14938,7 @@ int main (int argc, char **argv) log_info ("ATTENTION! Unsupported or incorrectly installed Catalyst driver detected!"); log_info ("You are STRONGLY encouraged to use the official supported catalyst driver"); log_info ("See hashcat's homepage for official supported catalyst drivers"); - #ifdef _WIN + #if defined (_WIN) log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to"); #endif log_info ("You can use --force to override this but do not post error reports if you do so"); @@ -15080,7 +15080,7 @@ int main (int argc, char **argv) * HM devices: init */ - #ifdef HAVE_HWMON + #if defined (HAVE_HWMON) hm_attrs_t hm_adapters_adl[DEVICES_MAX]; hm_attrs_t hm_adapters_nvapi[DEVICES_MAX]; hm_attrs_t hm_adapters_nvml[DEVICES_MAX]; @@ -15313,7 +15313,7 @@ int main (int argc, char **argv) * Watchdog and Temperature balance */ - #ifdef HAVE_HWMON + #if defined (HAVE_HWMON) if (gpu_temp_disable == 0 && data.hm_adl == NULL && data.hm_nvml == NULL && data.hm_xnvctrl == NULL) { log_info ("Watchdog: Hardware Monitoring Interface not found on your system"); @@ -15341,7 +15341,7 @@ int main (int argc, char **argv) #endif } - #ifdef HAVE_HWMON + #if defined (HAVE_HWMON) /** * HM devices: copy @@ -15578,7 +15578,7 @@ int main (int argc, char **argv) #endif // HAVE_HWMON - #ifdef DEBUG + #if defined (DEBUG) if (benchmark == 1) log_info ("Hashmode: %d", data.hash_mode); #endif @@ -16107,7 +16107,7 @@ int main (int argc, char **argv) char build_opts[1024] = { 0 }; - #ifdef _WIN + #if defined (_WIN) snprintf (build_opts, sizeof (build_opts) - 1, "-I \"%s\"", cpath_real); #else snprintf (build_opts, sizeof (build_opts) - 1, "-I %s", cpath_real); @@ -16167,7 +16167,7 @@ int main (int argc, char **argv) char build_opts_new[1024] = { 0 }; - #ifdef DEBUG + #if defined (DEBUG) snprintf (build_opts_new, sizeof (build_opts_new) - 1, "%s -D VENDOR_ID=%u -D CUDA_ARCH=%d -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D _unroll -cl-std=CL1.1", build_opts, device_param->device_vendor_id, (device_param->sm_major * 100) + device_param->sm_minor, device_param->vector_width, (u32) device_param->device_type, data.dgst_pos0, data.dgst_pos1, data.dgst_pos2, data.dgst_pos3, data.dgst_size / 4, kern_type); #else snprintf (build_opts_new, sizeof (build_opts_new) - 1, "%s -D VENDOR_ID=%u -D CUDA_ARCH=%d -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D _unroll -cl-std=CL1.1 -w", build_opts, device_param->device_vendor_id, (device_param->sm_major * 100) + device_param->sm_minor, device_param->vector_width, (u32) device_param->device_type, data.dgst_pos0, data.dgst_pos1, data.dgst_pos2, data.dgst_pos3, data.dgst_size / 4, kern_type); @@ -16175,7 +16175,7 @@ int main (int argc, char **argv) strncpy (build_opts, build_opts_new, sizeof (build_opts)); - #ifdef DEBUG + #if defined (DEBUG) log_info ("- Device #%u: build_opts '%s'\n", device_id + 1, build_opts); #endif @@ -16267,7 +16267,7 @@ int main (int argc, char **argv) hc_clGetProgramBuildInfo (data.ocl, device_param->program, device_param->device, CL_PROGRAM_BUILD_LOG, 0, NULL, &build_log_size); - #ifdef DEBUG + #if defined (DEBUG) if ((build_log_size != 0) || (CL_err != CL_SUCCESS)) #else if (CL_err != CL_SUCCESS) @@ -16326,7 +16326,7 @@ int main (int argc, char **argv) } else { - #ifdef DEBUG + #if defined (DEBUG) log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id + 1, cached_file, cst.st_size); #endif @@ -16353,7 +16353,7 @@ int main (int argc, char **argv) } else { - #ifdef DEBUG + #if defined (DEBUG) log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id + 1, source_file, sst.st_size); #endif @@ -16407,7 +16407,7 @@ int main (int argc, char **argv) hc_clGetProgramBuildInfo (data.ocl, device_param->program, device_param->device, CL_PROGRAM_BUILD_LOG, 0, NULL, &build_log_size); - #ifdef DEBUG + #if defined (DEBUG) if ((build_log_size != 0) || (CL_err != CL_SUCCESS)) #else if (CL_err != CL_SUCCESS) @@ -16530,7 +16530,7 @@ int main (int argc, char **argv) hc_clGetProgramBuildInfo (data.ocl, device_param->program_mp, device_param->device, CL_PROGRAM_BUILD_LOG, 0, NULL, &build_log_size); - #ifdef DEBUG + #if defined (DEBUG) if ((build_log_size != 0) || (CL_err != CL_SUCCESS)) #else if (CL_err != CL_SUCCESS) @@ -16589,7 +16589,7 @@ int main (int argc, char **argv) } else { - #ifdef DEBUG + #if defined (DEBUG) log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id + 1, cached_file, cst.st_size); #endif @@ -16711,7 +16711,7 @@ int main (int argc, char **argv) hc_clGetProgramBuildInfo (data.ocl, device_param->program_amp, device_param->device, CL_PROGRAM_BUILD_LOG, 0, NULL, &build_log_size); - #ifdef DEBUG + #if defined (DEBUG) if ((build_log_size != 0) || (CL_err != CL_SUCCESS)) #else if (CL_err != CL_SUCCESS) @@ -16770,7 +16770,7 @@ int main (int argc, char **argv) } else { - #ifdef DEBUG + #if defined (DEBUG) if (quiet == 0) log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id + 1, cached_file, cst.st_size); #endif @@ -17560,11 +17560,11 @@ int main (int argc, char **argv) } else if (device_param->device_vendor_id == VENDOR_ID_NV) { - #ifdef __linux__ + #if defined (__linux__) rc = set_fan_control (data.hm_xnvctrl, data.hm_device[device_id].xnvctrl, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_TRUE); #endif - #ifdef _WIN + #if defined (_WIN) rc = hm_set_fanspeed_with_device_id_nvapi (device_id, fanspeed, 1); #endif } @@ -17626,7 +17626,7 @@ int main (int argc, char **argv) * open filehandles */ - #ifdef _WIN + #if defined (_WIN) if (_setmode (_fileno (stdin), _O_BINARY) == -1) { log_error ("ERROR: %s: %s", "stdin", strerror (errno)); @@ -19809,7 +19809,7 @@ int main (int argc, char **argv) // reset default fan speed - #ifdef HAVE_HWMON + #if defined (HAVE_HWMON) if (gpu_temp_disable == 0) { if (gpu_temp_retain != 0) @@ -19832,11 +19832,11 @@ int main (int argc, char **argv) } else if (device_param->device_vendor_id == VENDOR_ID_NV) { - #ifdef __linux__ + #if defined (__linux__) rc = set_fan_control (data.hm_xnvctrl, data.hm_device[device_id].xnvctrl, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_FALSE); #endif - #ifdef _WIN + #if defined (_WIN) rc = hm_set_fanspeed_with_device_id_nvapi (device_id, 100, 0); #endif } @@ -20001,7 +20001,7 @@ int main (int argc, char **argv) local_free (bitmap_s2_c); local_free (bitmap_s2_d); - #ifdef HAVE_HWMON + #if defined (HAVE_HWMON) local_free (od_clock_mem_status); local_free (od_power_control_status); local_free (nvml_power_limit); diff --git a/src/hwmon.c b/src/hwmon.c index c4b326151..5da2e7c01 100644 --- a/src/hwmon.c +++ b/src/hwmon.c @@ -23,7 +23,7 @@ #include "opencl.h" #include "data.h" -#ifdef HAVE_HWMON +#if defined (HAVE_HWMON) extern hc_global_data_t data; @@ -234,7 +234,7 @@ u32 *hm_get_list_valid_adl_adapters (int iNumberAdapters, int *num_adl_adapters, if (strlen (info.strUDID) < 1) continue; - #ifdef _WIN + #if defined (_WIN) if (info.iVendorID != 1002) continue; #else if (info.iVendorID != 0x1002) continue; diff --git a/src/interface.c b/src/interface.c index 27dd42eae..5dfec5949 100644 --- a/src/interface.c +++ b/src/interface.c @@ -5,7 +5,7 @@ * License.....: MIT */ -#ifdef __APPLE__ +#if defined (__APPLE__) #include #endif diff --git a/src/locking.c b/src/locking.c index 19b9a43e5..3ead7d297 100644 --- a/src/locking.c +++ b/src/locking.c @@ -7,7 +7,7 @@ #include "logging.h" #include "locking.h" -#ifdef F_SETLKW +#if defined (F_SETLKW) void lock_file (FILE *fp) { diff --git a/src/logfile.c b/src/logfile.c index 9954b1067..5e259b2cd 100644 --- a/src/logfile.c +++ b/src/logfile.c @@ -5,7 +5,7 @@ * License.....: MIT */ -#ifdef __APPLE__ +#if defined (__APPLE__) #include #endif diff --git a/src/logging.c b/src/logging.c index 0c4382303..755f0b8db 100644 --- a/src/logging.c +++ b/src/logging.c @@ -5,7 +5,7 @@ * License.....: MIT */ -#ifdef __APPLE__ +#if defined (__APPLE__) #include #endif diff --git a/src/mpsp.c b/src/mpsp.c index 0ad4bc6c1..e75184600 100644 --- a/src/mpsp.c +++ b/src/mpsp.c @@ -5,7 +5,7 @@ * License.....: MIT */ -#ifdef __APPLE__ +#if defined (__APPLE__) #include #endif diff --git a/src/restore.c b/src/restore.c index 07e301c1e..11f6be567 100644 --- a/src/restore.c +++ b/src/restore.c @@ -24,7 +24,7 @@ extern hc_global_data_t data; -#ifdef _WIN +#if defined (_WIN) static void fsync (int fd) { HANDLE h = (HANDLE) _get_osfhandle (fd); @@ -86,7 +86,7 @@ restore_data_t *init_restore (int argc, char **argv) int pidbin_len = -1; - #ifdef _POSIX + #if defined (_POSIX) snprintf (pidbin, HCBUFSIZ - 1, "/proc/%d/cmdline", rd->pid); FILE *fd = fopen (pidbin, "rb"); @@ -115,7 +115,7 @@ restore_data_t *init_restore (int argc, char **argv) } } - #elif _WIN + #elif defined (_WIN) HANDLE hProcess = OpenProcess (PROCESS_ALL_ACCESS, FALSE, rd->pid); char *pidbin2 = (char *) mymalloc (HCBUFSIZ); @@ -158,9 +158,9 @@ restore_data_t *init_restore (int argc, char **argv) rd->version = RESTORE_VERSION_CUR; - #ifdef _POSIX + #if defined (_POSIX) rd->pid = getpid (); - #elif _WIN + #elif defined (_WIN) rd->pid = GetCurrentProcessId (); #endif diff --git a/src/rp_cpu.c b/src/rp_cpu.c index 8ec982c5f..3b1586ee4 100644 --- a/src/rp_cpu.c +++ b/src/rp_cpu.c @@ -3,7 +3,7 @@ * License.....: MIT */ -#ifdef __APPLE__ +#if defined (__APPLE__) #include #endif diff --git a/src/shared.c b/src/shared.c index 24e0bd78f..995311138 100644 --- a/src/shared.c +++ b/src/shared.c @@ -6,7 +6,7 @@ * License.....: MIT */ -#ifdef __APPLE__ +#if defined (__APPLE__) #include #endif @@ -251,7 +251,7 @@ int sort_by_dictstat (const void *s1, const void *s2) dictstat_t *d1 = (dictstat_t *) s1; dictstat_t *d2 = (dictstat_t *) s2; - #ifdef __linux__ + #if defined (__linux__) d2->stat.st_atim = d1->stat.st_atim; #else d2->stat.st_atime = d1->stat.st_atime; @@ -1119,7 +1119,7 @@ void check_checkpoint () * parallel running threads */ -#ifdef _WIN +#if defined (_WIN) BOOL WINAPI sigHandler_default (DWORD sig) { @@ -1239,7 +1239,7 @@ void *thread_keypress (void *p) if (ch == 0) continue; //https://github.com/hashcat/hashcat/issues/302 - //#ifdef _POSIX + //#if defined (_POSIX) //if (ch != '\n') //#endif @@ -1326,7 +1326,7 @@ void *thread_keypress (void *p) } //https://github.com/hashcat/hashcat/issues/302 - //#ifdef _POSIX + //#if defined (_POSIX) //if (ch != '\n') //#endif diff --git a/src/terminal.c b/src/terminal.c index e21a09cd4..d3d6ef6eb 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -6,7 +6,7 @@ #include "common.h" #include "terminal.h" -#ifdef __linux__ +#if defined (__linux__) static struct termios savemodes; static int havemodes = 0; @@ -104,7 +104,7 @@ int tty_fix() } #endif -#ifdef _WIN +#if defined (_WIN) static DWORD saveMode = 0; int tty_break() diff --git a/src/usage.c b/src/usage.c index bb287e3ea..5f0deb69e 100644 --- a/src/usage.c +++ b/src/usage.c @@ -82,7 +82,7 @@ static const char *USAGE_BIG[] = " -u, --kernel-loops | Num | Manual workload tuning, set innerloop step size to X | -u 256", " --nvidia-spin-damp | Num | Workaround NVidias CPU burning loop bug, in percent | --nvidia-spin-damp=50", " --gpu-temp-disable | | Disable temperature and fanspeed reads and triggers |", - #ifdef HAVE_HWMON + #if defined (HAVE_HWMON) " --gpu-temp-abort | Num | Abort if GPU temperature reaches X degrees celsius | --gpu-temp-abort=100", " --gpu-temp-retain | Num | Try to retain GPU temperature at X degrees celsius | --gpu-temp-retain=95", " --powertune-enable | | Enable power tuning, restores settings when finished |",