public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Hans-Peter Nilsson <hp@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] Complete revert of 2019-08-19, st_atime in libc/include/sys/stat.h
Date: Tue, 16 Feb 2021 12:57:46 +0000 (GMT)	[thread overview]
Message-ID: <20210216125746.0BD0A3972014@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=571e73067898f9e82d295b3526de73e7f44e9f89

commit 571e73067898f9e82d295b3526de73e7f44e9f89
Author: Hans-Peter Nilsson <hp@axis.com>
Date:   Mon Feb 15 21:20:35 2021 +0100

    Complete revert of 2019-08-19, st_atime in libc/include/sys/stat.h
    
    The revert-part of the revert-and-fix commit, b99887c4283f a.k.a.
    "Revert previous change to sys/stat.h and fix cris libgloss",
    apparently intending to revert f75aa6785151 a.k.a. "Fix regression in
    cris-elf caused by sys/stat.h change" and fix it in another way,
    wasn't complete.  Although the fix-part added the prerequisite "#undef
    st_atime" (et al) to gensyscalls, the revert-part didn't revert the
    "&& !defined(__cris__)" in sys/stat.h, stopping st_atime (et al) from
    being defined.
    
    The effect of the unreverted change is that accessing the struct stat
    compatibility member names "st_atime" (et al) as in "struct stat
    mystat; mystat.st_atime;" yields errors, observable for example when
    building libgfortran in gcc:
    
    /x/gcc/libgfortran/intrinsics/stat.c:114:42: error: 'struct stat' has \
    no member named 'st_atime'; did you mean 'st_atim'?
      114 |       sarray->base_addr[8 * stride] = sb.st_atime;
          |                                          ^~~~~~~~
          |                                          st_atim
    (etc.)
    
    Trivially fixed by completing the reversion, removing the "&&
    !defined(__cris__)" in sys/stat.h.
    
    Beware: the net effect of the earlier related change to struct stat in
    sys/stat.h, leading up to the fix, *does* change its definition as a
    type.  Thankfully, replacing members like "time_t st_atime; long
    st_spare1;" by "struct timespec st_atim;", ditto st_mtim and st_ctim,
    is layout-compatible.  To wit, that change is "binary compatible".
    
    Incidentally, related to the simulator / Linux ABI, there's a
    transitional stage (see gensyscalls), reloading between "struct stat"
    (sys/stat.h) and "struct new_stat" (kernel/simulator) as necessary.
    
    Tested by a cris-elf gcc build (including libgfortran).

Diff:
---
 newlib/libc/include/sys/stat.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/include/sys/stat.h b/newlib/libc/include/sys/stat.h
index 722ed0eff..68f839b35 100644
--- a/newlib/libc/include/sys/stat.h
+++ b/newlib/libc/include/sys/stat.h
@@ -50,7 +50,7 @@ struct	stat
 #endif
 };
 
-#if !(defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)) && !defined(__cris__)
+#if !(defined(__svr4__) && !defined(__PPC__) && !defined(__sun__))
 #define st_atime st_atim.tv_sec
 #define st_ctime st_ctim.tv_sec
 #define st_mtime st_mtim.tv_sec


                 reply	other threads:[~2021-02-16 12:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210216125746.0BD0A3972014@sourceware.org \
    --to=hp@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).