From: Vinson Lee Date: Fri, 4 Feb 2011 03:19:12 +0000 (-0800) Subject: glsl: Add using statements for standard library functions. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=61c59234f916406512b3591f46599cc29a5d8e23;p=mesa.git 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. --- diff --git a/src/glsl/ast_expr.cpp b/src/glsl/ast_expr.cpp index 4e83decb924..974beb9f614 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 d14077473f0..5ddfeec8724 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 3c33127b5f8..995f284fa58 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 82ccc722fa2..be76945a217 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 44d7549ea28..b0dd6c21f8e 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 8cbbfa713c9..bdc53a1f812 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 e1f68892fbe..1fff7175395 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 8068d0c1435..1f51da6e4ff 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 cb500d2d105..f47b9613e19 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 2610b698159..88dcdc25176 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 ceb79080a75..d72eb6115e1 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 014407c0be2..8686da06afa 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 bc442fa8693..8d0e1051d8a 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 1ef940f9c72..a85ba823401 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 {