Re: [PATCH] build: fix pointer arithmetic problem



On Wed, 2012-08-01 at 17:14 +0800, Weiping Pan wrote:
> Commit bb363997edf9(build: add some more build-time warnings) triggers two
> build errors.

Thanks, got fixed in git earlier.

Dan

> 1 -Wmissing-include-dirs
> cc1: error: ../marshallers: No such file or directory [-Werror]
> cc1: all warnings being treated as errors
> 
> When I remove "-Wmissing-include-dirs", the error disappears.
> But I do not know why "../marshallers" is not created.
> 
> 2 -Wpointer-arith
> nm-logging.c: In function 'fallback_get_backtrace':
> nm-logging.c:264:31: error: pointer of type 'void *' used in subtraction
> [-Werror=pointer-arith]
> nm-logging.c:270:31: error: pointer of type 'void *' used in subtraction
> [-Werror=pointer-arith]
> cc1: all warnings being treated as errors
> 
> Signed-off-by: Weiping Pan <wpan redhat com>
> ---
>  m4/compiler_warnings.m4  |    2 +-
>  src/logging/nm-logging.c |    4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/m4/compiler_warnings.m4 b/m4/compiler_warnings.m4
> index 3037c58..7353f86 100644
> --- a/m4/compiler_warnings.m4
> +++ b/m4/compiler_warnings.m4
> @@ -13,7 +13,7 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
>  		      -fno-strict-aliasing -Wno-unused-but-set-variable \
>  		      -Wundef -Wimplicit-function-declaration \
>  		      -Wpointer-arith -Winit-self \
> -		      -Wmissing-include-dirs -Waggregate-return; do
> +		      -Waggregate-return; do
>  		SAVE_CFLAGS="$CFLAGS"
>  		CFLAGS="$CFLAGS $option"
>  		AC_MSG_CHECKING([whether gcc understands $option])
> diff --git a/src/logging/nm-logging.c b/src/logging/nm-logging.c
> index f54adcd..660990b 100644
> --- a/src/logging/nm-logging.c
> +++ b/src/logging/nm-logging.c
> @@ -261,13 +261,13 @@ fallback_get_backtrace (void)
>  			syslog (LOG_CRIT, "Frame %d: %s (%s+0x%lx) [%p]",
>  			        i, name,
>  			        info.dli_sname,
> -			        (gulong)(frames[i] - info.dli_saddr),
> +			        (gulong)frames[i] - (gulong)info.dli_saddr,
>  			        frames[i]);
>  		} else {
>  			syslog (LOG_CRIT, "Frame %d: %s (%p+0x%lx) [%p]",
>  			        i, name,
>  			        info.dli_fbase,
> -			        (gulong)(frames[i] - info.dli_saddr),
> +			        (gulong)frames[i] - (gulong)info.dli_saddr,
>  			        frames[i]);
>  		}
>  	}




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]