Skip to content

Commit

Permalink
Silence clang's whining for PCH files.
Browse files Browse the repository at this point in the history
Clang whines about a "c-header" (.h rather than .hpp) being used in
C++ mode (note that we use compile-cpp-source to build the header).
Tell clang that we're building it as C++.

Patch contributed by @DoDoENT.

Bug: #16
Change-Id: I50803003394f28cf4f92faef13cd6ed680cbf77c
  • Loading branch information
DanAlbert committed Mar 14, 2016
1 parent f925c0e commit da081ef
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions build/core/build-binary.mk
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,10 @@ ifneq (,$(LOCAL_PCH))
# Build PCH into obj directory
LOCAL_BUILT_PCH := $(call get-pch-name,$(LOCAL_PCH))

# Clang whines about a "c-header" (.h rather than .hpp) being used in C++
# mode (note that we use compile-cpp-source to build the header).
LOCAL_SRC_FILES_TARGET_CFLAGS.$(LOCAL_PCH) += -x c++-header

# Build PCH
$(call compile-cpp-source,$(LOCAL_PCH),$(LOCAL_BUILT_PCH).gch)

Expand Down
15 changes: 15 additions & 0 deletions tests/build/pch-cpp/jni/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := pch-cpp
LOCAL_PCH := stdafx.h
LOCAL_SRC_FILES := foo.cpp
LOCAL_CFLAGS := -Werror
include $(BUILD_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := pch-c
LOCAL_PCH := stdafx.h
LOCAL_SRC_FILES := foo.c
LOCAL_CFLAGS := -Werror
include $(BUILD_SHARED_LIBRARY)
Empty file added tests/build/pch-cpp/jni/foo.c
Empty file.
Empty file added tests/build/pch-cpp/jni/foo.cpp
Empty file.
Empty file.

0 comments on commit da081ef

Please sign in to comment.