glsl: Add using statements for standard library functions.
authorVinson Lee <vlee@vmware.com>
Fri, 4 Feb 2011 03:19:12 +0000 (19:19 -0800)
committerVinson Lee <vlee@vmware.com>
Fri, 4 Feb 2011 03:19:12 +0000 (19:19 -0800)
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.

14 files changed:
src/glsl/ast_expr.cpp
src/glsl/ast_type.cpp
src/glsl/hir_field_selection.cpp
src/glsl/ir_print_visitor.cpp
src/glsl/ir_validate.cpp
src/glsl/lower_mat_op_to_vec.cpp
src/glsl/opt_constant_propagation.cpp
src/glsl/opt_constant_variable.cpp
src/glsl/opt_dead_code.cpp
src/glsl/opt_dead_code_local.cpp
src/glsl/opt_dead_functions.cpp
src/glsl/opt_structure_splitting.cpp
src/glsl/opt_swizzle_swizzle.cpp
src/glsl/opt_tree_grafting.cpp

index 4e83dec..974beb9 100644 (file)
@@ -24,6 +24,8 @@
 #include <cassert>
 #include "ast.h"
 
+using std::printf;
+
 const char *
 ast_expression::operator_string(enum ast_operators op)
 {
index d140774..5ddfeec 100644 (file)
@@ -27,6 +27,8 @@ extern "C" {
 #include "program/symbol_table.h"
 }
 
+using std::printf;
+
 void
 ast_type_specifier::print(void) const
 {
index 3c33127..995f284 100644 (file)
@@ -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,
index 82ccc72..be76945 100644 (file)
@@ -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
index 44d7549..b0dd6c2 100644 (file)
@@ -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()
index 8cbbfa7..bdc53a1 100644 (file)
@@ -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()
index e1f6889..1fff717 100644 (file)
@@ -41,6 +41,8 @@
 #include "ir_optimization.h"
 #include "glsl_types.h"
 
+using std::memset;
+
 class acp_entry : public exec_node
 {
 public:
index 8068d0c..1f51da6 100644 (file)
@@ -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;
index cb500d2..f47b961 100644 (file)
@@ -32,6 +32,8 @@
 #include "ir_variable_refcount.h"
 #include "glsl_types.h"
 
+using std::printf;
+
 static bool debug = false;
 
 /**
index 2610b69..88dcdc2 100644 (file)
@@ -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
index ceb7908..d72eb61 100644 (file)
@@ -32,6 +32,8 @@
  #include "ir_expression_flattening.h"
  #include "glsl_types.h"
 
+ using std::strcmp;
+
  class signature_entry : public exec_node
  {
  public:
index 014407c..8686da0 100644 (file)
@@ -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
index bc442fa..8d0e105 100644 (file)
@@ -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()
index 1ef940f..a85ba82 100644 (file)
@@ -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 {