From 61c59234f916406512b3591f46599cc29a5d8e23 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 3 Feb 2011 19:19:12 -0800 Subject: glsl: Add using statements for standard library functions. Standard library functions in C++ are in the std namespace. When using C++-style header files for the standard library, some compilers, such as Sun Studio, provide symbols only for the std namespace and not for the global namespace. This patch adds using statements for standard library functions. Another option could have been to prepend standard library function calls with 'std::'. This patch fixes several compilation errors with Sun Studio. --- src/glsl/ast_expr.cpp | 2 ++ src/glsl/ast_type.cpp | 2 ++ src/glsl/hir_field_selection.cpp | 2 ++ src/glsl/ir_print_visitor.cpp | 3 +++ src/glsl/ir_validate.cpp | 3 +++ src/glsl/lower_mat_op_to_vec.cpp | 3 +++ src/glsl/opt_constant_propagation.cpp | 2 ++ src/glsl/opt_constant_variable.cpp | 3 +++ src/glsl/opt_dead_code.cpp | 2 ++ src/glsl/opt_dead_code_local.cpp | 2 ++ src/glsl/opt_dead_functions.cpp | 2 ++ src/glsl/opt_structure_splitting.cpp | 3 +++ src/glsl/opt_swizzle_swizzle.cpp | 2 ++ src/glsl/opt_tree_grafting.cpp | 2 ++ 14 files changed, 33 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ast_expr.cpp b/src/glsl/ast_expr.cpp index 4e83decb92..974beb9f61 100644 --- a/src/glsl/ast_expr.cpp +++ b/src/glsl/ast_expr.cpp @@ -24,6 +24,8 @@ #include #include "ast.h" +using std::printf; + const char * ast_expression::operator_string(enum ast_operators op) { diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp index d14077473f..5ddfeec872 100644 --- a/src/glsl/ast_type.cpp +++ b/src/glsl/ast_type.cpp @@ -27,6 +27,8 @@ extern "C" { #include "program/symbol_table.h" } +using std::printf; + void ast_type_specifier::print(void) const { diff --git a/src/glsl/hir_field_selection.cpp b/src/glsl/hir_field_selection.cpp index 3c33127b5f..995f284fa5 100644 --- a/src/glsl/hir_field_selection.cpp +++ b/src/glsl/hir_field_selection.cpp @@ -27,6 +27,8 @@ #include "ast.h" #include "glsl_types.h" +using std::strcmp; + ir_rvalue * _mesa_ast_field_selection_to_hir(const ast_expression *expr, exec_list *instructions, diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp index 82ccc722fa..be76945a21 100644 --- a/src/glsl/ir_print_visitor.cpp +++ b/src/glsl/ir_print_visitor.cpp @@ -25,6 +25,9 @@ #include "glsl_types.h" #include "glsl_parser_extras.h" +using std::printf; +using std::strncmp; + static void print_type(const glsl_type *t); void diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 44d7549ea2..b0dd6c21f8 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -39,6 +39,9 @@ #include "program/hash_table.h" #include "glsl_types.h" +using std::abort; +using std::printf; + class ir_validate : public ir_hierarchical_visitor { public: ir_validate() diff --git a/src/glsl/lower_mat_op_to_vec.cpp b/src/glsl/lower_mat_op_to_vec.cpp index 8cbbfa713c..bdc53a1f81 100644 --- a/src/glsl/lower_mat_op_to_vec.cpp +++ b/src/glsl/lower_mat_op_to_vec.cpp @@ -35,6 +35,9 @@ #include "ir_expression_flattening.h" #include "glsl_types.h" +using std::abort; +using std::printf; + class ir_mat_op_to_vec_visitor : public ir_hierarchical_visitor { public: ir_mat_op_to_vec_visitor() diff --git a/src/glsl/opt_constant_propagation.cpp b/src/glsl/opt_constant_propagation.cpp index e1f68892fb..1fff717539 100644 --- a/src/glsl/opt_constant_propagation.cpp +++ b/src/glsl/opt_constant_propagation.cpp @@ -41,6 +41,8 @@ #include "ir_optimization.h" #include "glsl_types.h" +using std::memset; + class acp_entry : public exec_node { public: diff --git a/src/glsl/opt_constant_variable.cpp b/src/glsl/opt_constant_variable.cpp index 8068d0c143..1f51da6e4f 100644 --- a/src/glsl/opt_constant_variable.cpp +++ b/src/glsl/opt_constant_variable.cpp @@ -37,6 +37,9 @@ #include "ir_optimization.h" #include "glsl_types.h" +using std::calloc; +using std::free; + struct assignment_entry { exec_node link; int assignment_count; diff --git a/src/glsl/opt_dead_code.cpp b/src/glsl/opt_dead_code.cpp index cb500d2d10..f47b9613e1 100644 --- a/src/glsl/opt_dead_code.cpp +++ b/src/glsl/opt_dead_code.cpp @@ -32,6 +32,8 @@ #include "ir_variable_refcount.h" #include "glsl_types.h" +using std::printf; + static bool debug = false; /** diff --git a/src/glsl/opt_dead_code_local.cpp b/src/glsl/opt_dead_code_local.cpp index 2610b69815..88dcdc2517 100644 --- a/src/glsl/opt_dead_code_local.cpp +++ b/src/glsl/opt_dead_code_local.cpp @@ -38,6 +38,8 @@ #include "ir_optimization.h" #include "glsl_types.h" +using std::printf; + static bool debug = false; class assignment_entry : public exec_node diff --git a/src/glsl/opt_dead_functions.cpp b/src/glsl/opt_dead_functions.cpp index ceb79080a7..d72eb6115e 100644 --- a/src/glsl/opt_dead_functions.cpp +++ b/src/glsl/opt_dead_functions.cpp @@ -32,6 +32,8 @@ #include "ir_expression_flattening.h" #include "glsl_types.h" + using std::strcmp; + class signature_entry : public exec_node { public: diff --git a/src/glsl/opt_structure_splitting.cpp b/src/glsl/opt_structure_splitting.cpp index 014407c0be..8686da06af 100644 --- a/src/glsl/opt_structure_splitting.cpp +++ b/src/glsl/opt_structure_splitting.cpp @@ -38,6 +38,9 @@ #include "ir_rvalue_visitor.h" #include "glsl_types.h" +using std::printf; +using std::strcmp; + static bool debug = false; // XXX using variable_entry2 here to avoid collision (MSVC multiply-defined diff --git a/src/glsl/opt_swizzle_swizzle.cpp b/src/glsl/opt_swizzle_swizzle.cpp index bc442fa869..8d0e1051d8 100644 --- a/src/glsl/opt_swizzle_swizzle.cpp +++ b/src/glsl/opt_swizzle_swizzle.cpp @@ -32,6 +32,8 @@ #include "ir_optimization.h" #include "glsl_types.h" +using std::memset; + class ir_swizzle_swizzle_visitor : public ir_hierarchical_visitor { public: ir_swizzle_swizzle_visitor() diff --git a/src/glsl/opt_tree_grafting.cpp b/src/glsl/opt_tree_grafting.cpp index 1ef940f9c7..a85ba82340 100644 --- a/src/glsl/opt_tree_grafting.cpp +++ b/src/glsl/opt_tree_grafting.cpp @@ -54,6 +54,8 @@ #include "ir_optimization.h" #include "glsl_types.h" +using std::printf; + static bool debug = false; class ir_tree_grafting_visitor : public ir_hierarchical_visitor { -- cgit v1.2.3