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.
This commit is contained in:
Vinson Lee
2011-02-03 19:19:12 -08:00
parent 151a945d38
commit 61c59234f9
14 changed files with 33 additions and 0 deletions

View File

@@ -24,6 +24,8 @@
#include <cassert> #include <cassert>
#include "ast.h" #include "ast.h"
using std::printf;
const char * const char *
ast_expression::operator_string(enum ast_operators op) ast_expression::operator_string(enum ast_operators op)
{ {

View File

@@ -27,6 +27,8 @@ extern "C" {
#include "program/symbol_table.h" #include "program/symbol_table.h"
} }
using std::printf;
void void
ast_type_specifier::print(void) const ast_type_specifier::print(void) const
{ {

View File

@@ -27,6 +27,8 @@
#include "ast.h" #include "ast.h"
#include "glsl_types.h" #include "glsl_types.h"
using std::strcmp;
ir_rvalue * ir_rvalue *
_mesa_ast_field_selection_to_hir(const ast_expression *expr, _mesa_ast_field_selection_to_hir(const ast_expression *expr,
exec_list *instructions, exec_list *instructions,

View File

@@ -25,6 +25,9 @@
#include "glsl_types.h" #include "glsl_types.h"
#include "glsl_parser_extras.h" #include "glsl_parser_extras.h"
using std::printf;
using std::strncmp;
static void print_type(const glsl_type *t); static void print_type(const glsl_type *t);
void void

View File

@@ -39,6 +39,9 @@
#include "program/hash_table.h" #include "program/hash_table.h"
#include "glsl_types.h" #include "glsl_types.h"
using std::abort;
using std::printf;
class ir_validate : public ir_hierarchical_visitor { class ir_validate : public ir_hierarchical_visitor {
public: public:
ir_validate() ir_validate()

View File

@@ -35,6 +35,9 @@
#include "ir_expression_flattening.h" #include "ir_expression_flattening.h"
#include "glsl_types.h" #include "glsl_types.h"
using std::abort;
using std::printf;
class ir_mat_op_to_vec_visitor : public ir_hierarchical_visitor { class ir_mat_op_to_vec_visitor : public ir_hierarchical_visitor {
public: public:
ir_mat_op_to_vec_visitor() ir_mat_op_to_vec_visitor()

View File

@@ -41,6 +41,8 @@
#include "ir_optimization.h" #include "ir_optimization.h"
#include "glsl_types.h" #include "glsl_types.h"
using std::memset;
class acp_entry : public exec_node class acp_entry : public exec_node
{ {
public: public:

View File

@@ -37,6 +37,9 @@
#include "ir_optimization.h" #include "ir_optimization.h"
#include "glsl_types.h" #include "glsl_types.h"
using std::calloc;
using std::free;
struct assignment_entry { struct assignment_entry {
exec_node link; exec_node link;
int assignment_count; int assignment_count;

View File

@@ -32,6 +32,8 @@
#include "ir_variable_refcount.h" #include "ir_variable_refcount.h"
#include "glsl_types.h" #include "glsl_types.h"
using std::printf;
static bool debug = false; static bool debug = false;
/** /**

View File

@@ -38,6 +38,8 @@
#include "ir_optimization.h" #include "ir_optimization.h"
#include "glsl_types.h" #include "glsl_types.h"
using std::printf;
static bool debug = false; static bool debug = false;
class assignment_entry : public exec_node class assignment_entry : public exec_node

View File

@@ -32,6 +32,8 @@
#include "ir_expression_flattening.h" #include "ir_expression_flattening.h"
#include "glsl_types.h" #include "glsl_types.h"
using std::strcmp;
class signature_entry : public exec_node class signature_entry : public exec_node
{ {
public: public:

View File

@@ -38,6 +38,9 @@
#include "ir_rvalue_visitor.h" #include "ir_rvalue_visitor.h"
#include "glsl_types.h" #include "glsl_types.h"
using std::printf;
using std::strcmp;
static bool debug = false; static bool debug = false;
// XXX using variable_entry2 here to avoid collision (MSVC multiply-defined // XXX using variable_entry2 here to avoid collision (MSVC multiply-defined

View File

@@ -32,6 +32,8 @@
#include "ir_optimization.h" #include "ir_optimization.h"
#include "glsl_types.h" #include "glsl_types.h"
using std::memset;
class ir_swizzle_swizzle_visitor : public ir_hierarchical_visitor { class ir_swizzle_swizzle_visitor : public ir_hierarchical_visitor {
public: public:
ir_swizzle_swizzle_visitor() ir_swizzle_swizzle_visitor()

View File

@@ -54,6 +54,8 @@
#include "ir_optimization.h" #include "ir_optimization.h"
#include "glsl_types.h" #include "glsl_types.h"
using std::printf;
static bool debug = false; static bool debug = false;
class ir_tree_grafting_visitor : public ir_hierarchical_visitor { class ir_tree_grafting_visitor : public ir_hierarchical_visitor {