diff --git a/external/android-emugl/CMakeLists.txt b/external/android-emugl/CMakeLists.txt index b328b17..28f4c87 100644 --- a/external/android-emugl/CMakeLists.txt +++ b/external/android-emugl/CMakeLists.txt @@ -1,6 +1,10 @@ # Don't treat any warnings as error as we take the source directly from # upstream and just compile it. set(CMAKE_C_FLAGS "-Wall") +set(CMAKE_CXX_FLAGS "-std=c++11 -Wall") + +# Ensure -fPIC +set(CMAKE_POSITION_INDEPENDENT_CODE ON) include_directories( ${CMAKE_SOURCE_DIR}/src diff --git a/external/android-emugl/host/include/GLES/gl.h b/external/android-emugl/host/include/GLES/gl.h index 5b8d85a..a40e29d 100644 --- a/external/android-emugl/host/include/GLES/gl.h +++ b/external/android-emugl/host/include/GLES/gl.h @@ -1,6 +1,8 @@ #ifndef __gl_h_ #define __gl_h_ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wredundant-decls" /* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -0800 #$ */ #include @@ -766,5 +768,7 @@ GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, cons } #endif +#pragma GCC diagnostic pop + #endif /* __gl_h_ */ diff --git a/external/android-emugl/host/include/libOpenglRender/IOStream.h b/external/android-emugl/host/include/libOpenglRender/IOStream.h index 9b1feaa..2f228e4 100644 --- a/external/android-emugl/host/include/libOpenglRender/IOStream.h +++ b/external/android-emugl/host/include/libOpenglRender/IOStream.h @@ -44,7 +44,7 @@ public: if (!m_buf || len > m_bufsize) { int allocLen = m_bufsize < len ? len : m_bufsize; - m_buf = (unsigned char *)allocBuffer(allocLen); + m_buf = static_cast(allocBuffer(allocLen)); if (!m_buf) return NULL; m_bufsize = m_free = allocLen; diff --git a/external/android-emugl/shared/OpenglCodecCommon/ChecksumCalculator.h b/external/android-emugl/shared/OpenglCodecCommon/ChecksumCalculator.h index 4cc231a..d315304 100644 --- a/external/android-emugl/shared/OpenglCodecCommon/ChecksumCalculator.h +++ b/external/android-emugl/shared/OpenglCodecCommon/ChecksumCalculator.h @@ -24,9 +24,9 @@ #define TRACE_CHECKSUMHELPER 0 #if TRACE_CHECKSUMHELPER -#define LOG_CHECKSUMHELPER(x...) fprintf(stderr, x) +#define LOG_CHECKSUMHELPER(...) fprintf(stderr, __VA_ARGS__) #else -#define LOG_CHECKSUMHELPER(x...) +#define LOG_CHECKSUMHELPER(...) #endif // ChecksumCalculator adds checksum as an array of bytes to GL pipe communication, which diff --git a/external/android-emugl/shared/OpenglCodecCommon/glUtils.h b/external/android-emugl/shared/OpenglCodecCommon/glUtils.h index 73c1912..63b35cc 100644 --- a/external/android-emugl/shared/OpenglCodecCommon/glUtils.h +++ b/external/android-emugl/shared/OpenglCodecCommon/glUtils.h @@ -37,5 +37,5 @@ void glUtilsPackPointerData(unsigned char *dst, unsigned char *str, int glUtilsPixelBitSize(GLenum format, GLenum type); #ifdef __cplusplus -}; +} #endif diff --git a/external/android-emugl/shared/emugl/common/logging.h b/external/android-emugl/shared/emugl/common/logging.h index 8a6b413..d8b00bd 100644 --- a/external/android-emugl/shared/emugl/common/logging.h +++ b/external/android-emugl/shared/emugl/common/logging.h @@ -14,6 +14,9 @@ * limitations under the License. */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wredundant-decls" + typedef void (*logger_t)(const char* fmt, ...); extern logger_t emugl_logger; extern logger_t emugl_cxt_logger; @@ -35,3 +38,5 @@ void set_emugl_cxt_logger(logger_t f); #else #define GL_LOG(...) 0 #endif + +#pragma GCC diagnostic pop diff --git a/external/xdg/CMakeLists.txt b/external/xdg/CMakeLists.txt index 57089c3..f19f69d 100644 --- a/external/xdg/CMakeLists.txt +++ b/external/xdg/CMakeLists.txt @@ -19,6 +19,6 @@ enable_testing() add_definitions(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN -DBOOST_TEST_MODULE=xdg) add_executable(xdg_test xdg_test.cpp) set_property(TARGET xdg_test PROPERTY CXX_STANDARD 11) -target_link_libraries(xdg_test xdg) +target_link_libraries(xdg_test xdg ${Boost_LIBRARIES}) add_test(xdg_test xdg_test) diff --git a/src/anbox/cmds/container_manager.cpp b/src/anbox/cmds/container_manager.cpp index fba7492..9ff9c22 100644 --- a/src/anbox/cmds/container_manager.cpp +++ b/src/anbox/cmds/container_manager.cpp @@ -26,7 +26,7 @@ anbox::cmds::ContainerManager::ContainerManager() : CommandWithFlagsAndAction{ cli::Name{"container-manager"}, cli::Usage{"container-manager"}, cli::Description{"Start the container manager service"}} { - action([](const cli::Command::Context& ctxt) { + action([](const cli::Command::Context&) { auto trap = core::posix::trap_signals_for_process( {core::posix::Signal::sig_term, core::posix::Signal::sig_int}); trap->signal_raised().connect([trap](const core::posix::Signal& signal) { diff --git a/src/anbox/cmds/run.cpp b/src/anbox/cmds/run.cpp index c9209ad..aa03481 100644 --- a/src/anbox/cmds/run.cpp +++ b/src/anbox/cmds/run.cpp @@ -15,6 +15,8 @@ * */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wswitch-default" #include #include "core/posix/signal.h" @@ -46,6 +48,7 @@ #include #include +#pragma GCC diagnostic pop namespace fs = boost::filesystem; @@ -82,7 +85,7 @@ anbox::cmds::Run::Run(const BusFactory &bus_factory) cli::Description{"Icon of the application to run"}, icon_)); - action([this](const cli::Command::Context &ctx) { + action([this](const cli::Command::Context &) { auto trap = core::posix::trap_signals_for_process( {core::posix::Signal::sig_term, core::posix::Signal::sig_int}); trap->signal_raised().connect([trap](const core::posix::Signal &signal) { diff --git a/src/anbox/common/scope_ptr.h b/src/anbox/common/scope_ptr.h index 3499a80..d59b6e3 100644 --- a/src/anbox/common/scope_ptr.h +++ b/src/anbox/common/scope_ptr.h @@ -25,7 +25,7 @@ namespace common { struct FreeDelete { template void operator()(T ptr) const { - free((void*)ptr); + free(ptr); } }; diff --git a/src/anbox/common/small_vector.h b/src/anbox/common/small_vector.h index 886620e..5193b1f 100644 --- a/src/anbox/common/small_vector.h +++ b/src/anbox/common/small_vector.h @@ -207,7 +207,7 @@ class SmallVector { void set_capacity(size_type newCap) { // Here we can only be switching to the dynamic vector, as static one // always has its capacity on the maximum. - const auto newBegin = (T*)malloc(sizeof(T) * newCap); + const auto newBegin = static_cast(malloc(sizeof(T) * newCap)); if (!newBegin) { abort(); // what else can we do here? } @@ -235,7 +235,7 @@ class SmallVector { // This function returns that address, and SmallFixedVector<> has a static // assert to make sure it remains correct. constexpr const void* smallBufferStart() const { - return (const void*)(&mCapacity + 1); + return static_cast(&mCapacity + 1); } // Standard set of members for a vector - begin, end and capacity. @@ -267,14 +267,6 @@ class SmallFixedVector : public SmallVector { // Default constructor - set up an empty vector with capacity at full // internal array size. SmallFixedVector() { - // Make sure that the small array starts exactly where base class - // expects it: right after the |mCapacity|. - static_assert(offsetof(base, mCapacity) + sizeof(base::mCapacity) == - offsetof(SmallFixedVector, mData) && - offsetof(Data, array) == 0, - "SmallFixedVector<> class layout is wrong, " - "|mData| needs to follow |mCapacity|"); - init_inplace(); } diff --git a/src/anbox/graphics/emugl/ColorBuffer.cpp b/src/anbox/graphics/emugl/ColorBuffer.cpp index 7f1811d..d2162a9 100644 --- a/src/anbox/graphics/emugl/ColorBuffer.cpp +++ b/src/anbox/graphics/emugl/ColorBuffer.cpp @@ -32,7 +32,7 @@ namespace { // implemented as unsigned integers. These convenience template functions // help casting between them safely without generating compiler warnings. inline void* SafePointerFromUInt(unsigned int handle) { - return (void*)(uintptr_t)(handle); + return reinterpret_cast(static_cast(handle)); } inline unsigned int SafeUIntFromPointer(const void* ptr) { @@ -40,7 +40,7 @@ inline unsigned int SafeUIntFromPointer(const void* ptr) { // Ignore the assert below to avoid crashing when running older // system images, which might have buggy encoder libraries. Print // an error message though. - if ((uintptr_t)(ptr) != (unsigned int)(uintptr_t)(ptr)) { + if (reinterpret_cast(ptr) != static_cast(reinterpret_cast(ptr))) { fprintf(stderr, "EmuGL:WARNING: bad generic pointer %p\n", ptr); } #else @@ -48,7 +48,7 @@ inline unsigned int SafeUIntFromPointer(const void* ptr) { // in an unsigned integer! assert((uintptr_t)(ptr) == (unsigned int)(uintptr_t)(ptr)); #endif - return (unsigned int)(uintptr_t)(ptr); + return static_cast(reinterpret_cast(ptr)); } // Lazily create and bind a framebuffer object to the current host context. @@ -181,11 +181,11 @@ ColorBuffer* ColorBuffer::create(EGLDisplay p_display, int p_width, if (has_eglimage_texture_2d) { cb->m_eglImage = s_egl.eglCreateImageKHR( p_display, s_egl.eglGetCurrentContext(), EGL_GL_TEXTURE_2D_KHR, - (EGLClientBuffer)SafePointerFromUInt(cb->m_tex), NULL); + reinterpret_cast(SafePointerFromUInt(cb->m_tex)), NULL); cb->m_blitEGLImage = s_egl.eglCreateImageKHR( p_display, s_egl.eglGetCurrentContext(), EGL_GL_TEXTURE_2D_KHR, - (EGLClientBuffer)SafePointerFromUInt(cb->m_blitTex), NULL); + reinterpret_cast(SafePointerFromUInt(cb->m_blitTex)), NULL); } cb->m_resizer = new TextureResize(p_width, p_height); diff --git a/src/anbox/graphics/emugl/ReadBuffer.cpp b/src/anbox/graphics/emugl/ReadBuffer.cpp index b5a0fdb..b102027 100644 --- a/src/anbox/graphics/emugl/ReadBuffer.cpp +++ b/src/anbox/graphics/emugl/ReadBuffer.cpp @@ -21,7 +21,7 @@ ReadBuffer::ReadBuffer(size_t bufsize) { m_size = bufsize; - m_buf = (unsigned char*)malloc(m_size * sizeof(unsigned char)); + m_buf = static_cast(malloc(m_size * sizeof(unsigned char))); m_validData = 0; m_readPtr = m_buf; } @@ -43,7 +43,7 @@ int ReadBuffer::getData(IOStream* stream) { new_size = INT_MAX; } - new_buf = (unsigned char*)realloc(m_buf, new_size); + new_buf = static_cast(realloc(m_buf, new_size)); if (!new_buf) { ERR("Failed to alloc %zu bytes for ReadBuffer\n", new_size); return -1; diff --git a/src/anbox/graphics/emugl/RenderControl.cpp b/src/anbox/graphics/emugl/RenderControl.cpp index d7065f7..6027080 100644 --- a/src/anbox/graphics/emugl/RenderControl.cpp +++ b/src/anbox/graphics/emugl/RenderControl.cpp @@ -49,8 +49,8 @@ static EGLint rcGetEGLVersion(EGLint *major, EGLint *minor) { if (!renderer) return EGL_FALSE; - *major = (EGLint)renderer->getCaps().eglMajor; - *minor = (EGLint)renderer->getCaps().eglMinor; + *major = static_cast(renderer->getCaps().eglMajor); + *minor = static_cast(renderer->getCaps().eglMinor); return EGL_TRUE; } @@ -69,7 +69,7 @@ static EGLint rcQueryEGLString(EGLenum name, void *buffer, EGLint bufferSize) { return -len; } - strcpy((char *)buffer, str); + strcpy(static_cast(buffer), str); return len; } @@ -131,7 +131,7 @@ static EGLint rcGetNumConfigs(uint32_t *p_numAttribs) { } static EGLint rcGetConfigs(uint32_t bufSize, GLuint *buffer) { - GLuint bufferSize = (GLuint)bufSize; + GLuint bufferSize = static_cast(bufSize); return renderer->getConfigs()->packConfigs(bufferSize, buffer); } @@ -140,8 +140,8 @@ static EGLint rcChooseConfig(EGLint *attribs, uint32_t attribs_size, if (!renderer || attribs_size == 0) return 0; - return renderer->getConfigs()->chooseConfig(attribs, (EGLint *)configs, - (EGLint)configs_size); + return renderer->getConfigs()->chooseConfig(attribs, reinterpret_cast(configs), + static_cast(configs_size)); } static EGLint rcGetFBParam(EGLint param) { @@ -269,9 +269,9 @@ static EGLint rcMakeCurrent(uint32_t context, uint32_t drawSurf, return (ret ? EGL_TRUE : EGL_FALSE); } -static void rcFBPost(uint32_t colorBuffer) { WARNING("Not implemented"); } +static void rcFBPost(uint32_t) { WARNING("Not implemented"); } -static void rcFBSetSwapInterval(EGLint interval) { +static void rcFBSetSwapInterval(EGLint) { // XXX: TBD - should be implemented } @@ -289,8 +289,8 @@ static void rcBindRenderbuffer(uint32_t colorBuffer) { renderer->bindColorBufferToRenderbuffer(colorBuffer); } -static EGLint rcColorBufferCacheFlush(uint32_t colorBuffer, EGLint postCount, - int forRead) { +static EGLint rcColorBufferCacheFlush(uint32_t, EGLint, + int) { // XXX: TBD - should be implemented return 0; } @@ -329,7 +329,7 @@ static int rcDestroyClientImage(uint32_t image) { return renderer->destroyClientImage(image); } -static void rcSelectChecksumCalculator(uint32_t protocol, uint32_t reserved) { +static void rcSelectChecksumCalculator(uint32_t protocol, uint32_t) { ChecksumCalculatorThreadInfo::setVersion(protocol); } diff --git a/src/anbox/graphics/emugl/Renderer.cpp b/src/anbox/graphics/emugl/Renderer.cpp index fe8988e..5ebbd8a 100644 --- a/src/anbox/graphics/emugl/Renderer.cpp +++ b/src/anbox/graphics/emugl/Renderer.cpp @@ -101,7 +101,7 @@ static char *getGLES1ExtensionString(EGLDisplay p_dpy) { return NULL; } - DBG("%s: Found config %p\n", __FUNCTION__, (void *)config); + DBG("%s: Found config %p\n", __FUNCTION__, reinterpret_cast(config)); static const EGLint pbufAttribs[] = {EGL_WIDTH, 1, EGL_HEIGHT, 1, EGL_NONE}; @@ -130,7 +130,7 @@ static char *getGLES1ExtensionString(EGLDisplay p_dpy) { } // the string pointer may become invalid when the context is destroyed - const char *s = (const char *)s_gles1.glGetString(GL_EXTENSIONS); + const char *s = reinterpret_cast(s_gles1.glGetString(GL_EXTENSIONS)); char *extString = strdup(s ? s : ""); s_egl.eglMakeCurrent(p_dpy, NULL, NULL, NULL); @@ -273,7 +273,7 @@ bool Renderer::initialize(EGLNativeDisplayType nativeDisplay) { if (has_gl_oes_image) { has_gl_oes_image &= strstr(gles1Extensions, "GL_OES_EGL_image") != NULL; } - free((void *)gles1Extensions); + free(gles1Extensions); gles1Extensions = NULL; const char *eglExtensions = @@ -351,9 +351,9 @@ bool Renderer::initialize(EGLNativeDisplayType nativeDisplay) { // Cache the GL strings so we don't have to think about threading or // current-context when asked for them. // - m_glVendor = (const char *)s_gles2.glGetString(GL_VENDOR); - m_glRenderer = (const char *)s_gles2.glGetString(GL_RENDERER); - m_glVersion = (const char *)s_gles2.glGetString(GL_VERSION); + m_glVendor = reinterpret_cast(s_gles2.glGetString(GL_VENDOR)); + m_glRenderer = reinterpret_cast(s_gles2.glGetString(GL_RENDERER)); + m_glVersion = reinterpret_cast(s_gles2.glGetString(GL_VERSION)); m_textureDraw = new TextureDraw(m_eglDisplay); if (!m_textureDraw) { @@ -831,7 +831,7 @@ HandleType Renderer::createClientImage(HandleType context, EGLenum target, s_egl.eglCreateImageKHR(m_eglDisplay, eglContext, target, reinterpret_cast(buffer), NULL); - return (HandleType) reinterpret_cast(image); + return static_cast(reinterpret_cast(image)); } EGLBoolean Renderer::destroyClientImage(HandleType image) { @@ -1022,7 +1022,9 @@ void Renderer::draw(RendererWindow *window, const Renderable &renderable, s_gles2.glEnableVertexAttribArray(prog.texcoord_attr); m_primitives.clear(); - tessellate(m_primitives, {cb->getWidth(), cb->getHeight()}, renderable); + tessellate(m_primitives, { + static_cast(cb->getWidth()), + static_cast(cb->getHeight())}, renderable); for (auto const &p : m_primitives) { cb->bind(); diff --git a/src/anbox/graphics/emugl/RendererConfig.cpp b/src/anbox/graphics/emugl/RendererConfig.cpp index 9493c42..85d722b 100644 --- a/src/anbox/graphics/emugl/RendererConfig.cpp +++ b/src/anbox/graphics/emugl/RendererConfig.cpp @@ -90,7 +90,7 @@ RendererConfigList::RendererConfigList(EGLDisplay display) : mCount(0), mConfigs(NULL), mDisplay(display) { if (display == EGL_NO_DISPLAY) { E("%s: Invalid display value %p (EGL_NO_DISPLAY)\n", __FUNCTION__, - (void*)display); + reinterpret_cast(display)); return; } @@ -199,7 +199,7 @@ int RendererConfigList::chooseConfig(const EGLint* attribs, EGLint* configs, if (guestConfigId == hostConfigId) { // There is a match. Write it to |configs| if it is not NULL. if (configs && result < configsSize) { - configs[result] = (uint32_t)k; + configs[result] = static_cast(k); } result++; break; diff --git a/src/anbox/graphics/emugl/RendererConfig.h b/src/anbox/graphics/emugl/RendererConfig.h index 5dfcb89..eb33db9 100644 --- a/src/anbox/graphics/emugl/RendererConfig.h +++ b/src/anbox/graphics/emugl/RendererConfig.h @@ -54,7 +54,7 @@ class RendererConfig { // Get the EGL_CONFIG_ID value. This is the same as the one of the // underlying host EGLConfig handle. - GLint getConfigId() const { return (GLint)getAttribValue(4); } + GLint getConfigId() const { return static_cast(getAttribValue(4)); } private: RendererConfig(); diff --git a/src/anbox/graphics/emugl/TextureResize.cpp b/src/anbox/graphics/emugl/TextureResize.cpp index 5aeab99..be02a7f 100644 --- a/src/anbox/graphics/emugl/TextureResize.cpp +++ b/src/anbox/graphics/emugl/TextureResize.cpp @@ -189,13 +189,7 @@ static void attachShaders(TextureResize::Framebuffer* fb, TextureResize::TextureResize(GLuint width, GLuint height) : mWidth(width), mHeight(height), - mFactor(1), - mFBWidth({ - 0, - }), - mFBHeight({ - 0, - }) { + mFactor(1) { s_gles2.glGenTextures(1, &mFBWidth.texture); s_gles2.glBindTexture(GL_TEXTURE_2D, mFBWidth.texture); s_gles2.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); diff --git a/src/anbox/graphics/emugl/TextureResize.h b/src/anbox/graphics/emugl/TextureResize.h index 1b81a63..8024761 100644 --- a/src/anbox/graphics/emugl/TextureResize.h +++ b/src/anbox/graphics/emugl/TextureResize.h @@ -28,11 +28,11 @@ class TextureResize { GLuint update(GLuint texture); struct Framebuffer { - GLuint texture; - GLuint framebuffer; - GLuint program; - GLuint aPosition; - GLuint uTexture; + GLuint texture = 0; + GLuint framebuffer = 0; + GLuint program = 0; + GLuint aPosition = 0; + GLuint uTexture = 0; }; private: diff --git a/src/anbox/graphics/emugl/WindowSurface.cpp b/src/anbox/graphics/emugl/WindowSurface.cpp index 583d3e3..e3dd758 100644 --- a/src/anbox/graphics/emugl/WindowSurface.cpp +++ b/src/anbox/graphics/emugl/WindowSurface.cpp @@ -152,7 +152,7 @@ bool WindowSurface::resize(unsigned int p_width, unsigned int p_height) { // Create pbuffer surface. // const EGLint pbufAttribs[5] = { - EGL_WIDTH, (EGLint)p_width, EGL_HEIGHT, (EGLint)p_height, EGL_NONE, + EGL_WIDTH, static_cast(p_width), EGL_HEIGHT, static_cast(p_height), EGL_NONE, }; mSurface = s_egl.eglCreatePbufferSurface(mDisplay, mConfig, pbufAttribs); diff --git a/src/anbox/qemu/pipe_connection_creator.cpp b/src/anbox/qemu/pipe_connection_creator.cpp index 06b9dde..b2005c3 100644 --- a/src/anbox/qemu/pipe_connection_creator.cpp +++ b/src/anbox/qemu/pipe_connection_creator.cpp @@ -57,6 +57,8 @@ std::string client_type_to_string( return "boot-animation"; case anbox::qemu::PipeConnectionCreator::client_type::invalid: break; + default: + break; } return "unknown"; } diff --git a/src/anbox/qemu/qemud_message_processor.cpp b/src/anbox/qemu/qemud_message_processor.cpp index ad7c544..6798766 100644 --- a/src/anbox/qemu/qemud_message_processor.cpp +++ b/src/anbox/qemu/qemud_message_processor.cpp @@ -71,7 +71,7 @@ void QemudMessageProcessor::process_commands() { void QemudMessageProcessor::send_header(const size_t &size) { char header[header_size + 1]; - std::snprintf(header, header_size + 1, "%04x", size); + std::snprintf(header, header_size + 1, "%04lu", size); messenger_->send(header, header_size); } diff --git a/src/anbox/rpc/message_processor.h b/src/anbox/rpc/message_processor.h index 0bec3f3..4c1dd42 100644 --- a/src/anbox/rpc/message_processor.h +++ b/src/anbox/rpc/message_processor.h @@ -58,8 +58,8 @@ class MessageProcessor : public network::MessageProcessor { void send_response(::google::protobuf::uint32 id, google::protobuf::MessageLite* response); - virtual void dispatch(Invocation const& invocation) {} - virtual void process_event_sequence(const std::string& event) {} + virtual void dispatch(Invocation const&) {} + virtual void process_event_sequence(const std::string&) {} private: std::shared_ptr sender_; diff --git a/src/anbox/ubuntu/audio_sink.cpp b/src/anbox/ubuntu/audio_sink.cpp index a4d3005..58ab813 100644 --- a/src/anbox/ubuntu/audio_sink.cpp +++ b/src/anbox/ubuntu/audio_sink.cpp @@ -72,7 +72,7 @@ void AudioSink::disconnect_audio() { void AudioSink::read_data(std::uint8_t *buffer, int size) { std::unique_lock l(lock_); const auto wanted = size; - size_t count = 0; + int count = 0; auto dst = buffer; while (count < wanted) { diff --git a/src/anbox/ubuntu/keycode_converter.cpp b/src/anbox/ubuntu/keycode_converter.cpp index bcd4dfa..2b2a617 100644 --- a/src/anbox/ubuntu/keycode_converter.cpp +++ b/src/anbox/ubuntu/keycode_converter.cpp @@ -14,8 +14,10 @@ * with this program. If not, see . * */ - +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wswitch-default" #include "anbox/ubuntu/keycode_converter.h" +#pragma GCC diagnostic pop #include diff --git a/src/anbox/ubuntu/platform_policy.cpp b/src/anbox/ubuntu/platform_policy.cpp index b7e43d7..f60db21 100644 --- a/src/anbox/ubuntu/platform_policy.cpp +++ b/src/anbox/ubuntu/platform_policy.cpp @@ -15,6 +15,8 @@ * */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wswitch-default" #include "anbox/ubuntu/platform_policy.h" #include "anbox/bridge/android_api_stub.h" #include "anbox/input/device.h" @@ -28,6 +30,7 @@ #include #include +#pragma GCC diagnostic pop namespace anbox { namespace ubuntu { @@ -123,6 +126,8 @@ void PlatformPolicy::process_events() { case SDL_KEYUP: process_input_event(event); break; + default: + break; } } } diff --git a/src/anbox/ubuntu/window.cpp b/src/anbox/ubuntu/window.cpp index 6f4ba67..8140c99 100644 --- a/src/anbox/ubuntu/window.cpp +++ b/src/anbox/ubuntu/window.cpp @@ -15,6 +15,8 @@ * */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wswitch-default" #include "anbox/ubuntu/window.h" #include "anbox/logger.h" #include "anbox/wm/window_state.h" @@ -22,6 +24,7 @@ #include #include +#pragma GCC diagnostic pop namespace anbox { namespace ubuntu { @@ -93,6 +96,8 @@ void Window::process_event(const SDL_Event &event) { case SDL_WINDOWEVENT_CLOSE: if (observer_) observer_->window_deleted(id_); break; + default: + break; } } diff --git a/tests/anbox/graphics/buffer_queue_tests.cpp b/tests/anbox/graphics/buffer_queue_tests.cpp index 6ca430a..38a391d 100644 --- a/tests/anbox/graphics/buffer_queue_tests.cpp +++ b/tests/anbox/graphics/buffer_queue_tests.cpp @@ -124,7 +124,7 @@ class TestThread final { // Call end_pop() to get the command's result, as well as the popped // buffer if it is 0. bool start_pop() { - input_.send(Request{Cmd::Pop}); + input_.send(Request{Cmd::Pop, Buffer{}}); return true; } @@ -140,12 +140,12 @@ class TestThread final { // Tell the test thread to close the queue from its side. void do_close() { - input_.send(Request{Cmd::Close}); + input_.send(Request{Cmd::Close, Buffer{}}); } // Tell the test thread to stop after completing its current command. void stop() { - input_.send(Request{Cmd::Stop}); + input_.send(Request{Cmd::Stop, Buffer{}}); thread_.join(); } diff --git a/tests/anbox/graphics/buffered_io_stream_tests.cpp b/tests/anbox/graphics/buffered_io_stream_tests.cpp index d542dd1..1a37986 100644 --- a/tests/anbox/graphics/buffered_io_stream_tests.cpp +++ b/tests/anbox/graphics/buffered_io_stream_tests.cpp @@ -130,10 +130,11 @@ TEST(BufferedIOStream, ReadWithNoDataAvailable) { } }); - size_t size{10}; + constexpr size_t size{10}; std::uint8_t read_data[size] = {0x0}; - EXPECT_NE(nullptr, stream.read(read_data, &size)); - EXPECT_EQ(2, size); + size_t read = 10; + EXPECT_NE(nullptr, stream.read(read_data, &read)); + EXPECT_EQ(2, read); EXPECT_EQ(0x12, read_data[0]); EXPECT_EQ(0x34, read_data[1]);