[PATCH] libc++: Don't let time_put test use implementation dependent constructs
ed at nuxi.nl
Mon Mar 16 09:05:30 PDT 2015
In http://reviews.llvm.org/D8349#141306, @jroelofs wrote:
> > Second, some of the tests actually use modifiers that are only present on BSD derived systems. They are not part of the C standard/POSIX. Simply remove them.
> They're probably still useful on those platforms... perhaps put them under an #ifdef for that platform, along with a comment saying that they're a bsd extension?
We could consider doing this, but in my opinion this would only make sense if there is something actionable on our side in case one of these tests starts to fail. Right now time_put::put() calls strftime() directly without pre-processing the arguments in any way. If FreeBSD or Mac OS X would suddenly decide to remove support for the non-standard %v modifier, is there a chance that we would add a workaround for it by adding pre-processing to time_put::put()? My assumption is that we wouldn't bother, so I would rather remove these tests.
That said, if someone really cares about these tests, we could consider putting them in a separate test, so it remains clear which behavior is standard and which is not.
Comment at: test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp:186
@@ -185,3 +182,1 @@
- iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'B', 'O');
- std::string ex(str, iter.base());
> Can you point to the docs saying that these modifiers are invalid?
C++14 N3797, section 184.108.40.206.2, the description of time_put::put():
"Formatting is controlled by the parameters format and modifier, interpreted identically as the format
specifiers in the string argument to the standard library function strftime()."
ISO/IEC 9899:2011, section 220.127.116.11, the description of strftime():
The %OB, %k, %l, %s, %v, %J and %J% modifiers are not listed in the table.
That said, POSIX has made some extensions to strftime: http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html
This table also doesn't list these modifiers.
More information about the cfe-commits