libbpf-tools: Don't redefine _GNU_SOURCE to avoid redefinition warning
authorDave Marchevsky <davemarchevsky@fb.com>
Sat, 19 Jun 2021 05:52:46 +0000 (22:52 -0700)
committeryonghong-song <ys114321@gmail.com>
Sat, 19 Jun 2021 16:51:50 +0000 (09:51 -0700)
Similar to past commits like 667988ce9e2a051ff608b727f6c89a5baa01fa67,
my toolchain complains that `_GNU_SOURCE` is redefined. Let's only
define it when it passes `ifndef`

libbpf-tools/trace_helpers.c
libbpf-tools/uprobe_helpers.c

index 0e9b019..f37015e 100644 (file)
@@ -3,7 +3,9 @@
 //
 // Based on ksyms improvements from Andrii Nakryiko, add more helpers.
 // 28-Feb-2020   Wenbo Zhang   Created this.
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
index 4a627a9..9f6e3b5 100644 (file)
@@ -1,6 +1,8 @@
 // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
 /* Copyright (c) 2021 Google LLC. */
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>