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)

From:
Dan Collins
Date:
June 10, 2016 00:23
Subject:
[perl #128359] Cygwin: Warning: assignment discards 'const'qualifier (S_copy_little_tm_to_big_TM)
Message ID:
rt-4.0.18-20312-1465518182-1938.128359-75-0@perl.org
# New Ticket Created by  Dan Collins 
# Please include the string:  [perl #128359]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=128359 >


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;
    #endif
    #ifdef __TM_ZONE
      const char *__TM_ZONE;
    #endif
    };

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.




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About