This is an automated email from the ASF dual-hosted git repository.

paleolimbot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-nanoarrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 529db2da chore(r): Fix -Wkeyword-macro for flatcc header when compiled 
with C23 (#742)
529db2da is described below

commit 529db2da549e16bc96e5886a3219adcdd1976ec7
Author: Dewey Dunnington <de...@dunnington.ca>
AuthorDate: Mon Apr 14 21:23:39 2025 -0500

    chore(r): Fix -Wkeyword-macro for flatcc header when compiled with C23 
(#742)
    
    Closes #740.
    
    I check with `usethis::edit_r_makevars()`:
    
    ```
    CC=clang -std=c2x
    CFLAGS=-Wkeyword-macro
    ```
    
    The error doesn't reproduce on `r-hub/containers/clang20`, possibly
    because it's not using `-std=c23` or didn't build clang with the option
    to use that as the default C standard.
---
 thirdparty/flatcc/include/flatcc/portable/pstdalign.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/thirdparty/flatcc/include/flatcc/portable/pstdalign.h 
b/thirdparty/flatcc/include/flatcc/portable/pstdalign.h
index 169fe27e..989792eb 100644
--- a/thirdparty/flatcc/include/flatcc/portable/pstdalign.h
+++ b/thirdparty/flatcc/include/flatcc/portable/pstdalign.h
@@ -140,6 +140,9 @@ extern "C" {
 
 #endif /* __STDC__ */
 
+// For C23, alignas/alignof are keywords and will warn (-Wkeyword-macro) when 
#defined here
+#if !(defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && 
__STDC_VERSION__ >= 202311L)
+
 #ifndef alignas
 #define alignas _Alignas
 #endif
@@ -148,6 +151,8 @@ extern "C" {
 #define alignof _Alignof
 #endif
 
+#endif
+
 #define __alignas_is_defined 1
 #define __alignof_is_defined 1
 

Reply via email to