devkitPro / newlib

fork from sourceware git://sourceware.org / newlib-cygwin.git
https://devkitpro.org
GNU General Public License v2.0
22 stars 16 forks source link

Compiler warning for using atime, ctime, and mtime on 3DS #21

Closed pyroticinsanity closed 4 years ago

pyroticinsanity commented 4 years ago

There isn't any ability to get ctime or atime from the 3DS and mtime can only be retrieved by using a path so it can only be filled in for stat and not fstat. There's also resistance to adding it due to it being slow. See https://github.com/smealum/ctrulib/pull/458#issuecomment-631587673

I'm requesting that the header file be updated to flag the compiler to print out a warning if someone is using st_mtime, st_atime, or st_ctime in their code so that they can take appropriate action. Alternatively they could just not be defined for the 3DS but then that breaks POSIX requirements.

One possibility is adding in the deprecated pragma and then a comment in the header file along with what to do for the 3DS (i.e. call archive_getmtime instead): https://stackoverflow.com/questions/22823477/c-portable-way-to-deprecate-struct-members

WinterMute commented 4 years ago

devkitARM is also used for other systems where these struct members can be used perfectly normally. Sorry but you're going to have to file this one under quirks of the 3DS, we're not adding warnings to devkitARM headers that only apply to one platform.

pyroticinsanity commented 4 years ago

I figured as much. Thanks for considering though!