From owner-svn-src-all@FreeBSD.ORG Tue Feb 17 22:26:02 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A6B38651; Tue, 17 Feb 2015 22:26:02 +0000 (UTC) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 67105E1E; Tue, 17 Feb 2015 22:26:01 +0000 (UTC) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 02039781CC7; Wed, 18 Feb 2015 09:25:39 +1100 (AEDT) Date: Wed, 18 Feb 2015 09:25:38 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Gleb Smirnoff Subject: Re: svn commit: r278913 - in head/sys: conf modules/cxgbe/if_cxgbe modules/drm2/radeonkms modules/ibcore modules/ipoib modules/mlx4 modules/mlx4ib modules/mlxen modules/mthca ofed/drivers/net/mlx4 In-Reply-To: <201502171927.t1HJRFVV088172@svn.freebsd.org> Message-ID: <20150218081602.C3182@besplex.bde.org> References: <201502171927.t1HJRFVV088172@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=Za4kaKlA c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=6I5d2MoRAAAA:8 a=09v5NAvb8IAPeZwDaCMA:9 a=CjuIK1q_8ugA:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Feb 2015 22:26:02 -0000 On Tue, 17 Feb 2015, Gleb Smirnoff wrote: > Author: glebius > Date: Tue Feb 17 19:27:14 2015 > New Revision: 278913 > URL: https://svnweb.freebsd.org/changeset/base/278913 > > Log: > Globally enable -fms-extensions when building kernel with gcc, and remove > this option from all modules that enable it theirselves. > In C mode -fms-extensions option enables anonymous structs and unions, > allowing us to use this C11 feature in kernel. Of course, clang supports > it without any extra options. Anonymous unions have been a standard gcc extension for more than 20 years. It shouldn't take a ms extensions flag to get them, except possibly for C++. Indeed, the bugs are mostly in extra options that are already present. Of course, clang handles these options incorrectly: - the default CFLAGS for kernels include the foot-shooting flag -std=c99. The feature isn't in C99, so this should make the feature unavailable in kernels. This works for gcc-4.2, but not for clang or gcc-4.8. It takes -pedantic as well as -std=c99 to kill the feature for these compilers. - the default CFLAGS for userland include -std=gnu99. This of course doesn't kill 20+ year old gcc extensions, so userland doesn't have the problem. I recently noticed several other bugs involving -std: - -std sets __STDC_VERSION__, but sys/cdefs.h mostly ignores that. It sets __ISO_C_VISIBLE based mainly on _POSIX_C_SOURCE, so __ISO_C_VISIBLE defaults to 2011 and is thus inconsistent with __STDC_VERSION__ in all cases where -std=c11 is not used -- that is, in almost all cases since everything defaults to -std=c99 or -std-gnu99 which give __STDC_VERSION__ = 199901L. Compiling with an old makefile or script that doesn't use -std gives larger inconsistencies -- it gives C90 for gcc but C99 for clang. gcc-4.8 remains compatible with gcc-4.2 (and gcc-1?) here. - most FreeBSD header files use __ISO_C_VISIBLE and not __STDC_VERSION__, so they give C11 symbols by default. They are supposed to give maximal symbols by default, but this is wrong if the symbols are related to language features that are turned off by -std. - gcc-4.8 uses some private header files. It doesn't use FreeBSD's __ISO_C_VISBLE of course, so it gives inconsistent symbols. - lib/msun used to depend on __ISO_C_VISIBLE being wrong when it was compiled with defaults. Now it depends on -std=*99 being in the defaults. Both conditions are satisifed when the system headers are used. But when gcc's float.h is used and -std is either not used or is *89, then the compile breaks. - gcc's private header for float.h also has incompatibilities unrelated to -std. These break lib/msun more seriously on i386. - -std=c99 in gcc-4.8 gives large pessimizations in floating point code on i386. -std=gnu99 gives compatible FP code (not perfectly pessimized to Standards spec). clang is just missing support for Standards here. Bruce