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

avamingli pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit e86bac6e66bb2dacc1cd8bf5479c9fb95939832d
Author: Zhang Mingli <[email protected]>
AuthorDate: Fri May 29 19:01:37 2026 +0800

    macOS: demote clang-strict warning categories in Makefile.custom
    
    After this commit, plain 'make' (without any CUSTOM_COPT= on the
    command line) builds cleanly on macOS with Apple clang. Previously
    users had to remember a long override.
    
    The warning categories that needed demoting (darwin only):
    
      -Wuninitialized           — clang flags spots upstream gcc accepts.
      -Wgnu-variable-sized-type-not-at-end
                                — clang-only; fires on PG catalog headers
                                  like pg_task.h with inline struct-plus-
                                  trailing-text declarations.
      -Wunused-function         — clang flags static functions never
                                  referenced in the TU (a few exist in
                                  currently-disabled code paths, e.g.
                                  ic_udpifc.c).
      -Wdeprecated-non-prototype
                                — clang-only; flags K&R-style 'foo()'
                                  forward declarations. Where the
                                  mismatch is a real bug we fix it
                                  inline; this demotion covers the rest.
    
    The block is gated to PORTNAME=darwin so the Linux gcc build path
    is unchanged: -Werror remains in effect for all categories there.
---
 src/Makefile.custom | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/src/Makefile.custom b/src/Makefile.custom
index 5461d68afcf..e2d8f0f30e8 100644
--- a/src/Makefile.custom
+++ b/src/Makefile.custom
@@ -1 +1,34 @@
-CUSTOM_COPT += -Werror
\ No newline at end of file
+CUSTOM_COPT += -Werror
+
+# Apple clang is stricter than gcc on several warning categories that
+# upstream Cloudberry currently trips:
+#
+#   -Wuninitialized
+#       Fires on a few spots upstream that gcc happily accepts
+#       (e.g. functions.c on PG 16).
+#
+#   -Wgnu-variable-sized-type-not-at-end
+#       Clang-only. Fires on PG catalog headers that put a
+#       struct-with-trailing-text inline.
+#
+#   -Wunused-function
+#       Clang flags static functions never referenced anywhere in the
+#       TU; gcc's analysis is sometimes laxer. Touches isolated dead
+#       branches in a few subsystems (e.g. ic_udpifc.c).
+#
+#   -Wdeprecated-non-prototype
+#       Clang-only. Catches K&R-style `foo()` forward declarations
+#       (genuine portability concerns that gcc silently accepts).
+#       Where these turn out to be real bugs we fix them inline; the
+#       demotion is here for the residual stylistic occurrences.
+#
+# Demote them to warnings on darwin so plain `make` works. The block
+# is gated to PORTNAME=darwin so the Linux gcc build path is unchanged
+# (-Werror still in effect for all categories there). -Wno-error= for
+# a category the active compiler doesn't emit is silently ignored.
+ifeq ($(PORTNAME),darwin)
+CUSTOM_COPT += -Wno-error=uninitialized
+CUSTOM_COPT += -Wno-error=gnu-variable-sized-type-not-at-end
+CUSTOM_COPT += -Wno-error=unused-function
+CUSTOM_COPT += -Wno-error=deprecated-non-prototype
+endif
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to