Skip to content

Commit 3ba84ee

Browse files
mx4claude
andcommitted
guard _XOPEN_SOURCE defines against redefinition
Debian's ncurses pkg-config Cflags inject -D_XOPEN_SOURCE=600 on the command line, which clashed with the hardcoded `#define _XOPEN_SOURCE 500` in file.c and poolworker.c and failed the STRICT (-Werror) build with -Wmacro-redefined. Wrap the defines in #ifndef so a stronger command-line definition wins. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent feb7363 commit 3ba84ee

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

lib/file/file.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
#ifdef linux
2+
#ifndef _XOPEN_SOURCE
23
#define _XOPEN_SOURCE 500
4+
#endif
35
// for O_DIRECT
6+
#ifndef _GNU_SOURCE
47
#define _GNU_SOURCE
58
#endif
9+
#endif
610

711
#include <stdlib.h>
812
#include <stdio.h>

lib/poolworker/poolworker.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
#ifndef _XOPEN_SOURCE
12
#define _XOPEN_SOURCE 500
3+
#endif
24
#include <stdlib.h>
35
#include <stdio.h>
46
#include <pthread.h>

0 commit comments

Comments
 (0)