Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Issue 10536175: Fix to compile successfully with -Wundef (Closed)

Created:
8 years, 6 months ago by Mark Seaborn
Modified:
8 years, 6 months ago
Reviewers:
Markus (顧孟勤)
CC:
chromium-reviews
Visibility:
Public.

Description

Fix to compile successfully with -Wundef -Wundef warns about "#if FOO" when FOO is undefined. gcc warns about this even for an #if branch that is not reached (due to being excluded by an earlier #if), hence the checks before using SYS_PREFIX. BUG=http://code.google.com/p/nativeclient/issues/detail?id=2787 TEST="gcc -c linux_syscall_support.h -Wundef" on gcc 4.4.3 (Ubuntu Lucid) Committed: https://code.google.com/p/linux-syscall-support/source/detail?r=11

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+12 lines, -12 lines) Patch
M lss/linux_syscall_support.h View 2 chunks +12 lines, -12 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
Mark Seaborn
8 years, 6 months ago (2012-06-14 18:20:39 UTC) #1
Markus (顧孟勤)
8 years, 6 months ago (2012-06-14 19:34:16 UTC) #2
LGTM

On Thursday, June 14, 2012,  <mseaborn@chromium.org> wrote:
> Reviewers: Markus (顧孟勤),
>
> Description:
> Fix to compile successfully with -Wundef
>
> -Wundef warns about "#if FOO" when FOO is undefined.
>
> gcc warns about this even for an #if branch that is not reached (due
> to being excluded by an earlier #if), hence the checks before using
> SYS_PREFIX.
>
> BUG=http://code.google.com/p/nativeclient/issues/detail?id=2787
> TEST="gcc -c linux_syscall_support.h -Wundef" on gcc 4.4.3 (Ubuntu Lucid)
>
>
> Please review this at https://chromiumcodereview.appspot.com/10536175/
>
> SVN Base: https://linux-syscall-support.googlecode.com/svn/trunk
>
> Affected files:
>  M lss/linux_syscall_support.h
>
>
> Index: lss/linux_syscall_support.h
> diff --git a/lss/linux_syscall_support.h b/lss/linux_syscall_support.h
> index
7b7e59c3a4a1e437b92b2a8b06ef3a6e369bb551..82d84aa546768ad01f46080fed2a48cda59b28d1
100644
> --- a/lss/linux_syscall_support.h
> +++ b/lss/linux_syscall_support.h
> @@ -1346,7 +1346,7 @@ struct kernel_statfs {
>
>
>  /* After forking, we must make sure to only call system calls.
    */
> -#if __BOUNDED_POINTERS__
> +#if defined(__BOUNDED_POINTERS__)
>   #error "Need to port invocations of syscalls for bounded ptrs"
>  #else
>   /* The core dumper and the thread lister get executed after threads
> @@ -1379,27 +1379,27 @@ struct kernel_statfs {
>   #undef LSS_NAME
>   #ifndef SYS_PREFIX
>     #define LSS_NAME(name) sys_##name
> -  #elif SYS_PREFIX < 0
> +  #elif defined(SYS_PREFIX) && SYS_PREFIX < 0
>     #define LSS_NAME(name) name
> -  #elif SYS_PREFIX == 0
> +  #elif defined(SYS_PREFIX) && SYS_PREFIX == 0
>     #define LSS_NAME(name) sys0_##name
> -  #elif SYS_PREFIX == 1
> +  #elif defined(SYS_PREFIX) && SYS_PREFIX == 1
>     #define LSS_NAME(name) sys1_##name
> -  #elif SYS_PREFIX == 2
> +  #elif defined(SYS_PREFIX) && SYS_PREFIX == 2
>     #define LSS_NAME(name) sys2_##name
> -  #elif SYS_PREFIX == 3
> +  #elif defined(SYS_PREFIX) && SYS_PREFIX == 3
>     #define LSS_NAME(name) sys3_##name
> -  #elif SYS_PREFIX == 4
> +  #elif defined(SYS_PREFIX) && SYS_PREFIX == 4
>     #define LSS_NAME(name) sys4_##name
> -  #elif SYS_PREFIX == 5
> +  #elif defined(SYS_PREFIX) && SYS_PREFIX == 5
>     #define LSS_NAME(name) sys5_##name
> -  #elif SYS_PREFIX == 6
> +  #elif defined(SYS_PREFIX) && SYS_PREFIX == 6
>     #define LSS_NAME(name) sys6_##name
> -  #elif SYS_PREFIX == 7
> +  #elif defined(SYS_PREFIX) && SYS_PREFIX == 7
>     #define LSS_NAME(name) sys7_##name
> -  #elif SYS_PREFIX == 8
> +  #elif defined(SYS_PREFIX) && SYS_PREFIX == 8
>     #define LSS_NAME(name) sys8_##name
> -  #elif SYS_PREFIX == 9
> +  #elif defined(SYS_PREFIX) && SYS_PREFIX == 9
>     #define LSS_NAME(name) sys9_##name
>   #endif
>
>
>
>

Powered by Google App Engine
This is Rietveld 408576698