[Bug time/25026] New: Internal use of __itimer_which_t causing warnings/errors in POSIX-compliant code

pskocik at gmail dot com sourceware-bugzilla@sourceware.org
Sun Sep 22 12:39:00 GMT 2019


https://sourceware.org/bugzilla/show_bug.cgi?id=25026

            Bug ID: 25026
           Summary: Internal use of __itimer_which_t causing
                    warnings/errors in POSIX-compliant code
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: time
          Assignee: unassigned at sourceware dot org
          Reporter: pskocik at gmail dot com
  Target Milestone: ---

Example (https://gcc.godbolt.org/z/8aqy17):

#define _GNU_SOURCE
#include <sys/time.h>
int (*g)(int, struct itimerval *) = &getitimer; //OK unless _GNU_SOURCE
int (*s)(int, struct itimerval const*, struct itimerval) = &setitimer; //fails
even without _GNU_SOURCE, but shouldn't

int main()
{
        extern int which_itimer;

        //-Wsign-conversion warning when compiled with `clang -D_GNU_SOURCE -c`
        setitimer(which_itimer,&(struct itimerval){0},0);
}

Given a fixed set of CLI flags (-D_GNU_SOURCE -Wsign-conversion), these
warnings cannot be portably silenced from inside a source file as
__itimer_which_t isn't a standardized POSIX type that one could cast an int to
and C doesn't allow one to obtain this type from the type of
getitimer/setitimer.

Perhaps just use int?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list