* [PATCH] xfsprogs: silence unused var warnings
@ 2015-05-14 22:17 Eric Sandeen
2015-06-05 2:14 ` Dave Chinner
0 siblings, 1 reply; 2+ messages in thread
From: Eric Sandeen @ 2015-05-14 22:17 UTC (permalink / raw)
To: xfs-oss
This takes 2 different approaches, just following similar code
that already exists. It'll probably make Coverity flag
the pointless assignments, unfortunately.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
Note, this is for the libxfs-4 branch
diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
index 1b4ac64..c871d53 100644
--- a/libxfs/libxfs_priv.h
+++ b/libxfs/libxfs_priv.h
@@ -150,9 +150,9 @@ enum ce { CE_DEBUG, CE_CONT, CE_NOTE, CE_WARN, CE_ALERT, CE_PANIC };
#define XFS_TRANS_UNRESERVE_QUOTA_NBLKS(mp,tp,ip,nblks,ninos,fl) 0
#define XFS_TEST_ERROR(expr,a,b,c) ( expr )
#define XFS_WANT_CORRUPTED_GOTO(mp, expr, l) \
- { if (!(expr)) { error = EFSCORRUPTED; goto l; } }
+ { (mp) = (mp); if (!(expr)) { error = EFSCORRUPTED; goto l; } }
#define XFS_WANT_CORRUPTED_RETURN(mp, expr) \
- { if (!(expr)) { return EFSCORRUPTED; } }
+ { (mp) = (mp); if (!(expr)) { return EFSCORRUPTED; } }
#ifdef __GNUC__
#define __return_address __builtin_return_address(0)
@@ -344,7 +344,11 @@ roundup_64(__uint64_t x, __uint32_t y)
/* space allocation */
#define xfs_extent_busy_reuse(mp,ag,bno,len,user) ((void) 0)
-#define xfs_extent_busy_insert(tp,ag,bno,len,flags) ((void) 0)
+/* avoid unused variable warning */
+#define xfs_extent_busy_insert(tp,ag,bno,len,flags)({ \
+ xfs_agnumber_t __foo = ag; \
+ __foo = 0; \
+})
#define xfs_extent_busy_trim(args,fbno,flen,bno,len) \
do { \
*(bno) = (fbno); \
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] xfsprogs: silence unused var warnings
2015-05-14 22:17 [PATCH] xfsprogs: silence unused var warnings Eric Sandeen
@ 2015-06-05 2:14 ` Dave Chinner
0 siblings, 0 replies; 2+ messages in thread
From: Dave Chinner @ 2015-06-05 2:14 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs-oss
On Thu, May 14, 2015 at 05:17:54PM -0500, Eric Sandeen wrote:
> This takes 2 different approaches, just following similar code
> that already exists. It'll probably make Coverity flag
> the pointless assignments, unfortunately.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> Note, this is for the libxfs-4 branch
>
> diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
> index 1b4ac64..c871d53 100644
> --- a/libxfs/libxfs_priv.h
> +++ b/libxfs/libxfs_priv.h
> @@ -150,9 +150,9 @@ enum ce { CE_DEBUG, CE_CONT, CE_NOTE, CE_WARN, CE_ALERT, CE_PANIC };
> #define XFS_TRANS_UNRESERVE_QUOTA_NBLKS(mp,tp,ip,nblks,ninos,fl) 0
> #define XFS_TEST_ERROR(expr,a,b,c) ( expr )
> #define XFS_WANT_CORRUPTED_GOTO(mp, expr, l) \
> - { if (!(expr)) { error = EFSCORRUPTED; goto l; } }
> + { (mp) = (mp); if (!(expr)) { error = EFSCORRUPTED; goto l; } }
> #define XFS_WANT_CORRUPTED_RETURN(mp, expr) \
> - { if (!(expr)) { return EFSCORRUPTED; } }
> + { (mp) = (mp); if (!(expr)) { return EFSCORRUPTED; } }
>
> #ifdef __GNUC__
> #define __return_address __builtin_return_address(0)
> @@ -344,7 +344,11 @@ roundup_64(__uint64_t x, __uint32_t y)
>
> /* space allocation */
> #define xfs_extent_busy_reuse(mp,ag,bno,len,user) ((void) 0)
> -#define xfs_extent_busy_insert(tp,ag,bno,len,flags) ((void) 0)
> +/* avoid unused variable warning */
> +#define xfs_extent_busy_insert(tp,ag,bno,len,flags)({ \
> + xfs_agnumber_t __foo = ag; \
> + __foo = 0; \
> +})
libxfs_priv.h:349:17: warning: variable '__foo' set but not used [-Wunused-but-set-variable]
xfs_agnumber_t __foo = ag; \
so I changed the second line to __foo = __foo; to get rid of this
warning, as several of the other macros in that file do.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-05 2:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-14 22:17 [PATCH] xfsprogs: silence unused var warnings Eric Sandeen
2015-06-05 2:14 ` Dave Chinner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox