This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PATCH, C/C++] Add -fno-float to forbid floating point data types
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Thomas Preud'homme <thomas dot preudhomme at arm dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 12 Aug 2014 14:54:00 +0000
- Subject: RE: [PATCH, C/C++] Add -fno-float to forbid floating point data types
- Authentication-results: sourceware.org; auth=none
- References: <000701cfb60f$5b859700$1290c500$ at arm dot com> <alpine dot DEB dot 2 dot 11 dot 1408121128240 dot 1593 at laptop-mg dot saclay dot inria dot fr> <000801cfb617$304428b0$90cc7a10$ at arm dot com>
On Tue, 12 Aug 2014, Thomas Preud'homme wrote:
> 3) __builtin_sqrt
>
> True, I shall try if it works with builtins. Thanks for the advice.
In addition to built-in functions, you have built-in typedefs. I don't
think your code would catch uses of __fp16, __float128 etc. (such types
are defined as built-in typedefs by back ends at present, not as
keywords).
Rather than making back ends have their own conditionals, the built-in
typedef issue could be dealt with by checking whether the type given by a
sequence of declspecs (in a declaration or type name) is a floating-point
type (in or after c_finish_declspecs - in the __auto_type case, getting a
floating-point type means the initializer has such a type and you should
catch things when handling the initializer).
Also consider built-in typedefs and functions involving vectors of
floating-point types, as well as the simple real and complex types.
> 4) Objective C
>
> As said in the description, I'm not opposed to adding other language.
> It's easier to add another language than remove one after the fact
> because very few people use it. Therefore I preferred to have
> just C and C++ for now which is what I expect most of the users of
> such a switch to be interested in. Do you think I should add support
> for that language up front or can it wait a later version of the patch
> once people started to use it?
The presumption should be that an option for C also applies to Objective-C
(and likewise for C++ options and Objective-C++), unless there is a
concrete reason this is problematic (i.e. an Objective-C feature that
needs special handling to implement the option).
--
Joseph S. Myers
joseph@codesourcery.com