Menu

#1535 Linux Depslib::cache.c Erreur format::time_t

Next_Nightly
fixed
nobody
None
Patch
2025-06-11
2025-06-02
LETARTARE
No

Linux
Leap-15.6, gcc13.3.0, "cb-13667::plugins|compilergcc|depslib|src|cache.c'

The compiler finds that in 'cache.c:L144 sscanf(buf, "%lld %n", &timeval, &n);' ( also L1

"%lld" wait for a 'long long int' and receives a 'time_t' alias 'long int' .

I propose instead "%ld" and a patch.

I can't check for 'MacOs' !

1 Attachments

Discussion

  • LETARTARE

    LETARTARE - 2025-06-02

    ( also L175)

     
  • Miguel Gimenez

    Miguel Gimenez - 2025-06-05

    The problem with time_t is that the underlying type is not defined in the standard, some systems use long long int and others long int.

    Probably the best solution is just using an intermediate long long int variable in the sscanf and later assign it to timeval (and similar changes in fprintf).

     
  • Miguel Gimenez

    Miguel Gimenez - 2025-06-05

    This is my proposal for the issue, is compatible with MSW in 32 and 64 bits and with those environments honouring %lld

     
  • Miguel Gimenez

    Miguel Gimenez - 2025-06-06

    My patch compiles OK (no warnings) on MSW and Mint 18, can you check on Leap?

    It includes some whitespace corrections, you can ignore them.

     
  • LETARTARE

    LETARTARE - 2025-06-07

    For 'Leap-15.6' it's ok.
    But here's the result under 'Win-7-64bits, gcc-14.2-seh' in the attached file (warning and corrected cache.c)
    These warnings should not appear.

    **** The forum is no longer accessible to me. What about you?

     
    • Morten MacFly

      Morten MacFly - 2025-06-07

      We are aware of the forum issue and working on it.

       
  • Miguel Gimenez

    Miguel Gimenez - 2025-06-09

    It's strange, there are neither "%d" nor "long long unsigned int" in the patch, and line numbers 147, 178 and 270 do not match (the file has 216 lines).

     
  • Miguel Gimenez

    Miguel Gimenez - 2025-06-09

    This should be compatible with everything

     
  • Miguel Gimenez

    Miguel Gimenez - 2025-06-09
    • status: open --> fixed
     
  • Miguel Gimenez

    Miguel Gimenez - 2025-06-09

    Fixed in [r13669].

     

    Related

    Commit: [r13669]

  • LETARTARE

    LETARTARE - 2025-06-09

    Thanks,
    With Win-7 : 'cache.c' is good

    Line 270 is in 'hash.c'

     
  • LETARTARE

    LETARTARE - 2025-06-10

    Thanks for 'r13670' : 'hash.c' is good for 'Win-7::gcc-14.2-seh'

     
  • LETARTARE

    LETARTARE - 2025-06-11

    Leap-15.6, gcc-13.3
    r13670-wx328, 'compiler depslib' compiles without warning

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.