From fccb27885a1ffe67c89d16f4f65db464648f35ba Mon Sep 17 00:00:00 2001 From: Jamie Nicol Date: Mon, 27 Jul 2020 17:44:49 +0100 Subject: [PATCH] optimizer: fix compiler warnings Define _GNU_SOURCE on Linux, to avoid warnings about pthread_setname_np being implicitly defined. Add parentheses around assignment as loop condition. Set C++11 as the standard. --- CMakeLists.txt | 3 +++ src/compiler/glsl/ir_print_glsl_visitor.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e8409ac0de..1ae76bbed9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,8 @@ project(glsl_optimizer VERSION 0.1 DESCRIPTION "GLSL Optimizer" LANGUAGES C CXX) +set(CMAKE_CXX_STANDARD 11) + include_directories(include) include_directories(src/mesa) include_directories(src/mapi) @@ -16,6 +18,7 @@ include_directories(src/util) add_definitions(-D__STDC_FORMAT_MACROS) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + add_definitions(-D_GNU_SOURCE) add_definitions(-DHAVE_ENDIAN_H) endif() if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") diff --git a/src/compiler/glsl/ir_print_glsl_visitor.cpp b/src/compiler/glsl/ir_print_glsl_visitor.cpp index 12ddb624cad..bdd512f1ddf 100644 --- a/src/compiler/glsl/ir_print_glsl_visitor.cpp +++ b/src/compiler/glsl/ir_print_glsl_visitor.cpp @@ -1922,7 +1922,7 @@ ir_print_glsl_visitor::visit(ir_typedecl_statement *ir) // Find a variable defined by this interface, as it holds some necessary data. exec_node* n = ir; - while (n = n->get_next()) { + while ((n = n->get_next())) { ir_variable* v = ((ir_instruction *)n)->as_variable(); if (v != NULL && v->get_interface_type() == ir->type_decl) { interface_var = v;