From 3a310f92ab619cf8afcb99486bc91b49c7989791 Mon Sep 17 00:00:00 2001 From: emersion Date: Sun, 25 Nov 2018 12:12:48 +0100 Subject: [PATCH] Replace _XOPEN_SOURCE with _POSIX_C_SOURCE And make sure we don't define both in the same source file. --- common/stringop.c | 2 +- sway/commands/assign.c | 2 +- sway/commands/bar/bindsym.c | 1 - sway/commands/bar/hidden_state.c | 2 +- sway/commands/bar/icon_theme.c | 1 - sway/commands/bar/id.c | 2 +- sway/commands/bar/mode.c | 2 +- sway/commands/bar/output.c | 2 +- sway/commands/bar/separator_symbol.c | 2 +- sway/commands/bar/tray_output.c | 1 - sway/commands/bind.c | 2 +- sway/commands/exec_always.c | 2 +- sway/commands/for_window.c | 1 - sway/commands/input/xkb_layout.c | 2 +- sway/commands/input/xkb_model.c | 2 +- sway/commands/input/xkb_options.c | 2 +- sway/commands/input/xkb_rules.c | 2 +- sway/commands/input/xkb_variant.c | 2 +- sway/commands/mode.c | 2 +- sway/commands/move.c | 2 +- sway/commands/no_focus.c | 1 - sway/commands/reload.c | 2 +- sway/commands/rename.c | 1 - sway/commands/seat/attach.c | 2 +- sway/commands/seat/cursor.c | 2 +- sway/commands/set.c | 2 +- sway/commands/workspace.c | 4 ++-- sway/config.c | 3 +-- sway/config/bar.c | 1 - sway/config/input.c | 2 +- sway/config/output.c | 2 +- sway/config/seat.c | 2 +- sway/criteria.c | 2 +- sway/input/cursor.c | 2 +- sway/input/input-manager.c | 2 +- sway/input/seat.c | 3 +-- sway/main.c | 3 +-- sway/security.c | 2 +- swaybar/bar.c | 2 +- swaybar/config.c | 2 +- swaybar/main.c | 2 +- swaylock/main.c | 3 +-- swaylock/pam.c | 2 +- swaylock/password.c | 1 - swaylock/render.c | 1 - swaylock/shadow.c | 2 +- swaymsg/main.c | 2 +- swaynag/config.c | 4 +--- swaynag/main.c | 3 +-- swaynag/swaynag.c | 2 +- swaynag/types.c | 2 +- 51 files changed, 43 insertions(+), 59 deletions(-) diff --git a/common/stringop.c b/common/stringop.c index d2c91c249..df016e9df 100644 --- a/common/stringop.c +++ b/common/stringop.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 700 +#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/sway/commands/assign.c b/sway/commands/assign.c index 04582e881..716d70cf7 100644 --- a/sway/commands/assign.c +++ b/sway/commands/assign.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 700 +#define _POSIX_C_SOURCE 200809L #include #include #include "sway/commands.h" diff --git a/sway/commands/bar/bindsym.c b/sway/commands/bar/bindsym.c index 965c8903a..e6d6220e1 100644 --- a/sway/commands/bar/bindsym.c +++ b/sway/commands/bar/bindsym.c @@ -1,4 +1,3 @@ -#define _XOPEN_SOURCE 500 #include #include #include diff --git a/sway/commands/bar/hidden_state.c b/sway/commands/bar/hidden_state.c index 5be6c2dc0..79eaf01cd 100644 --- a/sway/commands/bar/hidden_state.c +++ b/sway/commands/bar/hidden_state.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _POSIX_C_SOURCE 200809L #include #include #include "sway/commands.h" diff --git a/sway/commands/bar/icon_theme.c b/sway/commands/bar/icon_theme.c index 44cd3076c..0e30409ba 100644 --- a/sway/commands/bar/icon_theme.c +++ b/sway/commands/bar/icon_theme.c @@ -1,4 +1,3 @@ -#define _XOPEN_SOURCE 500 #include #include "sway/commands.h" diff --git a/sway/commands/bar/id.c b/sway/commands/bar/id.c index 7690a852e..355094591 100644 --- a/sway/commands/bar/id.c +++ b/sway/commands/bar/id.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _POSIX_C_SOURCE 200809L #include #include "sway/commands.h" #include "log.h" diff --git a/sway/commands/bar/mode.c b/sway/commands/bar/mode.c index 2cba785e8..dcaf6da99 100644 --- a/sway/commands/bar/mode.c +++ b/sway/commands/bar/mode.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _POSIX_C_SOURCE 200809L #include #include #include "sway/commands.h" diff --git a/sway/commands/bar/output.c b/sway/commands/bar/output.c index 72754e055..930d779d9 100644 --- a/sway/commands/bar/output.c +++ b/sway/commands/bar/output.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _POSIX_C_SOURCE 200809L #include #include #include "sway/commands.h" diff --git a/sway/commands/bar/separator_symbol.c b/sway/commands/bar/separator_symbol.c index 392ab730e..060b8f526 100644 --- a/sway/commands/bar/separator_symbol.c +++ b/sway/commands/bar/separator_symbol.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _POSIX_C_SOURCE 200809L #include #include "sway/commands.h" #include "log.h" diff --git a/sway/commands/bar/tray_output.c b/sway/commands/bar/tray_output.c index 6ab167313..e6c77128c 100644 --- a/sway/commands/bar/tray_output.c +++ b/sway/commands/bar/tray_output.c @@ -1,4 +1,3 @@ -#define _XOPEN_SOURCE 500 #include #include "sway/commands.h" diff --git a/sway/commands/bind.c b/sway/commands/bind.c index a9de227f9..08acbe7a5 100644 --- a/sway/commands/bind.c +++ b/sway/commands/bind.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _POSIX_C_SOURCE 200809L #ifdef __linux__ #include #elif __FreeBSD__ diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c index 7a15709bd..9ec28d81f 100644 --- a/sway/commands/exec_always.c +++ b/sway/commands/exec_always.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/sway/commands/for_window.c b/sway/commands/for_window.c index ac4d6563a..7c0f7d7ff 100644 --- a/sway/commands/for_window.c +++ b/sway/commands/for_window.c @@ -1,4 +1,3 @@ -#define _XOPEN_SOURCE 500 #include #include "sway/commands.h" #include "sway/criteria.h" diff --git a/sway/commands/input/xkb_layout.c b/sway/commands/input/xkb_layout.c index 5fccd4a31..431664013 100644 --- a/sway/commands/input/xkb_layout.c +++ b/sway/commands/input/xkb_layout.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 700 +#define _POSIX_C_SOURCE 200809L #include "sway/config.h" #include "sway/commands.h" #include "sway/input/input-manager.h" diff --git a/sway/commands/input/xkb_model.c b/sway/commands/input/xkb_model.c index c4d046380..066f632b7 100644 --- a/sway/commands/input/xkb_model.c +++ b/sway/commands/input/xkb_model.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 700 +#define _POSIX_C_SOURCE 200809L #include "sway/config.h" #include "sway/commands.h" #include "sway/input/input-manager.h" diff --git a/sway/commands/input/xkb_options.c b/sway/commands/input/xkb_options.c index 794ab6e91..09dc4a5c7 100644 --- a/sway/commands/input/xkb_options.c +++ b/sway/commands/input/xkb_options.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 700 +#define _POSIX_C_SOURCE 200809L #include "sway/config.h" #include "sway/commands.h" #include "sway/input/input-manager.h" diff --git a/sway/commands/input/xkb_rules.c b/sway/commands/input/xkb_rules.c index 257c3288a..d3e576e69 100644 --- a/sway/commands/input/xkb_rules.c +++ b/sway/commands/input/xkb_rules.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 700 +#define _POSIX_C_SOURCE 200809L #include "sway/config.h" #include "sway/commands.h" #include "sway/input/input-manager.h" diff --git a/sway/commands/input/xkb_variant.c b/sway/commands/input/xkb_variant.c index 3832dc8e1..2d7581d14 100644 --- a/sway/commands/input/xkb_variant.c +++ b/sway/commands/input/xkb_variant.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 700 +#define _POSIX_C_SOURCE 200809L #include "sway/config.h" #include "sway/commands.h" #include "sway/input/input-manager.h" diff --git a/sway/commands/mode.c b/sway/commands/mode.c index 637ca45ec..189e3c1a2 100644 --- a/sway/commands/mode.c +++ b/sway/commands/mode.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/sway/commands/move.c b/sway/commands/move.c index 7d8c1f1ac..240b9f040 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/sway/commands/no_focus.c b/sway/commands/no_focus.c index 61a8de7e7..cb81a4453 100644 --- a/sway/commands/no_focus.c +++ b/sway/commands/no_focus.c @@ -1,4 +1,3 @@ -#define _XOPEN_SOURCE 500 #include #include "sway/commands.h" #include "sway/criteria.h" diff --git a/sway/commands/reload.c b/sway/commands/reload.c index 62105cdcb..c64de4bd8 100644 --- a/sway/commands/reload.c +++ b/sway/commands/reload.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _POSIX_C_SOURCE 200809L #include #include "sway/commands.h" #include "sway/config.h" diff --git a/sway/commands/rename.c b/sway/commands/rename.c index 0cee9293f..29f90d81c 100644 --- a/sway/commands/rename.c +++ b/sway/commands/rename.c @@ -1,4 +1,3 @@ -#define _XOPEN_SOURCE 500 #include #include #include diff --git a/sway/commands/seat/attach.c b/sway/commands/seat/attach.c index 6b4bcf1ff..8d646c2d1 100644 --- a/sway/commands/seat/attach.c +++ b/sway/commands/seat/attach.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 700 +#define _POSIX_C_SOURCE 200809L #include #include #include "sway/input/input-manager.h" diff --git a/sway/commands/seat/cursor.c b/sway/commands/seat/cursor.c index 1d41a94e6..495c23382 100644 --- a/sway/commands/seat/cursor.c +++ b/sway/commands/seat/cursor.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 700 +#define _POSIX_C_SOURCE 200809L #ifdef __linux__ #include #elif __FreeBSD__ diff --git a/sway/commands/set.c b/sway/commands/set.c index be51230bd..d912e4fd2 100644 --- a/sway/commands/set.c +++ b/sway/commands/set.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 700 +#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c index 92118ecfa..7d32e65b3 100644 --- a/sway/commands/workspace.c +++ b/sway/commands/workspace.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _POSIX_C_SOURCE 200809L #include #include #include @@ -38,7 +38,7 @@ void free_workspace_config(struct workspace_config *wsc) { } static void prevent_invalid_outer_gaps(struct workspace_config *wsc) { - if (wsc->gaps_outer.top != INT_MIN && + if (wsc->gaps_outer.top != INT_MIN && wsc->gaps_outer.top < -wsc->gaps_inner) { wsc->gaps_outer.top = -wsc->gaps_inner; } diff --git a/sway/config.c b/sway/config.c index 59edc6d8b..da40ace65 100644 --- a/sway/config.c +++ b/sway/config.c @@ -1,5 +1,4 @@ -#define _POSIX_C_SOURCE 200809L -#define _XOPEN_SOURCE 700 +#define _XOPEN_SOURCE 600 // for realpath #include #include #include diff --git a/sway/config/bar.c b/sway/config/bar.c index 7009d0a08..36e10527e 100644 --- a/sway/config/bar.c +++ b/sway/config/bar.c @@ -1,5 +1,4 @@ #define _POSIX_C_SOURCE 200809L -#define _XOPEN_SOURCE 700 #include #include #include diff --git a/sway/config/input.c b/sway/config/input.c index d5d2d90b4..d649d34d0 100644 --- a/sway/config/input.c +++ b/sway/config/input.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 700 +#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/sway/config/output.c b/sway/config/output.c index 07543e3cf..753092898 100644 --- a/sway/config/output.c +++ b/sway/config/output.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 700 +#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/sway/config/seat.c b/sway/config/seat.c index 46456cafa..56fa60958 100644 --- a/sway/config/seat.c +++ b/sway/config/seat.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 700 +#define _POSIX_C_SOURCE 200809L #include #include #include "sway/config.h" diff --git a/sway/criteria.c b/sway/criteria.c index 3393852c7..54583b04e 100644 --- a/sway/criteria.c +++ b/sway/criteria.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 700 +#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/sway/input/cursor.c b/sway/input/cursor.c index d89f64d87..14e257263 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 700 +#define _POSIX_C_SOURCE 200809L #include #ifdef __linux__ #include diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index 68445d681..89146d5b9 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 700 +#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/sway/input/seat.c b/sway/input/seat.c index 663c5140d..53fb2ed7f 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -1,5 +1,4 @@ -#define _XOPEN_SOURCE 700 -#define _POSIX_C_SOURCE 199309L +#define _POSIX_C_SOURCE 200809L #include #include #ifdef __linux__ diff --git a/sway/main.c b/sway/main.c index 920cea11c..a21970e21 100644 --- a/sway/main.c +++ b/sway/main.c @@ -1,5 +1,4 @@ -#define _XOPEN_SOURCE 700 -#define _POSIX_C_SOURCE 200112L +#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/sway/security.c b/sway/security.c index cc0d3f661..6a00229ed 100644 --- a/sway/security.c +++ b/sway/security.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 700 +#define _POSIX_C_SOURCE 200809L #include #include #include "sway/security.h" diff --git a/swaybar/bar.c b/swaybar/bar.c index 2178f542f..47c89a390 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/swaybar/config.c b/swaybar/config.c index 0ab346b15..16febb2ee 100644 --- a/swaybar/config.c +++ b/swaybar/config.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/swaybar/main.c b/swaybar/main.c index 2672abefc..06238c629 100644 --- a/swaybar/main.c +++ b/swaybar/main.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/swaylock/main.c b/swaylock/main.c index 9b74b6715..50f145e36 100644 --- a/swaylock/main.c +++ b/swaylock/main.c @@ -1,5 +1,4 @@ -#define _XOPEN_SOURCE 700 -#define _POSIX_C_SOURCE 200112L +#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/swaylock/pam.c b/swaylock/pam.c index cac95a851..b90d9e876 100644 --- a/swaylock/pam.c +++ b/swaylock/pam.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/swaylock/password.c b/swaylock/password.c index 6138e1fef..db8ecaeb2 100644 --- a/swaylock/password.c +++ b/swaylock/password.c @@ -1,4 +1,3 @@ -#define _XOPEN_SOURCE 500 #include #include #include diff --git a/swaylock/render.c b/swaylock/render.c index fa8832bd1..cbd5d01d9 100644 --- a/swaylock/render.c +++ b/swaylock/render.c @@ -1,4 +1,3 @@ -#define _POSIX_C_SOURCE 199506L #include #include #include diff --git a/swaylock/shadow.c b/swaylock/shadow.c index f928eaa3a..b7b10a671 100644 --- a/swaylock/shadow.c +++ b/swaylock/shadow.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE +#define _XOPEN_SOURCE // for crypt #include #include #include diff --git a/swaymsg/main.c b/swaymsg/main.c index 243b5fdc3..e640cadfb 100644 --- a/swaymsg/main.c +++ b/swaymsg/main.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/swaynag/config.c b/swaynag/config.c index cd34dcc2b..63808ce4a 100644 --- a/swaynag/config.c +++ b/swaynag/config.c @@ -1,5 +1,4 @@ -#define _XOPEN_SOURCE 700 -#define _POSIX_C_SOURCE 200112L +#define _POSIX_C_SOURCE 200809L #include #include #include @@ -398,4 +397,3 @@ int swaynag_load_config(char *path, struct swaynag *swaynag, list_t *types) { fclose(config); return 0; } - diff --git a/swaynag/main.c b/swaynag/main.c index bae3c0e2b..9f00ac7e0 100644 --- a/swaynag/main.c +++ b/swaynag/main.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _POSIX_C_SOURCE 200809L #include #include #include "log.h" @@ -130,4 +130,3 @@ cleanup: swaynag_destroy(&swaynag); return exit_code; } - diff --git a/swaynag/swaynag.c b/swaynag/swaynag.c index 06185f204..74e127b6c 100644 --- a/swaynag/swaynag.c +++ b/swaynag/swaynag.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _POSIX_C_SOURCE 200809L #include #include #include diff --git a/swaynag/types.c b/swaynag/types.c index 1e0a138b4..129644b7a 100644 --- a/swaynag/types.c +++ b/swaynag/types.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _POSIX_C_SOURCE 200809L #include #include #include