On 4/22/20 2:03 AM, Bernhard Reutner-Fischer wrote:
On Tue, 21 Apr 2020 at 16:59, Martin Sebor <mse...@gmail.com> wrote:

https://gcc.gnu.org/pipermail/gcc-patches/2020-April/543672.html

I'm okay with the changes to the tests.

The target-supports.exp changes look reasonable to me as well but
I can't approve them.  Since you said it's for targets that don't
have file I/O functions I wonder if the name would better reflect
that if it were called, say, check_effective_target_fileio?

Since tmpnam is obsolescent in SUSv4 and hence a libc is fine to omit it, I'd 
rather fix the tests to use functions that are known to stay.

I would be okay with replacing tmpnam with something else, although
I don't think it's necessary.  tmpnam is a standard C function that
conforming C (and so POSIX) implementation are required to provide.

IMO it's perfectly fine to omit obsolescent functions from a
conforming implementation ¹).

No, it's not (the note you quoted below notwithstanding), certainly
not for C features.  In particular for tmpnam (and all other standard
C99 APIs), the POSIX description states

  The functionality described on this reference page is aligned with
  the ISO C standard. Any conflict between the requirements described
  here and the ISO C standard is unintentional. This volume of
  POSIX.1-2008 defers to the ISO C standard.

Since C99 (which is subsumed by POSXI) as well as subsequent revisions
of C require tmpnam to be provided by conforming implementation, so does
POSIX.

But one should use the recommended replacement functions either way,
e.g. mkstemp ²)

I wouldn't have a problem with using mkstemp in the tests but I don't
view it as important or, since it's a POSIX only API, necessarily even
the best choice for portability.


thanks,
¹)
[OB] [Option Start] Obsolescent [Option End]
The functionality described may be removed in a future version of this
volume of POSIX.1-2017. Strictly Conforming POSIX Applications and
Strictly Conforming XSI Applications shall not use obsolescent
features.

Nothing here suggests that a conforming POSIX implementation need
not provide obsolescent features.  The SUSv4 guide further clarifies
the meaning of obsolescence by saying:

  OB
  Obsolescent
  Features marked as obsolescent are portable to all Single UNIX
  Specification platforms, but may be withdrawn in a future issue.
  This functionality should be avoided.

Since future SUS issues will unavoidably continue to incorporate
C, C features made obsolescent in POSIX cannot be removed until
they are also removed from C.  And since tmpnam is not obsolescent
in C17 and no proposal has been submitted to make it so in C2X,
chances are that the function will continue to be required by
POSIX for the foreseeable future as well.

Martin

²)
https://pubs.opengroup.org/onlinepubs/9699919799/functions/tmpnam.html
---8<---
APPLICATION USAGE
   Applications should use the tmpfile(), mkstemp(), or mkdtemp()
functions instead of the obsolescent tmpnam() function.
---8<---


Reply via email to