From 24cd98eef88ac93f80c327f8d74f0a1ae0aceee4 Mon Sep 17 00:00:00 2001 From: Jesse Hall Date: Sun, 13 Jul 2014 14:37:16 -0700 Subject: [PATCH] Compile libsurfaceflinger with Clang and -std=c++11 [DO NOT MERGE] This is necessary to use C11/C++11 stdlib atomics, which the next change will do. This change also fixes a couple bits of syntax that both GCC and Clang refuse to compile in -std=c++11 mode. Change-Id: Ia14d9d6b537a3bb106c23e19a277e48be180754c --- services/surfaceflinger/Android.mk | 3 +++ services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp | 6 +++--- services/surfaceflinger/SurfaceFlinger.cpp | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk index 0e15506d5e..888d2f8114 100644 --- a/services/surfaceflinger/Android.mk +++ b/services/surfaceflinger/Android.mk @@ -1,6 +1,8 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) +LOCAL_CLANG := true + LOCAL_SRC_FILES:= \ Client.cpp \ DisplayDevice.cpp \ @@ -81,6 +83,7 @@ else endif LOCAL_CFLAGS += -fvisibility=hidden +LOCAL_CFLAGS += -std=c++11 LOCAL_SHARED_LIBRARIES := \ libcutils \ diff --git a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp index 3442c652cf..ad7cd2590b 100644 --- a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp +++ b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp @@ -28,11 +28,11 @@ static const bool sForceHwcCopy = true; static const bool sForceHwcCopy = false; #endif -#define VDS_LOGE(msg, ...) ALOGE("[%s] "msg, \ +#define VDS_LOGE(msg, ...) ALOGE("[%s] " msg, \ mDisplayName.string(), ##__VA_ARGS__) -#define VDS_LOGW_IF(cond, msg, ...) ALOGW_IF(cond, "[%s] "msg, \ +#define VDS_LOGW_IF(cond, msg, ...) ALOGW_IF(cond, "[%s] " msg, \ mDisplayName.string(), ##__VA_ARGS__) -#define VDS_LOGV(msg, ...) ALOGV("[%s] "msg, \ +#define VDS_LOGV(msg, ...) ALOGV("[%s] " msg, \ mDisplayName.string(), ##__VA_ARGS__) static const char* dbgCompositionTypeStr(DisplaySurface::CompositionType type) { diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 4238ef8387..cfedd0c0ce 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2380,8 +2380,8 @@ void SurfaceFlinger::dumpAllLocked(const Vector& args, size_t& index, colorizer.bold(result); result.append("DispSync configuration: "); colorizer.reset(result); - result.appendFormat("app phase %"PRId64" ns, sf phase %"PRId64" ns, " - "present offset %d ns (refresh %"PRId64" ns)", + result.appendFormat("app phase %" PRId64 " ns, sf phase %" PRId64 " ns, " + "present offset %d ns (refresh %" PRId64 " ns)", vsyncPhaseOffsetNs, sfVsyncPhaseOffsetNs, PRESENT_TIME_OFFSET_FROM_VSYNC_NS, mHwc->getRefreshPeriod(HWC_DISPLAY_PRIMARY)); result.append("\n"); @@ -2508,7 +2508,7 @@ bool SurfaceFlinger::startDdmConnection() } void (*DdmConnection_start)(const char* name); DdmConnection_start = - (typeof DdmConnection_start)dlsym(libddmconnection_dso, "DdmConnection_start"); + (decltype(DdmConnection_start))dlsym(libddmconnection_dso, "DdmConnection_start"); if (!DdmConnection_start) { dlclose(libddmconnection_dso); return false; -- 2.11.0