Message ID | 20190924181910.23588-2-skhan@linuxfoundation.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | selftests: proc: Fix _GNU_SOURCE redefined build warns | expand |
On Tue, Sep 24, 2019 at 12:19:10PM -0600, Shuah Khan wrote: > 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 > +#ifndef _GNU_SOURCE > #define _GNU_SOURCE > +#endif Why are you doing this. There are 140 redefinitions of _GNU_SOURCE
On 9/24/19 1:52 PM, Alexey Dobriyan wrote: > On Tue, Sep 24, 2019 at 12:19:10PM -0600, Shuah Khan wrote: >> 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 > >> +#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
diff --git a/tools/testing/selftests/proc/proc-loadavg-001.c b/tools/testing/selftests/proc/proc-loadavg-001.c index 471e2aa28077..e29326a708e4 100644 --- a/tools/testing/selftests/proc/proc-loadavg-001.c +++ b/tools/testing/selftests/proc/proc-loadavg-001.c @@ -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> diff --git a/tools/testing/selftests/proc/proc-self-syscall.c b/tools/testing/selftests/proc/proc-self-syscall.c index 9f6d000c0245..6a01448df035 100644 --- a/tools/testing/selftests/proc/proc-self-syscall.c +++ b/tools/testing/selftests/proc/proc-self-syscall.c @@ -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> diff --git a/tools/testing/selftests/proc/proc-uptime-002.c b/tools/testing/selftests/proc/proc-uptime-002.c index 30e2b7849089..35eec74540ae 100644 --- a/tools/testing/selftests/proc/proc-uptime-002.c +++ b/tools/testing/selftests/proc/proc-uptime-002.c @@ -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>
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 Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> --- 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(+)