[04/11] linux: Move hidden_proto before static inline usage on not-cancel.h

Message ID 20221028173532.876027-5-adhemerval.zanella@linaro.org
State Committed
Commit d227fd53cbbc9ae7e5604da3669d04b6ccb53aa1
Headers
Series Initial fixes for clang build support |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Adhemerval Zanella Netto Oct. 28, 2022, 5:35 p.m. UTC
  It is avoid a build failure on clang where it can redeclare function
attribute after its first use.
---
 sysdeps/unix/sysv/linux/not-cancel.h | 30 ++++++++++++++--------------
 1 file changed, 15 insertions(+), 15 deletions(-)
  

Comments

Fangrui Song Oct. 29, 2022, 4:23 a.m. UTC | #1
On 2022-10-28, Adhemerval Zanella via Libc-alpha wrote:
>It is avoid a build failure on clang where it can redeclare function
>attribute after its first use.

can => can't

But, consider using a subject line similar to other "Apply asm redirection before first use" patches?

>---
> sysdeps/unix/sysv/linux/not-cancel.h | 30 ++++++++++++++--------------
> 1 file changed, 15 insertions(+), 15 deletions(-)
>
>diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
>index 93615de681..d4f1e0fbde 100644
>--- a/sysdeps/unix/sysv/linux/not-cancel.h
>+++ b/sysdeps/unix/sysv/linux/not-cancel.h
>@@ -52,6 +52,21 @@ __typeof (__write) __write_nocancel;
> /* Uncancelable close.  */
> __typeof (__close) __close_nocancel;
>
>+/* Uncancelable fcntl.  */
>+__typeof (__fcntl) __fcntl64_nocancel;
>+
>+#if IS_IN (libc) || IS_IN (rtld)
>+hidden_proto (__open_nocancel)
>+hidden_proto (__open64_nocancel)
>+hidden_proto (__openat_nocancel)
>+hidden_proto (__openat64_nocancel)
>+hidden_proto (__read_nocancel)
>+hidden_proto (__pread64_nocancel)
>+hidden_proto (__write_nocancel)
>+hidden_proto (__close_nocancel)
>+hidden_proto (__fcntl64_nocancel)
>+#endif
>+
> /* Non cancellable close syscall that does not also set errno in case of
>    failure.  */
> static inline void
>@@ -80,19 +95,4 @@ __poll_infinity_nocancel (struct pollfd *fds, nfds_t nfds)
>   return INLINE_SYSCALL_CALL (ppoll, fds, nfds, NULL, NULL, 0);
> }
>
>-/* Uncancelable fcntl.  */
>-__typeof (__fcntl) __fcntl64_nocancel;
>-
>-#if IS_IN (libc) || IS_IN (rtld)
>-hidden_proto (__open_nocancel)
>-hidden_proto (__open64_nocancel)
>-hidden_proto (__openat_nocancel)
>-hidden_proto (__openat64_nocancel)
>-hidden_proto (__read_nocancel)
>-hidden_proto (__pread64_nocancel)
>-hidden_proto (__write_nocancel)
>-hidden_proto (__close_nocancel)
>-hidden_proto (__fcntl64_nocancel)
>-#endif
>-
> #endif /* NOT_CANCEL_H  */
>-- 
>2.34.1
>

This fixed


In file included from check_fds.c:34:
../sysdeps/unix/sysv/linux/not-cancel.h:94:15: error: cannot apply asm label to function after its first use
hidden_proto (__close_nocancel)
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
./../include/libc-symbols.h:513:19: note: expanded from macro 'hidden_proto'
   __hidden_proto (name, , __GI_##name, ##attrs)
   ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../include/libc-symbols.h:519:33: note: expanded from macro '__hidden_proto'
   extern thread __typeof (name) name __asm__ (__hidden_asmname (#internal)) \
                                 ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.


Reviewed-by: Fangrui Song <maskray@google.com>
  
Adhemerval Zanella Netto Oct. 31, 2022, 7:48 p.m. UTC | #2
On 29/10/22 01:23, Fangrui Song wrote:
> On 2022-10-28, Adhemerval Zanella via Libc-alpha wrote:
>> It is avoid a build failure on clang where it can redeclare function
>> attribute after its first use.
> 
> can => can't

Ack.

> 
> But, consider using a subject line similar to other "Apply asm redirection before first use" patches?

I renamed to "Apply asm redirection in not-cancel before first use".

> 
>> ---
>> sysdeps/unix/sysv/linux/not-cancel.h | 30 ++++++++++++++--------------
>> 1 file changed, 15 insertions(+), 15 deletions(-)
>>
>> diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
>> index 93615de681..d4f1e0fbde 100644
>> --- a/sysdeps/unix/sysv/linux/not-cancel.h
>> +++ b/sysdeps/unix/sysv/linux/not-cancel.h
>> @@ -52,6 +52,21 @@ __typeof (__write) __write_nocancel;
>> /* Uncancelable close.  */
>> __typeof (__close) __close_nocancel;
>>
>> +/* Uncancelable fcntl.  */
>> +__typeof (__fcntl) __fcntl64_nocancel;
>> +
>> +#if IS_IN (libc) || IS_IN (rtld)
>> +hidden_proto (__open_nocancel)
>> +hidden_proto (__open64_nocancel)
>> +hidden_proto (__openat_nocancel)
>> +hidden_proto (__openat64_nocancel)
>> +hidden_proto (__read_nocancel)
>> +hidden_proto (__pread64_nocancel)
>> +hidden_proto (__write_nocancel)
>> +hidden_proto (__close_nocancel)
>> +hidden_proto (__fcntl64_nocancel)
>> +#endif
>> +
>> /* Non cancellable close syscall that does not also set errno in case of
>>    failure.  */
>> static inline void
>> @@ -80,19 +95,4 @@ __poll_infinity_nocancel (struct pollfd *fds, nfds_t nfds)
>>   return INLINE_SYSCALL_CALL (ppoll, fds, nfds, NULL, NULL, 0);
>> }
>>
>> -/* Uncancelable fcntl.  */
>> -__typeof (__fcntl) __fcntl64_nocancel;
>> -
>> -#if IS_IN (libc) || IS_IN (rtld)
>> -hidden_proto (__open_nocancel)
>> -hidden_proto (__open64_nocancel)
>> -hidden_proto (__openat_nocancel)
>> -hidden_proto (__openat64_nocancel)
>> -hidden_proto (__read_nocancel)
>> -hidden_proto (__pread64_nocancel)
>> -hidden_proto (__write_nocancel)
>> -hidden_proto (__close_nocancel)
>> -hidden_proto (__fcntl64_nocancel)
>> -#endif
>> -
>> #endif /* NOT_CANCEL_H  */
>> -- 
>> 2.34.1
>>
> 
> This fixed
> 
> 
> In file included from check_fds.c:34:
> ../sysdeps/unix/sysv/linux/not-cancel.h:94:15: error: cannot apply asm label to function after its first use
> hidden_proto (__close_nocancel)
> ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
> ./../include/libc-symbols.h:513:19: note: expanded from macro 'hidden_proto'
>   __hidden_proto (name, , __GI_##name, ##attrs)
>   ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ./../include/libc-symbols.h:519:33: note: expanded from macro '__hidden_proto'
>   extern thread __typeof (name) name __asm__ (__hidden_asmname (#internal)) \
>                                 ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 error generated.
> 
> 
> Reviewed-by: Fangrui Song <maskray@google.com>

Thanks.
  

Patch

diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
index 93615de681..d4f1e0fbde 100644
--- a/sysdeps/unix/sysv/linux/not-cancel.h
+++ b/sysdeps/unix/sysv/linux/not-cancel.h
@@ -52,6 +52,21 @@  __typeof (__write) __write_nocancel;
 /* Uncancelable close.  */
 __typeof (__close) __close_nocancel;
 
+/* Uncancelable fcntl.  */
+__typeof (__fcntl) __fcntl64_nocancel;
+
+#if IS_IN (libc) || IS_IN (rtld)
+hidden_proto (__open_nocancel)
+hidden_proto (__open64_nocancel)
+hidden_proto (__openat_nocancel)
+hidden_proto (__openat64_nocancel)
+hidden_proto (__read_nocancel)
+hidden_proto (__pread64_nocancel)
+hidden_proto (__write_nocancel)
+hidden_proto (__close_nocancel)
+hidden_proto (__fcntl64_nocancel)
+#endif
+
 /* Non cancellable close syscall that does not also set errno in case of
    failure.  */
 static inline void
@@ -80,19 +95,4 @@  __poll_infinity_nocancel (struct pollfd *fds, nfds_t nfds)
   return INLINE_SYSCALL_CALL (ppoll, fds, nfds, NULL, NULL, 0);
 }
 
-/* Uncancelable fcntl.  */
-__typeof (__fcntl) __fcntl64_nocancel;
-
-#if IS_IN (libc) || IS_IN (rtld)
-hidden_proto (__open_nocancel)
-hidden_proto (__open64_nocancel)
-hidden_proto (__openat_nocancel)
-hidden_proto (__openat64_nocancel)
-hidden_proto (__read_nocancel)
-hidden_proto (__pread64_nocancel)
-hidden_proto (__write_nocancel)
-hidden_proto (__close_nocancel)
-hidden_proto (__fcntl64_nocancel)
-#endif
-
 #endif /* NOT_CANCEL_H  */