Failing misc/check-installed-headers-c with new kernel headers.

Message ID 87zhs0ti16.fsf@oldenburg2.str.redhat.com
State Dropped
Headers

Commit Message

Florian Weimer Jan. 16, 2019, 9:21 p.m. UTC
  * Carlos O'Donell:

> Should we expand the regexp in some way to ignore text within single-line
> comments that we can easily detect?

I think we should use #pragma GCC poison in $cih_test_c, like this:


And then get rid of the grep.

Thanks,
Florian
  

Comments

Carlos O'Donell Jan. 17, 2019, 2:49 a.m. UTC | #1
On 1/16/19 4:21 PM, Florian Weimer wrote:
> * Carlos O'Donell:
> 
>> Should we expand the regexp in some way to ignore text within single-line
>> comments that we can easily detect?
> 
> I think we should use #pragma GCC poison in $cih_test_c, like this:
> 
> diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
> index 8e7beffd82..f9e39eb995 100644
> --- a/scripts/check-installed-headers.sh
> +++ b/scripts/check-installed-headers.sh
> @@ -144,6 +144,12 @@ EOF
>     inappropriate for this test.  */
>  #undef _LIBC
>  #undef _GNU_SOURCE
> +
> +/* Obsolete type names.  */
> +#pragma GCC poison ushort
> +#pragma GCC poison ulong
> +#pragma GCC poison uint
> +
>  /* The library mode is selected here rather than on the command line to
>     ensure that this selection wins. */
>  $expanded_lib_mode
> 
> And then get rid of the grep.

I like this solution, but it drastically complicates the test.

It's certainly more robust than the regexp.

The problem is that you have to split the tail part of the
test into 2 compilations.

One to test for obsolete types, and another to test for the
correct compilation under the std/macro test matrix.

You can no longer keep the two together because the poison
always triggers on the old types in the base headers.

And when you're looking for poisoning you now have to go
through all the raised compiler errors just like you would
for headers, and exclude any from headers that are allowed
to have the obsolete types.

I guess all-in-all it's more robust, but more work than
I was expecting :/
  
Florian Weimer Jan. 18, 2019, 10:15 a.m. UTC | #2
* Carlos O'Donell:

> On 1/16/19 4:21 PM, Florian Weimer wrote:
>> * Carlos O'Donell:
>> 
>>> Should we expand the regexp in some way to ignore text within single-line
>>> comments that we can easily detect?
>> 
>> I think we should use #pragma GCC poison in $cih_test_c, like this:
>> 
>> diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
>> index 8e7beffd82..f9e39eb995 100644
>> --- a/scripts/check-installed-headers.sh
>> +++ b/scripts/check-installed-headers.sh
>> @@ -144,6 +144,12 @@ EOF
>>     inappropriate for this test.  */
>>  #undef _LIBC
>>  #undef _GNU_SOURCE
>> +
>> +/* Obsolete type names.  */
>> +#pragma GCC poison ushort
>> +#pragma GCC poison ulong
>> +#pragma GCC poison uint
>> +
>>  /* The library mode is selected here rather than on the command line to
>>     ensure that this selection wins. */
>>  $expanded_lib_mode
>> 
>> And then get rid of the grep.
>
> I like this solution, but it drastically complicates the test.

It does not work because use in an unexpanded macro does not count as
use for poisoning.  I find that rather surprising, based on the
documentation of the pragma.

Thanks,
Florian
  

Patch

diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index 8e7beffd82..f9e39eb995 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -144,6 +144,12 @@  EOF
    inappropriate for this test.  */
 #undef _LIBC
 #undef _GNU_SOURCE
+
+/* Obsolete type names.  */
+#pragma GCC poison ushort
+#pragma GCC poison ulong
+#pragma GCC poison uint
+
 /* The library mode is selected here rather than on the command line to
    ensure that this selection wins. */
 $expanded_lib_mode