public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* -Wformat-diag: floating-point or floating point?
@ 2019-05-21 16:47 Martin Sebor
  2019-05-21 20:18 ` Bill Schmidt
  0 siblings, 1 reply; 10+ messages in thread
From: Martin Sebor @ 2019-05-21 16:47 UTC (permalink / raw)
  To: Joseph S. Myers, Jason Merrill, gcc mailing list

The GCC coding style says to use "floating-point" as an adjective
rather than "floating point."  After enhancing the -Wformat-diag
checker to detect this I found a bunch of uses of the latter, such
as in:

   gcc/c/c-decl.c:10944
   gcc/c/c-parser.c:9423, 9446, 9450, etc.
   gcc/convert.c:418, 422
   gcc/cp/call.c:5070
   gcc/cp/cvt.c:886

Before I fix them all and adjust the tests, I want to make sure
we really want to follow this rule.  The C standard uses both
interchangeably.  With just one exception, the C++ standard uses
the hyphenated form.

Thanks
Martin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: -Wformat-diag: floating-point or floating point?
  2019-05-21 16:47 -Wformat-diag: floating-point or floating point? Martin Sebor
@ 2019-05-21 20:18 ` Bill Schmidt
  2019-05-21 21:33   ` Martin Sebor
  2019-05-22 10:19   ` Richard Earnshaw (lists)
  0 siblings, 2 replies; 10+ messages in thread
From: Bill Schmidt @ 2019-05-21 20:18 UTC (permalink / raw)
  To: gcc

On 5/21/19 11:47 AM, Martin Sebor wrote:
> The GCC coding style says to use "floating-point" as an adjective
> rather than "floating point."  After enhancing the -Wformat-diag
> checker to detect this I found a bunch of uses of the latter, such
> as in:
>
>   gcc/c/c-decl.c:10944
>   gcc/c/c-parser.c:9423, 9446, 9450, etc.
>   gcc/convert.c:418, 422
>   gcc/cp/call.c:5070
>   gcc/cp/cvt.c:886
>
> Before I fix them all and adjust the tests, I want to make sure
> we really want to follow this rule.  The C standard uses both
> interchangeably.  With just one exception, the C++ standard uses
> the hyphenated form.
The hyphenated form is correct English, so I certainly prefer it. :-)

Bill
>
> Thanks
> Martin
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: -Wformat-diag: floating-point or floating point?
  2019-05-21 20:18 ` Bill Schmidt
@ 2019-05-21 21:33   ` Martin Sebor
  2019-05-22 10:19   ` Richard Earnshaw (lists)
  1 sibling, 0 replies; 10+ messages in thread
From: Martin Sebor @ 2019-05-21 21:33 UTC (permalink / raw)
  To: Bill Schmidt, gcc

On 5/21/19 2:18 PM, Bill Schmidt wrote:
> On 5/21/19 11:47 AM, Martin Sebor wrote:
>> The GCC coding style says to use "floating-point" as an adjective
>> rather than "floating point."  After enhancing the -Wformat-diag
>> checker to detect this I found a bunch of uses of the latter, such
>> as in:
>>
>>    gcc/c/c-decl.c:10944
>>    gcc/c/c-parser.c:9423, 9446, 9450, etc.
>>    gcc/convert.c:418, 422
>>    gcc/cp/call.c:5070
>>    gcc/cp/cvt.c:886
>>
>> Before I fix them all and adjust the tests, I want to make sure
>> we really want to follow this rule.  The C standard uses both
>> interchangeably.  With just one exception, the C++ standard uses
>> the hyphenated form.
> The hyphenated form is correct English, so I certainly prefer it. :-)

I agree and I'm changing the C/C++ FE diagnostics to match.  I count
just 31 test that look for the unhyphenated form, and of those just
three under the gcc.target directory, so the fallout should be fairly
limited.

Thanks
Martin

PS As a heads up, below are the target-specific tests I found:

gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-5.c:  return 
(long long int) __builtin_vec_scalar_extract_sig (source); /* { dg-error 
"requires ISA 3.0 IEEE 128-bit floating point" } */
gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-11.c:  return 
scalar_insert_exp (significand, exponent); /* { dg-error "requires ISA 
3.0 IEEE 128-bit floating point" } */
gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-5.c:  return 
scalar_extract_exp (source);	/* { dg-error "requires ISA 3.0 IEEE 
128-bit floating point" } */

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: -Wformat-diag: floating-point or floating point?
  2019-05-21 20:18 ` Bill Schmidt
  2019-05-21 21:33   ` Martin Sebor
@ 2019-05-22 10:19   ` Richard Earnshaw (lists)
  2019-05-22 12:17     ` Bill Schmidt
  1 sibling, 1 reply; 10+ messages in thread
From: Richard Earnshaw (lists) @ 2019-05-22 10:19 UTC (permalink / raw)
  To: Bill Schmidt, gcc

On 21/05/2019 21:18, Bill Schmidt wrote:
> On 5/21/19 11:47 AM, Martin Sebor wrote:
>> The GCC coding style says to use "floating-point" as an adjective
>> rather than "floating point."  After enhancing the -Wformat-diag
>> checker to detect this I found a bunch of uses of the latter, such
>> as in:
>>
>>   gcc/c/c-decl.c:10944
>>   gcc/c/c-parser.c:9423, 9446, 9450, etc.
>>   gcc/convert.c:418, 422
>>   gcc/cp/call.c:5070
>>   gcc/cp/cvt.c:886
>>
>> Before I fix them all and adjust the tests, I want to make sure
>> we really want to follow this rule.  The C standard uses both
>> interchangeably.  With just one exception, the C++ standard uses
>> the hyphenated form.
> The hyphenated form is correct English, so I certainly prefer it. :-)
> 

It's not quite as simple as that.  Hyphens should be used to make it
clear what is the adjective and what is the noun:

   A floating-point number (hyphenated) is a number with a
   floating point (no hyphen).

In the first case 'floating-point' is the adjective and qualifies
number.  In the second case 'floating' is the adjective and qualifies
'point'.

But this is English, so there are probably some exceptions even then -
but not in this case, I think.  :-)

R.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: -Wformat-diag: floating-point or floating point?
  2019-05-22 10:19   ` Richard Earnshaw (lists)
@ 2019-05-22 12:17     ` Bill Schmidt
  2019-05-22 12:28       ` Richard Earnshaw (lists)
  2019-05-22 12:33       ` Richard Earnshaw (lists)
  0 siblings, 2 replies; 10+ messages in thread
From: Bill Schmidt @ 2019-05-22 12:17 UTC (permalink / raw)
  To: Richard Earnshaw (lists), gcc

On 5/22/19 5:19 AM, Richard Earnshaw (lists) wrote:
> On 21/05/2019 21:18, Bill Schmidt wrote:
>> On 5/21/19 11:47 AM, Martin Sebor wrote:
>>> The GCC coding style says to use "floating-point" as an adjective
>>> rather than "floating point."  After enhancing the -Wformat-diag
>>> checker to detect this I found a bunch of uses of the latter, such
>>> as in:
>>>
>>>   gcc/c/c-decl.c:10944
>>>   gcc/c/c-parser.c:9423, 9446, 9450, etc.
>>>   gcc/convert.c:418, 422
>>>   gcc/cp/call.c:5070
>>>   gcc/cp/cvt.c:886
>>>
>>> Before I fix them all and adjust the tests, I want to make sure
>>> we really want to follow this rule.  The C standard uses both
>>> interchangeably.  With just one exception, the C++ standard uses
>>> the hyphenated form.
>> The hyphenated form is correct English, so I certainly prefer it. :-)
>>
> It's not quite as simple as that.  Hyphens should be used to make it
> clear what is the adjective and what is the noun:
>
>    A floating-point number (hyphenated) is a number with a
>    floating point (no hyphen).
>
> In the first case 'floating-point' is the adjective and qualifies
> number.  In the second case 'floating' is the adjective and qualifies
> 'point'.
>
> But this is English, so there are probably some exceptions even then -
> but not in this case, I think.  :-)

English is always fun, agreed -- Martin cited the requirement to use
"floating-point" when it's used as an adjective, which is certainly correct.

There's a more interesting question around cavalier usage such as,
"We should use floating point."  I would argue that there is an implied
noun "arithmetic" modified here, so this should also be hyphenated,
but I daresay there would be people on both sides of this one...

This is why grammar police usually die from friendly fire. :-)

Bill
>
> R.
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: -Wformat-diag: floating-point or floating point?
  2019-05-22 12:17     ` Bill Schmidt
@ 2019-05-22 12:28       ` Richard Earnshaw (lists)
  2019-05-22 14:58         ` Martin Sebor
  2019-05-22 12:33       ` Richard Earnshaw (lists)
  1 sibling, 1 reply; 10+ messages in thread
From: Richard Earnshaw (lists) @ 2019-05-22 12:28 UTC (permalink / raw)
  To: Bill Schmidt, gcc

On 22/05/2019 13:17, Bill Schmidt wrote:
> On 5/22/19 5:19 AM, Richard Earnshaw (lists) wrote:
>> On 21/05/2019 21:18, Bill Schmidt wrote:
>>> On 5/21/19 11:47 AM, Martin Sebor wrote:
>>>> The GCC coding style says to use "floating-point" as an adjective
>>>> rather than "floating point."  After enhancing the -Wformat-diag
>>>> checker to detect this I found a bunch of uses of the latter, such
>>>> as in:
>>>>
>>>>   gcc/c/c-decl.c:10944
>>>>   gcc/c/c-parser.c:9423, 9446, 9450, etc.
>>>>   gcc/convert.c:418, 422
>>>>   gcc/cp/call.c:5070
>>>>   gcc/cp/cvt.c:886
>>>>
>>>> Before I fix them all and adjust the tests, I want to make sure
>>>> we really want to follow this rule.  The C standard uses both
>>>> interchangeably.  With just one exception, the C++ standard uses
>>>> the hyphenated form.
>>> The hyphenated form is correct English, so I certainly prefer it. :-)
>>>
>> It's not quite as simple as that.  Hyphens should be used to make it
>> clear what is the adjective and what is the noun:
>>
>>    A floating-point number (hyphenated) is a number with a
>>    floating point (no hyphen).
>>
>> In the first case 'floating-point' is the adjective and qualifies
>> number.  In the second case 'floating' is the adjective and qualifies
>> 'point'.
>>
>> But this is English, so there are probably some exceptions even then -
>> but not in this case, I think.  :-)
> 
> English is always fun, agreed -- Martin cited the requirement to use
> "floating-point" when it's used as an adjective, which is certainly correct.
> 
> There's a more interesting question around cavalier usage such as,
> "We should use floating point."  I would argue that there is an implied
> noun "arithmetic" modified here, so this should also be hyphenated,
> but I daresay there would be people on both sides of this one...

I would argue that leaving out "arithmetic" is the error. :-)

> 
> This is why grammar police usually die from friendly fire. :-)
> 

Sticking your head above the parapet is always fraught with danger :)


R.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: -Wformat-diag: floating-point or floating point?
  2019-05-22 12:17     ` Bill Schmidt
  2019-05-22 12:28       ` Richard Earnshaw (lists)
@ 2019-05-22 12:33       ` Richard Earnshaw (lists)
  1 sibling, 0 replies; 10+ messages in thread
From: Richard Earnshaw (lists) @ 2019-05-22 12:33 UTC (permalink / raw)
  To: Bill Schmidt, gcc

On 22/05/2019 13:17, Bill Schmidt wrote:

> "We should use floating point."  

In fact, since we're compiler folk, we just say it's undefined behaviour
and optimize it to

"."

:-P

R.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: -Wformat-diag: floating-point or floating point?
  2019-05-22 12:28       ` Richard Earnshaw (lists)
@ 2019-05-22 14:58         ` Martin Sebor
  2019-05-22 15:04           ` Bill Schmidt
  2019-05-23 16:45           ` Joseph Myers
  0 siblings, 2 replies; 10+ messages in thread
From: Martin Sebor @ 2019-05-22 14:58 UTC (permalink / raw)
  To: Richard Earnshaw (lists), Bill Schmidt, gcc

On 5/22/19 6:27 AM, Richard Earnshaw (lists) wrote:
> On 22/05/2019 13:17, Bill Schmidt wrote:
>> On 5/22/19 5:19 AM, Richard Earnshaw (lists) wrote:
>>> On 21/05/2019 21:18, Bill Schmidt wrote:
>>>> On 5/21/19 11:47 AM, Martin Sebor wrote:
>>>>> The GCC coding style says to use "floating-point" as an adjective
>>>>> rather than "floating point."  After enhancing the -Wformat-diag
>>>>> checker to detect this I found a bunch of uses of the latter, such
>>>>> as in:
>>>>>
>>>>>    gcc/c/c-decl.c:10944
>>>>>    gcc/c/c-parser.c:9423, 9446, 9450, etc.
>>>>>    gcc/convert.c:418, 422
>>>>>    gcc/cp/call.c:5070
>>>>>    gcc/cp/cvt.c:886
>>>>>
>>>>> Before I fix them all and adjust the tests, I want to make sure
>>>>> we really want to follow this rule.  The C standard uses both
>>>>> interchangeably.  With just one exception, the C++ standard uses
>>>>> the hyphenated form.
>>>> The hyphenated form is correct English, so I certainly prefer it. :-)
>>>>
>>> It's not quite as simple as that.  Hyphens should be used to make it
>>> clear what is the adjective and what is the noun:
>>>
>>>     A floating-point number (hyphenated) is a number with a
>>>     floating point (no hyphen).
>>>
>>> In the first case 'floating-point' is the adjective and qualifies
>>> number.  In the second case 'floating' is the adjective and qualifies
>>> 'point'.
>>>
>>> But this is English, so there are probably some exceptions even then -
>>> but not in this case, I think.  :-)
>>
>> English is always fun, agreed -- Martin cited the requirement to use
>> "floating-point" when it's used as an adjective, which is certainly correct.
>>
>> There's a more interesting question around cavalier usage such as,
>> "We should use floating point."  I would argue that there is an implied
>> noun "arithmetic" modified here, so this should also be hyphenated,
>> but I daresay there would be people on both sides of this one...
> 
> I would argue that leaving out "arithmetic" is the error. :-)

I agree.  Unfortunately, there are a few cases like that among
the diagnostics that my script has already fixed:

   decimal floating point not supported
   comparing floating point with %<==%> or %<!=%> is unsafe
   ISO C does not support decimal floating point

They probably should read

   decimal floating point types not supported
   comparing floating-point values with %<==%> or %<!=%> is unsafe
   ISO C does not support decimal floating point types

I think they can be adjusted later if we think it's important,
after the checker is finalized and committed.  I don't want to
complicate it too much by having to differentiate between
adjectives and nouns.  The vast majority of the "floating point"
instances is has found are adjectives.

Martin


>> This is why grammar police usually die from friendly fire. :-)
>>
> 
> Sticking your head above the parapet is always fraught with danger :)
> 
> 
> R.
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: -Wformat-diag: floating-point or floating point?
  2019-05-22 14:58         ` Martin Sebor
@ 2019-05-22 15:04           ` Bill Schmidt
  2019-05-23 16:45           ` Joseph Myers
  1 sibling, 0 replies; 10+ messages in thread
From: Bill Schmidt @ 2019-05-22 15:04 UTC (permalink / raw)
  To: Martin Sebor, Richard Earnshaw (lists), gcc

On 5/22/19 9:58 AM, Martin Sebor wrote:
> On 5/22/19 6:27 AM, Richard Earnshaw (lists) wrote:
>> On 22/05/2019 13:17, Bill Schmidt wrote:
>>> On 5/22/19 5:19 AM, Richard Earnshaw (lists) wrote:
>>>> On 21/05/2019 21:18, Bill Schmidt wrote:
>>>>> On 5/21/19 11:47 AM, Martin Sebor wrote:
>>>>>> The GCC coding style says to use "floating-point" as an adjective
>>>>>> rather than "floating point."  After enhancing the -Wformat-diag
>>>>>> checker to detect this I found a bunch of uses of the latter, such
>>>>>> as in:
>>>>>>
>>>>>>    gcc/c/c-decl.c:10944
>>>>>>    gcc/c/c-parser.c:9423, 9446, 9450, etc.
>>>>>>    gcc/convert.c:418, 422
>>>>>>    gcc/cp/call.c:5070
>>>>>>    gcc/cp/cvt.c:886
>>>>>>
>>>>>> Before I fix them all and adjust the tests, I want to make sure
>>>>>> we really want to follow this rule.  The C standard uses both
>>>>>> interchangeably.  With just one exception, the C++ standard uses
>>>>>> the hyphenated form.
>>>>> The hyphenated form is correct English, so I certainly prefer it. :-)
>>>>>
>>>> It's not quite as simple as that.  Hyphens should be used to make it
>>>> clear what is the adjective and what is the noun:
>>>>
>>>>     A floating-point number (hyphenated) is a number with a
>>>>     floating point (no hyphen).
>>>>
>>>> In the first case 'floating-point' is the adjective and qualifies
>>>> number.  In the second case 'floating' is the adjective and qualifies
>>>> 'point'.
>>>>
>>>> But this is English, so there are probably some exceptions even then -
>>>> but not in this case, I think.  :-)
>>>
>>> English is always fun, agreed -- Martin cited the requirement to use
>>> "floating-point" when it's used as an adjective, which is certainly
>>> correct.
>>>
>>> There's a more interesting question around cavalier usage such as,
>>> "We should use floating point."  I would argue that there is an implied
>>> noun "arithmetic" modified here, so this should also be hyphenated,
>>> but I daresay there would be people on both sides of this one...
>>
>> I would argue that leaving out "arithmetic" is the error. :-)
>
> I agree.  Unfortunately, there are a few cases like that among
> the diagnostics that my script has already fixed:
>
>   decimal floating point not supported
>   comparing floating point with %<==%> or %<!=%> is unsafe
>   ISO C does not support decimal floating point
>
> They probably should read
>
>   decimal floating point types not supported
>   comparing floating-point values with %<==%> or %<!=%> is unsafe
>   ISO C does not support decimal floating point types

"decimal floating point types" does use "floating-point" to modify
"types", so if you change those they should probably remain hyphenated. 
Technically the whole phrase "decimal floating point" modifies types
together, and should be hyphenated together, but that just looks fussy
and isn't common practice.  None of those details are going to solve
world hunger. :-)  Thanks for fixing the general problem!  For the edge
cases, Richard's optimization looks better and better. :-P

Bill
>
> I think they can be adjusted later if we think it's important,
> after the checker is finalized and committed.  I don't want to
> complicate it too much by having to differentiate between
> adjectives and nouns.  The vast majority of the "floating point"
> instances is has found are adjectives.
>
> Martin
>
>
>>> This is why grammar police usually die from friendly fire. :-)
>>>
>>
>> Sticking your head above the parapet is always fraught with danger :)
>>
>>
>> R.
>>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: -Wformat-diag: floating-point or floating point?
  2019-05-22 14:58         ` Martin Sebor
  2019-05-22 15:04           ` Bill Schmidt
@ 2019-05-23 16:45           ` Joseph Myers
  1 sibling, 0 replies; 10+ messages in thread
From: Joseph Myers @ 2019-05-23 16:45 UTC (permalink / raw)
  To: Martin Sebor; +Cc: Richard Earnshaw (lists), Bill Schmidt, gcc

On Wed, 22 May 2019, Martin Sebor wrote:

>   ISO C does not support decimal floating point

And as a tangential point, that's not accurate for C2X, where DFP is an 
optional standard feature, but it's probably reasonable to keep the 
diagnostic saying "ISO C does not support" under its existing conditions 
until someone actually reviews and updates the DFP support for the 
differences between the old TR 24732:2009 and the newer TS 18661-2 / C2X 
version (not sure how big those differences are, but not much has changed 
in the DFP support in GCC lately).

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-05-23 16:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-21 16:47 -Wformat-diag: floating-point or floating point? Martin Sebor
2019-05-21 20:18 ` Bill Schmidt
2019-05-21 21:33   ` Martin Sebor
2019-05-22 10:19   ` Richard Earnshaw (lists)
2019-05-22 12:17     ` Bill Schmidt
2019-05-22 12:28       ` Richard Earnshaw (lists)
2019-05-22 14:58         ` Martin Sebor
2019-05-22 15:04           ` Bill Schmidt
2019-05-23 16:45           ` Joseph Myers
2019-05-22 12:33       ` Richard Earnshaw (lists)

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).