develooper Front page | perl.perl5.porters | Postings from June 2016

[perl #128359] Cygwin: Warning: assignment discards 'const'qualifier (S_copy_little_tm_to_big_TM)

Dan Collins
June 10, 2016 00:23
[perl #128359] Cygwin: Warning: assignment discards 'const'qualifier (S_copy_little_tm_to_big_TM)
Message ID:
# New Ticket Created by  Dan Collins 
# Please include the string:  [perl #128359]
# in the subject line of all future correspondence about this issue. 
# <URL: >

My system struct tm is defined thusly:

    struct tm
      int   tm_sec;
      int   tm_min;
      int   tm_hour;
      int   tm_mday;
      int   tm_mon;
      int   tm_year;
      int   tm_wday;
      int   tm_yday;
      int   tm_isdst;
    #ifdef __TM_GMTOFF
      long  __TM_GMTOFF;
    #ifdef __TM_ZONE
      const char *__TM_ZONE;

When compiling with the default flags, I receive the following warning:

cc -c -DPERL_CORE -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_FORTIFY_SOURCE=2 -std=c89 -O3 -g -Wall -Werror=declaration-after-statement -Wextra -Wc++-compat -Wwrite-strings time64.c
time64.c: In function ‘S_copy_little_tm_to_big_TM’:
time64.c:284:25: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     dest->tm_zone       = src->tm_zone;

Adding __CYGWIN__ to the list of platforms where we have const char* tm_zone in time64.h silences the warning, however it might be better to detect this automatically in Configure. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About