bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/28156] New: rename.c doesn't compile with MinGW


From: eliz at gnu dot org
Subject: [Bug binutils/28156] New: rename.c doesn't compile with MinGW
Date: Sat, 31 Jul 2021 12:43:24 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=28156

            Bug ID: 28156
           Summary: rename.c doesn't compile with MinGW
           Product: binutils
           Version: 2.37
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: eliz at gnu dot org
  Target Milestone: ---

rename.c fails to compile with mingw.org's MinGW:

     mingw32-gcc -DHAVE_CONFIG_H -I. -I../../binutils-2.37/binutils  -I.
-I../../binutils-2.37/binutils -I../bfd -I../../binutils-2.37/binutils/../bfd
-I../../binutils-2.37/binutils/../include  -D__USE_MINGW_FSEEK   
-DLOCALEDIR="\"/mingw/share/locale\"" 
-Dbin_dummy_emulation=bin_vanilla_emulation   -W -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Wno-format  -O2 -gdwarf-4
-g3     -MT rename.o -MD -MP -MF $depbase.Tpo -c -o rename.o
../../binutils-2.37/binutils/rename.c &&\
     mv -f $depbase.Tpo $depbase.Po
     ../../binutils-2.37/binutils/rename.c:136:1: error: return type is an
incomplete type
       136 | get_stat_atime (struct stat const *st)
           | ^~~~~~~~~~~~~~
     ../../binutils-2.37/binutils/rename.c: In function 'get_stat_atime':
     ../../binutils-2.37/binutils/rename.c:141:19: error: storage size of 't'
isn't known
       141 |   struct timespec t;
           |                   ^
     ../../binutils-2.37/binutils/rename.c:144:10: warning: 'return' with a
value, in function returning void [-Wreturn-type]
       144 |   return t;
           |          ^
     ../../binutils-2.37/binutils/rename.c:136:1: note: declared here
       136 | get_stat_atime (struct stat const *st)
           | ^~~~~~~~~~~~~~
     ../../binutils-2.37/binutils/rename.c:141:19: warning: unused variable 't'
[-Wunused-variable]
       141 |   struct timespec t;
           |                   ^
     ../../binutils-2.37/binutils/rename.c: At top level:
     ../../binutils-2.37/binutils/rename.c:150:1: error: return type is an
incomplete type
       150 | get_stat_mtime (struct stat const *st)
           | ^~~~~~~~~~~~~~
     ../../binutils-2.37/binutils/rename.c: In function 'get_stat_mtime':
     ../../binutils-2.37/binutils/rename.c:155:19: error: storage size of 't'
isn't known
       155 |   struct timespec t;
           |                   ^
     ../../binutils-2.37/binutils/rename.c:158:10: warning: 'return' with a
value, in function returning void [-Wreturn-type]
       158 |   return t;
           |          ^
     ../../binutils-2.37/binutils/rename.c:150:1: note: declared here
       150 | get_stat_mtime (struct stat const *st)
           | ^~~~~~~~~~~~~~
     ../../binutils-2.37/binutils/rename.c:155:19: warning: unused variable 't'
[-Wunused-variable]
       155 |   struct timespec t;
           |                   ^
     Makefile:1101: recipe for target `rename.o' failed
     make[4]: *** [rename.o] Error 1

The problem is the use of 'timespec_t', which is not exposed by the MinGW
headers except under certain conditions.

However, the functions which use 'timespec_t' are not supposed to be compiled
in the MinGW build, so it should suffice to condition those functions by the
relevant preprocessor conditions:

--- binutils/rename.c~0 2021-07-08 14:37:19.000000000 +0300
+++ binutils/rename.c   2021-07-31 14:27:49.111750000 +0300
@@ -102,6 +102,7 @@ simple_copy (int fromfd, const char *to,
 # define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim.st__tim.tv_nsec)
 #endif

+#if defined HAVE_UTIMENSAT || defined HAVE_UTIMES
 static inline long int get_stat_atime_ns (struct stat const *)
ATTRIBUTE_UNUSED;
 static inline long int get_stat_mtime_ns (struct stat const *)
ATTRIBUTE_UNUSED;

@@ -160,6 +161,8 @@ get_stat_mtime (struct stat const *st)
 }
 /* End FIXME.  */

+#endif /* HAVE_UTIMENSAT || HAVE_UTIMES */
+
 /* Set the times of the file DESTINATION to be the same as those in
    STATBUF.  */

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]