[RFC] Make _FILE_OFFSET_BITS=64 default.
diff mbox

Message ID 5329DC42.2000409@cs.ucla.edu
State New
Headers show

Commit Message

Paul Eggert March 19, 2014, 6:04 p.m. UTC
On 03/19/2014 02:14 AM, Mike Frysinger wrote:
> i have gotten complaints in the past that glibc provided half-baked support
> for static assert when building with <gcc-4.6.  so this would make those
> people happy too:).
OK, I'm attaching the patch in more formal form, broken into two parts 
(one for _Static_assert, one for fts.h, the latter dependent on the 
former), for further review.  I'd like to install it unless further 
objections turn up.

Comments

Joseph Myers March 19, 2014, 6:46 p.m. UTC | #1
On Wed, 19 Mar 2014, Paul Eggert wrote:

> On 03/19/2014 02:14 AM, Mike Frysinger wrote:
> > i have gotten complaints in the past that glibc provided half-baked support
> > for static assert when building with <gcc-4.6.  so this would make those
> > people happy too:).
> OK, I'm attaching the patch in more formal form, broken into two parts (one
> for _Static_assert, one for fts.h, the latter dependent on the former), for
> further review.  I'd like to install it unless further objections turn up.

I don't think the installed glibc headers should be providing 
_Static_assert (arguably assert.h should try to do something for the case 
of _ISOC11_SOURCE, non-C11 compiler, as a quality-of-implementation 
matter, but defining it for everything that includes any system header 
seems much riskier).  I certainly don't think they should be overriding 
_Static_assert provided by GCC (>= 4.6) as an extension outside C11 mode 
(but generally that applies to any compiler possibly providing 
_Static_assert outside C11 mode - the library shouldn't get in the way of 
the user using the compiler feature).

Patch
diff mbox

From 2d6753840038501ff2be16672e5e12e6ff90b0ad Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Wed, 19 Mar 2014 11:01:42 -0700
Subject: [PATCH 2/2] fts: allow _FILE_OFFSET_BITS=64 on 64-bit hosts

* io/fts.h: Use _Static_assert to check for _FILE_OFFSET_BITS problem,
so that we don't unnecessarily reject compilations with
_FILE_OFFSET_BITS=64 on 64-bit hosts.
---
 ChangeLog | 5 +++++
 io/fts.h  | 8 +++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3d4c88d..834a973 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@ 
 2014-03-19  Paul Eggert  <eggert@cs.ucla.edu>
 
+	fts: allow _FILE_OFFSET_BITS=64 on 64-bit hosts
+	* io/fts.h: Use _Static_assert to check for _FILE_OFFSET_BITS problem,
+	so that we don't unnecessarily reject compilations with
+	_FILE_OFFSET_BITS=64 on 64-bit hosts.
+
 	Approximate _Static_assert for pre-C11 compilers.
 	* misc/sys/cdefs.h (_Static_assert) [__STDC_VERSION__ < 201112L]:
 	New macro, for convenience with pre-C11 compilers.
diff --git a/io/fts.h b/io/fts.h
index 0a070ba..f71f550 100644
--- a/io/fts.h
+++ b/io/fts.h
@@ -35,10 +35,12 @@ 
 #include <features.h>
 #include <sys/types.h>
 
-/* The fts interface is incompatible with the LFS interface which
-   transparently uses the 64-bit file access functions.  */
+/* When off_t is not 64 bits, the fts interface is incompatible with
+   the LFS interface which transparently uses the 64-bit file access
+   functions.  */
 #ifdef __USE_FILE_OFFSET64
-# error "<fts.h> cannot be used with -D_FILE_OFFSET_BITS==64"
+_Static_assert (sizeof (__off_t) == sizeof (__off64_t),
+		"<fts.h> cannot be used with 64-bit off_t on this platform");
 #endif
 
 
-- 
1.8.5.3