Android.mk: Fix c11-related build failures
authorRoman Stratiienko <r.stratiienko@gmail.com>
Thu, 16 Jun 2022 10:32:56 +0000 (13:32 +0300)
committerMarge Bot <emma+marge@anholt.net>
Fri, 17 Jun 2022 12:28:46 +0000 (12:28 +0000)
When building with Android.mk we are ending-up with:

    gcc ..... -std=gnu99 .... -std=c11 .... target.o
              ^^^^^^^^^^      ^^^^^^^^
                   |              |
    _______________^_____    _____^___________
     AOSP/KATI GENERATED      MESON GENERATED

Some compilers uses first -std=gnu99 option and ignores second,
which results:

    c99 implicit declaration of function static_assert()

This patch filters-out the first '-std=gnu99' from the cflags obtained
from AOSP/KATI dummy target output to avoid such kind of errors.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Mauro Rossi <issor.oruam@gmail.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17078>

android/mesa3d_cross.mk

index b3cc094..92bb2b2 100644 (file)
@@ -203,10 +203,8 @@ define m-c-flags
 endef
 
 define filter-c-flags
-  $(subst -std=gnu++17,, \
-  $(subst -fno-rtti,, \
-  $(patsubst  -W%,, \
-    $1)))
+  $(filter-out -std=gnu++17 -std=gnu99 -fno-rtti, \
+    $(patsubst  -W%,, $1))
 endef
 
 define m-c-abs-includes