I've discovered a gap in POSIX compliance in lib/sh/strftime.c on the devel 
branch. POSIX mandates that the timeval struct be defined in <sys/time.h>, 
although as can be seen on Line 67 of the file in question, the file is only 
included here if the tm struct -- which POSIX mandates be defined in <time.h> 
-- is defined in <sys/time.h>.

The libc implementation I'm working with defines timeval in <sys/time.h> and tm 
in <time.h> as mandated by POSIX so here I encounter a compile failure on Line 
193.

../../../bash-5.1/lib/sh/strftime.c: In function ‘strftime’:
../../../bash-5.1/lib/sh/strftime.c:193:17: error: storage size of ‘tv’ isn’t 
known
  struct timeval tv;
                 ^~

Please correct me if I'm wrong as I may have missed something in the POSIX spec 
that results in the definition of timeval being available from another header, 
although I believe that the fix for this should be to move the <sys/time.h> 
include on Line 69 outside the enclosing #if guard, as it should always be 
required for POSIX compliance.

Reply via email to