fix some -Wundef warnings

Message ID 549DF741.7020903@ezchip.com
State Committed
Headers

Commit Message

Chris Metcalf Dec. 27, 2014, 12:03 a.m. UTC
  While I was fixing -Werror warnings I noticed a couple that haven't
yet become fatal (since we are waiting on -Wundef to be added) but I
figured I might as well fix them.  Any reason not to commit these?
They both seem very straightforward.

2014-12-26  Chris Metcalf  <cmetcalf@ezchip.com>

         * sysdeps/unix/sysv/linux/tst-setgetname.c (do_test): Use #ifndef
         instead of #if to avoid a Wundef warning.
         * stdlib/tst-limits.c (do_test): Likewise.
  

Comments

Siddhesh Poyarekar Dec. 30, 2014, 3:18 a.m. UTC | #1
On Fri, Dec 26, 2014 at 07:03:13PM -0500, Chris Metcalf wrote:
> While I was fixing -Werror warnings I noticed a couple that haven't
> yet become fatal (since we are waiting on -Wundef to be added) but I
> figured I might as well fix them.  Any reason not to commit these?
> They both seem very straightforward.
> 
> 2014-12-26  Chris Metcalf  <cmetcalf@ezchip.com>
> 
>         * sysdeps/unix/sysv/linux/tst-setgetname.c (do_test): Use #ifndef
>         instead of #if to avoid a Wundef warning.
>         * stdlib/tst-limits.c (do_test): Likewise.

Looks OK to me.

Siddhesh

> 
> diff --git a/sysdeps/unix/sysv/linux/tst-setgetname.c b/sysdeps/unix/sysv/linux/tst-setgetname.c
> index f5693e26c422..7799ebe57bc3 100644
> --- a/sysdeps/unix/sysv/linux/tst-setgetname.c
> +++ b/sysdeps/unix/sysv/linux/tst-setgetname.c
> @@ -101,7 +101,7 @@ do_test (int argc, char **argv)
>      {
>        res = get_self_comm (gettid (), name_check, TASK_COMM_LEN);
> 
> -#if !__ASSUME_PROC_PID_TASK_COMM
> +#ifndef __ASSUME_PROC_PID_TASK_COMM
>        /* On this first test we look for ENOENT to be returned from
>           get_self_comm to indicate that the kernel is older than
>           2.6.33 and doesn't contain comm within the proc structure.
> diff --git a/stdlib/tst-limits.c b/stdlib/tst-limits.c
> index 6e51dcadb5ba..9aabc360f6b8 100644
> --- a/stdlib/tst-limits.c
> +++ b/stdlib/tst-limits.c
> @@ -58,7 +58,7 @@ do_test (void)
>    /* Values from POSIX and Unix.  */
>  #ifdef PAGESIZE
>    TEST (PAGESIZE, "d", getpagesize ());
> -#elif PAGE_SIZE
> +#elif defined (PAGE_SIZE)
>    TEST (PAGE_SIZE, "d", getpagesize ());
>  #endif
> 
> -- 
> Chris Metcalf, EZChip Semiconductor
> http://www.ezchip.com
>
  
Chris Metcalf Dec. 30, 2014, 4:15 a.m. UTC | #2
On 12/29/2014 10:18 PM, Siddhesh Poyarekar wrote:
> On Fri, Dec 26, 2014 at 07:03:13PM -0500, Chris Metcalf wrote:
>> >While I was fixing -Werror warnings I noticed a couple that haven't
>> >yet become fatal (since we are waiting on -Wundef to be added) but I
>> >figured I might as well fix them.  Any reason not to commit these?
>> >They both seem very straightforward.
>> >
>> >2014-12-26  Chris Metcalf<cmetcalf@ezchip.com>
>> >
>> >         * sysdeps/unix/sysv/linux/tst-setgetname.c (do_test): Use #ifndef
>> >         instead of #if to avoid a Wundef warning.
>> >         * stdlib/tst-limits.c (do_test): Likewise.
> Looks OK to me.

Thanks!  Pushed.
  

Patch

diff --git a/sysdeps/unix/sysv/linux/tst-setgetname.c b/sysdeps/unix/sysv/linux/tst-setgetname.c
index f5693e26c422..7799ebe57bc3 100644
--- a/sysdeps/unix/sysv/linux/tst-setgetname.c
+++ b/sysdeps/unix/sysv/linux/tst-setgetname.c
@@ -101,7 +101,7 @@  do_test (int argc, char **argv)
      {
        res = get_self_comm (gettid (), name_check, TASK_COMM_LEN);

-#if !__ASSUME_PROC_PID_TASK_COMM
+#ifndef __ASSUME_PROC_PID_TASK_COMM
        /* On this first test we look for ENOENT to be returned from
           get_self_comm to indicate that the kernel is older than
           2.6.33 and doesn't contain comm within the proc structure.
diff --git a/stdlib/tst-limits.c b/stdlib/tst-limits.c
index 6e51dcadb5ba..9aabc360f6b8 100644
--- a/stdlib/tst-limits.c
+++ b/stdlib/tst-limits.c
@@ -58,7 +58,7 @@  do_test (void)
    /* Values from POSIX and Unix.  */
  #ifdef PAGESIZE
    TEST (PAGESIZE, "d", getpagesize ());
-#elif PAGE_SIZE
+#elif defined (PAGE_SIZE)
    TEST (PAGE_SIZE, "d", getpagesize ());
  #endif