Mesa (master): Use C-style system headers in C++ code to avoid issues with std:: namespace

Ian Romanick idr at kemper.freedesktop.org
Sat Feb 12 00:46:33 UTC 2011


Module: Mesa
Branch: master
Commit: ccad808f07d9e8cf61292198fc8a26663b556b14
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ccad808f07d9e8cf61292198fc8a26663b556b14

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Thu Feb 10 10:26:42 2011 -0800

Use C-style system headers in C++ code to avoid issues with std:: namespace

---

 src/glsl/ast_expr.cpp                 |    5 +----
 src/glsl/ast_type.cpp                 |    3 ---
 src/glsl/glsl_parser_extras.h         |    2 +-
 src/glsl/glsl_types.cpp               |    2 +-
 src/glsl/glsl_types.h                 |    4 ++--
 src/glsl/hir_field_selection.cpp      |    2 --
 src/glsl/ir.h                         |    4 ++--
 src/glsl/ir_import_prototypes.cpp     |    1 -
 src/glsl/ir_print_visitor.cpp         |    3 ---
 src/glsl/ir_validate.cpp              |    3 ---
 src/glsl/link_functions.cpp           |    4 ----
 src/glsl/linker.cpp                   |    4 ----
 src/glsl/loop_controls.cpp            |    2 +-
 src/glsl/lower_mat_op_to_vec.cpp      |    3 ---
 src/glsl/main.cpp                     |    2 --
 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 --
 src/glsl/s_expression.cpp             |    3 ---
 src/mesa/program/sampler.cpp          |    1 -
 25 files changed, 8 insertions(+), 58 deletions(-)

diff --git a/src/glsl/ast_expr.cpp b/src/glsl/ast_expr.cpp
index 974beb9..e624d11 100644
--- a/src/glsl/ast_expr.cpp
+++ b/src/glsl/ast_expr.cpp
@@ -20,12 +20,9 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
-#include <cstdio>
-#include <cassert>
+#include <assert.h>
 #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 5ddfeec..c680ae5 100644
--- a/src/glsl/ast_type.cpp
+++ b/src/glsl/ast_type.cpp
@@ -21,14 +21,11 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#include <cstdio>
 #include "ast.h"
 extern "C" {
 #include "program/symbol_table.h"
 }
 
-using std::printf;
-
 void
 ast_type_specifier::print(void) const
 {
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index 8d4fca7..10cb673 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -31,7 +31,7 @@
 #ifdef __cplusplus
 
 
-#include <cstdlib>
+#include <stdlib.h>
 #include "glsl_symbol_table.h"
 
 enum _mesa_glsl_parser_targets {
diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index f4d9242..76b4f3e 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -21,7 +21,7 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#include <cstdio>
+#include <stdio.h>
 #include <stdlib.h>
 #include "main/core.h" /* for Elements */
 #include "glsl_symbol_table.h"
diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
index ab6858f..61bf5e0 100644
--- a/src/glsl/glsl_types.h
+++ b/src/glsl/glsl_types.h
@@ -26,8 +26,8 @@
 #ifndef GLSL_TYPES_H
 #define GLSL_TYPES_H
 
-#include <cstring>
-#include <cassert>
+#include <string.h>
+#include <assert.h>
 
 extern "C" {
 #include "GL/gl.h"
diff --git a/src/glsl/hir_field_selection.cpp b/src/glsl/hir_field_selection.cpp
index 995f284..3c33127 100644
--- a/src/glsl/hir_field_selection.cpp
+++ b/src/glsl/hir_field_selection.cpp
@@ -27,8 +27,6 @@
 #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.h b/src/glsl/ir.h
index 74a8b06..f2f902c 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -26,8 +26,8 @@
 #ifndef IR_H
 #define IR_H
 
-#include <cstdio>
-#include <cstdlib>
+#include <stdio.h>
+#include <stdlib.h>
 
 #include "ralloc.h"
 #include "glsl_types.h"
diff --git a/src/glsl/ir_import_prototypes.cpp b/src/glsl/ir_import_prototypes.cpp
index be5e0c1..3585bf6 100644
--- a/src/glsl/ir_import_prototypes.cpp
+++ b/src/glsl/ir_import_prototypes.cpp
@@ -27,7 +27,6 @@
  *
  * \author Ian Romanick
  */
-#include <cstdio>
 #include "ir.h"
 #include "glsl_symbol_table.h"
 
diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp
index be76945..82ccc72 100644
--- a/src/glsl/ir_print_visitor.cpp
+++ b/src/glsl/ir_print_visitor.cpp
@@ -25,9 +25,6 @@
 #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 b0dd6c2..44d7549 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -39,9 +39,6 @@
 #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/link_functions.cpp b/src/glsl/link_functions.cpp
index 861fa39..5851c14 100644
--- a/src/glsl/link_functions.cpp
+++ b/src/glsl/link_functions.cpp
@@ -21,10 +21,6 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#include <cstdlib>
-#include <cstdio>
-#include <cstdarg>
-
 #include "main/core.h"
 #include "glsl_symbol_table.h"
 #include "glsl_parser_extras.h"
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 46cd195..a8d5ae9 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -63,10 +63,6 @@
  *
  * \author Ian Romanick <ian.d.romanick at intel.com>
  */
-#include <cstdlib>
-#include <cstdio>
-#include <cstdarg>
-#include <climits>
 
 #include "main/core.h"
 #include "glsl_symbol_table.h"
diff --git a/src/glsl/loop_controls.cpp b/src/glsl/loop_controls.cpp
index 9eaa50f..9acbadc 100644
--- a/src/glsl/loop_controls.cpp
+++ b/src/glsl/loop_controls.cpp
@@ -21,7 +21,7 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#include <climits>
+#include <limits.h>
 #include "main/compiler.h"
 #include "glsl_types.h"
 #include "loop_analysis.h"
diff --git a/src/glsl/lower_mat_op_to_vec.cpp b/src/glsl/lower_mat_op_to_vec.cpp
index bdc53a1..8cbbfa7 100644
--- a/src/glsl/lower_mat_op_to_vec.cpp
+++ b/src/glsl/lower_mat_op_to_vec.cpp
@@ -35,9 +35,6 @@
 #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/main.cpp b/src/glsl/main.cpp
index 6f05529..096da93 100644
--- a/src/glsl/main.cpp
+++ b/src/glsl/main.cpp
@@ -20,8 +20,6 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
-#include <cstdlib>
-#include <cstdio>
 #include <getopt.h>
 
 #include "ast.h"
diff --git a/src/glsl/opt_constant_propagation.cpp b/src/glsl/opt_constant_propagation.cpp
index 814f6e6..4425f42 100644
--- a/src/glsl/opt_constant_propagation.cpp
+++ b/src/glsl/opt_constant_propagation.cpp
@@ -41,8 +41,6 @@
 #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 9dca0ff..3fa7c3b 100644
--- a/src/glsl/opt_constant_variable.cpp
+++ b/src/glsl/opt_constant_variable.cpp
@@ -37,9 +37,6 @@
 #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 f47b961..cb500d2 100644
--- a/src/glsl/opt_dead_code.cpp
+++ b/src/glsl/opt_dead_code.cpp
@@ -32,8 +32,6 @@
 #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 f67b463..39962bd 100644
--- a/src/glsl/opt_dead_code_local.cpp
+++ b/src/glsl/opt_dead_code_local.cpp
@@ -38,8 +38,6 @@
 #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 d72eb61..ceb7908 100644
--- a/src/glsl/opt_dead_functions.cpp
+++ b/src/glsl/opt_dead_functions.cpp
@@ -32,8 +32,6 @@
  #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 8686da0..014407c 100644
--- a/src/glsl/opt_structure_splitting.cpp
+++ b/src/glsl/opt_structure_splitting.cpp
@@ -38,9 +38,6 @@
 #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 8d0e105..bc442fa 100644
--- a/src/glsl/opt_swizzle_swizzle.cpp
+++ b/src/glsl/opt_swizzle_swizzle.cpp
@@ -32,8 +32,6 @@
 #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 a85ba82..1ef940f 100644
--- a/src/glsl/opt_tree_grafting.cpp
+++ b/src/glsl/opt_tree_grafting.cpp
@@ -54,8 +54,6 @@
 #include "ir_optimization.h"
 #include "glsl_types.h"
 
-using std::printf;
-
 static bool debug = false;
 
 class ir_tree_grafting_visitor : public ir_hierarchical_visitor {
diff --git a/src/glsl/s_expression.cpp b/src/glsl/s_expression.cpp
index 77ac08a..a922a50 100644
--- a/src/glsl/s_expression.cpp
+++ b/src/glsl/s_expression.cpp
@@ -22,9 +22,6 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
 #include <assert.h>
 #include "s_expression.h"
 
diff --git a/src/mesa/program/sampler.cpp b/src/mesa/program/sampler.cpp
index 12c4a40..1457d11 100644
--- a/src/mesa/program/sampler.cpp
+++ b/src/mesa/program/sampler.cpp
@@ -23,7 +23,6 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#include <cstdio>
 #include "ir.h"
 #include "glsl_types.h"
 #include "ir_visitor.h"




More information about the mesa-commit mailing list