Skip to content

Define _POSIX_C_SOURCE globally and detect supported warnings #402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion log.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 199506L
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
Expand Down
1 change: 0 additions & 1 deletion loop.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <limits.h>
#include <string.h>
#include <stdbool.h>
Expand Down
1 change: 0 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <ctype.h>
#include <errno.h>
Expand Down
20 changes: 9 additions & 11 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,18 @@ project(
],
)

add_project_arguments(
[
'-Wno-unused-parameter',
'-Wno-unused-result',
'-Wundef',
'-Wvla',
],
language: 'c',
)

cc = meson.get_compiler('c')

is_freebsd = host_machine.system().startswith('freebsd')
add_project_arguments('-D_POSIX_C_SOURCE=200809L', language: 'c')

add_project_arguments(cc.get_supported_arguments([
'-Wno-unused-parameter',
'-Wno-unused-result',
'-Wundef',
'-Wvla',
]), language: 'c')

is_freebsd = host_machine.system().startswith('freebsd')
if is_freebsd
add_project_arguments('-D_C11_SOURCE', language: 'c')
endif
Expand Down
1 change: 0 additions & 1 deletion password-buffer.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include "password-buffer.h"
#include "log.h"
#include "swaylock.h"
Expand Down
1 change: 0 additions & 1 deletion pool-buffer.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <cairo/cairo.h>
#include <errno.h>
Expand Down
1 change: 1 addition & 0 deletions shadow.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#undef _POSIX_C_SOURCE
#define _XOPEN_SOURCE // for crypt
#include <assert.h>
#include <pwd.h>
Expand Down