Skip to contentSkip to conversation

selftests: execveat: Fix _GNU_SOURCE redefined build warn

PATCH New Shuah Khan 2 participants 4 messages Sep 24, 2019

Subsystems (4)
lore
Share & tools
lore

Shuah Khan

author maintainer
#0 lore raw

PATCH v2 1/1 selftests: execveat: Fix _GNU_SOURCE redefined build warn

Fix the following _GNU_SOURCE redefined build warn:

execveat.c:8: warning: "_GNU_SOURCE" redefined

---
No code changes. Sending to right people.

 tools/testing/selftests/exec/execveat.c | 2 ++
 1 file changed, 2 insertions(+)
tools/testing/selftests/exec/execveat.c +2 -0
index cbb6efbdb786..045a3794792a 100644
@@ -5,7 +5,9 @@
  * Selftests for execveat(2).
  */
 
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE  /* to get O_PATH, AT_EMPTY_PATH */
+#endif
 #include <sys/sendfile.h>
 #include <sys/stat.h>
 #include <sys/syscall.h>
Signature · 1 line
2.20.1
author maintainer
#1 lore raw

PATCH 1/1 selftests: proc: Fix _GNU_SOURCE redefined build warns

Fix the following _GNU_SOURCE redefined build warns:

proc-loadavg-001.c:17: warning: "_GNU_SOURCE" redefined proc-self-syscall.c:16: warning: "_GNU_SOURCE" redefined proc-uptime-002.c:18: warning: "_GNU_SOURCE" redefined

---
 tools/testing/selftests/proc/proc-loadavg-001.c  | 2 ++
 tools/testing/selftests/proc/proc-self-syscall.c | 2 ++
 tools/testing/selftests/proc/proc-uptime-002.c   | 2 ++
 3 files changed, 6 insertions(+)
tools/testing/selftests/proc/proc-loadavg-001.c +2 -0
index 471e2aa28077..e29326a708e4 100644
@@ -14,7 +14,9 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 /* Test that /proc/loadavg correctly reports last pid in pid namespace. */
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
 #include <errno.h>
 #include <sched.h>
 #include <sys/types.h>
tools/testing/selftests/proc/proc-self-syscall.c +2 -0
index 9f6d000c0245..6a01448df035 100644
@@ -13,7 +13,9 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
 #include <unistd.h>
 #include <sys/syscall.h>
 #include <sys/types.h>
tools/testing/selftests/proc/proc-uptime-002.c +2 -0
index 30e2b7849089..35eec74540ae 100644
@@ -15,7 +15,9 @@
  */
 // Test that values in /proc/uptime increment monotonically
 // while shifting across CPUs.
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
 #undef NDEBUG
 #include <assert.h>
 #include <unistd.h>
Signature · 1 line
2.20.1
#2 lore raw

Re: [PATCH] selftests: proc: Fix _GNU_SOURCE redefined build warns

tools/testing/selftests/proc/proc-loadavg-001.c line 19

Quoted 9 lines · Shuah Khan

Fix the following _GNU_SOURCE redefined build warns:

proc-loadavg-001.c:17: warning: "_GNU_SOURCE" redefined proc-self-syscall.c:16: warning: "_GNU_SOURCE" redefined proc-uptime-002.c:18: warning: "_GNU_SOURCE" redefined

tools/testing/selftests/proc/proc-loadavg-001.c +2 -0
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif

Why are you doing this.

There are 140 redefinitions of _GNU_SOURCE

author maintainer
#3 lore raw

Re: [PATCH] selftests: proc: Fix _GNU_SOURCE redefined build warns

Quoted 7 lines · Alexey Dobriyan
Quoted 5 lines · Shuah Khan

Fix the following _GNU_SOURCE redefined build warns:

proc-loadavg-001.c:17: warning: "_GNU_SOURCE" redefined proc-self-syscall.c:16: warning: "_GNU_SOURCE" redefined proc-uptime-002.c:18: warning: "_GNU_SOURCE" redefined

Quoted 8 lines

tools/testing/selftests/proc/proc-loadavg-001.c line 19

Quoted 3 lines
tools/testing/selftests/proc/proc-loadavg-001.c +2 -0
+#ifndef _GNU_SOURCE
  #define _GNU_SOURCE
+#endif

Why are you doing this.

There are 140 redefinitions of _GNU_SOURCE

Is there something wrong with getting rid of this warning?

thanks,
-- Shuah