# HG changeset patch # User Eric Blake # Date 1514929767 21600 # Node ID 372b243eb18650d646462846fa91d53207f7ba54 # Parent 924a6b819cf55661ba66e7888cb7218116e07865 stat-time: silence -Wunused-parameter regression Commit 2c5d5587 causes warnings on non-Sun systems when compiled under -Wunused-parameter; we've previously tweaked code in commit 81eb8486 to avoid such warnings. Prefer an attribute rather than a cast to void (the attribute is always okay to apply; gcc interprets it as 'may be unused', not 'must not be used', precisely to cater to #if chains where determining whether or not the parameter is used gets hairy). * lib/stat-time.h (get_stat_birthtime_ns, get_stat_birthtime): Prefer attribute over cast-to-void. (stat_time_normalize): Mark st as potentially unused. Signed-off-by: Eric Blake diff -r 924a6b819cf5 -r 372b243eb186 ChangeLog --- a/ChangeLog Tue Jan 02 19:05:05 2018 -0800 +++ b/ChangeLog Tue Jan 02 15:49:27 2018 -0600 @@ -1,3 +1,10 @@ +2018-01-02 Eric Blake + + stat-time: silence -Wunused-parameter regression + * lib/stat-time.h (get_stat_birthtime_ns, get_stat_birthtime): + Prefer attribute over cast-to-void. + (stat_time_normalize): Mark st as potentially unused. + 2018-01-02 Paul Eggert test-framework-sh: avoid netstat diff -r 924a6b819cf5 -r 372b243eb186 lib/stat-time.h --- a/lib/stat-time.h Tue Jan 02 19:05:05 2018 -0800 +++ b/lib/stat-time.h Tue Jan 02 15:49:27 2018 -0600 @@ -102,15 +102,13 @@ /* Return the nanosecond component of *ST's birth time. */ _GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE -get_stat_birthtime_ns (struct stat const *st) +get_stat_birthtime_ns (struct stat const *st _GL_UNUSED) { # if defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC return STAT_TIMESPEC (st, st_birthtim).tv_nsec; # elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC return STAT_TIMESPEC_NS (st, st_birthtim); # else - /* Avoid a "parameter unused" warning. */ - (void) st; return 0; # endif } @@ -160,7 +158,7 @@ /* Return *ST's birth time, if available; otherwise return a value with tv_sec and tv_nsec both equal to -1. */ _GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE -get_stat_birthtime (struct stat const *st) +get_stat_birthtime (struct stat const *st _GL_UNUSED) { struct timespec t; @@ -184,8 +182,6 @@ /* Birth time is not supported. */ t.tv_sec = -1; t.tv_nsec = -1; - /* Avoid a "parameter unused" warning. */ - (void) st; #endif #if (defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC \ @@ -212,7 +208,7 @@ errno to EOVERFLOW if normalization overflowed. This function is intended to be private to this .h file. */ _GL_STAT_TIME_INLINE int -stat_time_normalize (int result, struct stat *st) +stat_time_normalize (int result, struct stat *st _GL_UNUSED) { #if defined __sun && defined STAT_TIMESPEC if (result == 0)