Bug 34114 - Sun Studio build fails due to standard library functions not being in global namespace
Summary: Sun Studio build fails due to standard library functions not being in global ...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: git
Hardware: x86 (IA32) Solaris
: medium blocker
Assignee: Ian Romanick
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-09 15:17 UTC by Vinson Lee
Modified: 2011-02-22 09:26 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Use C-style system headers in C++ code to avoid issues with std:: namespace (9.48 KB, patch)
2011-02-10 10:29 UTC, Ian Romanick
Details | Splinter Review
Use C-style system headers in C++ code to avoid issues with std:: namespace (10.24 KB, patch)
2011-02-11 12:53 UTC, Ian Romanick
Details | Splinter Review

Description Vinson Lee 2011-02-09 15:17:34 UTC
mesa: 3b8bb7b449dae6c16df0fa45e6567ec3d6b05dcc (master)

Build Mesa using Sun Studio on OpenSolaris 2009.06.

$ ./autogen.sh && gmake
[...]
gmake[2]: Entering directory `/export/home/mks/mesa/src/glsl'
CC -c -I. -I../mesa -I../mapi -I../../include  -g  -KPIC  -DPTHREADS -DSVR4 -DHAVE_POSIX_MEMALIGN -DUSE_XSHM  -DFEATURE_GL=1 -DPTHREADS -DSVR4 -DHAVE_POSIX_MEMALIGN -DUSE_XSHM  -DFEATURE_GL=1 opt_copy_propagation_elements.cpp -o opt_copy_propagation_elements.o
"ir_visitor.h", line 82: Warning: ir_control_flow_visitor::visit hides the virtual function ir_visitor::visit(ir_loop_jump*).
"ir_visitor.h", line 82: Warning: ir_control_flow_visitor::visit hides the virtual function ir_visitor::visit(ir_loop*).
"ir_visitor.h", line 82: Warning: ir_control_flow_visitor::visit hides the virtual function ir_visitor::visit(ir_if*).
"ir_visitor.h", line 82: Warning: ir_control_flow_visitor::visit hides the virtual function ir_visitor::visit(ir_discard*).
"ir_visitor.h", line 82: Warning: ir_control_flow_visitor::visit hides the virtual function ir_visitor::visit(ir_return*).
"ir_visitor.h", line 82: Warning: ir_control_flow_visitor::visit hides the virtual function ir_visitor::visit(ir_function*).
"ir_visitor.h", line 82: Warning: ir_control_flow_visitor::visit hides the virtual function ir_visitor::visit(ir_function_signature*).
"ir.h", line 959: Warning: callee hides ir_call::callee.
"ir.h", line 959: Warning: actual_parameters hides ir_call::actual_parameters.
"ir.h", line 1106: Warning: mode hides ir_loop_jump::mode.
"ir_rvalue_visitor.h", line 47: Warning: ir_rvalue_visitor::visit_leave hides the virtual function ir_hierarchical_visitor::visit_leave(ir_loop*).
"ir_rvalue_visitor.h", line 47: Warning: ir_rvalue_visitor::visit_leave hides the virtual function ir_hierarchical_visitor::visit_leave(ir_discard*).
"ir_rvalue_visitor.h", line 47: Warning: ir_rvalue_visitor::visit_leave hides the virtual function ir_hierarchical_visitor::visit_leave(ir_function*).
"ir_rvalue_visitor.h", line 47: Warning: ir_rvalue_visitor::visit_leave hides the virtual function ir_hierarchical_visitor::visit_leave(ir_function_signature*).
"opt_copy_propagation_elements.cpp", line 60: Error: The function "memcpy" must have a prototype.
"opt_copy_propagation_elements.cpp", line 55: Warning: lhs hides acp_entry::lhs.
"opt_copy_propagation_elements.cpp", line 55: Warning: rhs hides acp_entry::rhs.
"opt_copy_propagation_elements.cpp", line 55: Warning: write_mask hides acp_entry::write_mask.
"opt_copy_propagation_elements.cpp", line 55: Warning: swizzle hides acp_entry::swizzle.
"opt_copy_propagation_elements.cpp", line 68: Error: The function "memcpy" must have a prototype.
"opt_copy_propagation_elements.cpp", line 81: Warning: var hides kill_entry::var.
"opt_copy_propagation_elements.cpp", line 81: Warning: write_mask hides kill_entry::write_mask.
"opt_copy_propagation_elements.cpp", line 134: Warning: ir_copy_propagation_elements_visitor::visit_enter hides the virtual function ir_hierarchical_visitor::visit_enter(ir_discard*).
"opt_copy_propagation_elements.cpp", line 134: Warning: ir_copy_propagation_elements_visitor::visit_enter hides the virtual function ir_hierarchical_visitor::visit_enter(ir_return*).
"opt_copy_propagation_elements.cpp", line 134: Warning: ir_copy_propagation_elements_visitor::visit_enter hides the virtual function ir_hierarchical_visitor::visit_enter(ir_assignment*).
"opt_copy_propagation_elements.cpp", line 134: Warning: ir_copy_propagation_elements_visitor::visit_enter hides the virtual function ir_hierarchical_visitor::visit_enter(ir_dereference_record*).
"opt_copy_propagation_elements.cpp", line 134: Warning: ir_copy_propagation_elements_visitor::visit_enter hides the virtual function ir_hierarchical_visitor::visit_enter(ir_dereference_array*).
"opt_copy_propagation_elements.cpp", line 134: Warning: ir_copy_propagation_elements_visitor::visit_enter hides the virtual function ir_hierarchical_visitor::visit_enter(ir_swizzle*).
"opt_copy_propagation_elements.cpp", line 134: Warning: ir_copy_propagation_elements_visitor::visit_enter hides the virtual function ir_hierarchical_visitor::visit_enter(ir_texture*).
"opt_copy_propagation_elements.cpp", line 134: Warning: ir_copy_propagation_elements_visitor::visit_enter hides the virtual function ir_hierarchical_visitor::visit_enter(ir_expression*).
"opt_copy_propagation_elements.cpp", line 134: Warning: ir_copy_propagation_elements_visitor::visit_enter hides the virtual function ir_hierarchical_visitor::visit_enter(ir_function*).
"opt_copy_propagation_elements.cpp", line 134: Warning: ir_copy_propagation_elements_visitor::visit_leave hides the virtual function ir_rvalue_visitor::visit_leave(ir_texture*).
"opt_copy_propagation_elements.cpp", line 134: Warning: ir_copy_propagation_elements_visitor::visit_leave hides the virtual function ir_rvalue_visitor::visit_leave(ir_swizzle*).
"opt_copy_propagation_elements.cpp", line 134: Warning: ir_copy_propagation_elements_visitor::visit_leave hides the virtual function ir_rvalue_visitor::visit_leave(ir_return*).
"opt_copy_propagation_elements.cpp", line 134: Warning: ir_copy_propagation_elements_visitor::visit_leave hides the virtual function ir_rvalue_visitor::visit_leave(ir_if*).
"opt_copy_propagation_elements.cpp", line 134: Warning: ir_copy_propagation_elements_visitor::visit_leave hides the virtual function ir_rvalue_visitor::visit_leave(ir_expression*).
"opt_copy_propagation_elements.cpp", line 134: Warning: ir_copy_propagation_elements_visitor::visit_leave hides the virtual function ir_rvalue_visitor::visit_leave(ir_dereference_record*).
"opt_copy_propagation_elements.cpp", line 134: Warning: ir_copy_propagation_elements_visitor::visit_leave hides the virtual function ir_rvalue_visitor::visit_leave(ir_dereference_array*).
"opt_copy_propagation_elements.cpp", line 134: Warning: ir_copy_propagation_elements_visitor::visit_leave hides the virtual function ir_rvalue_visitor::visit_leave(ir_call*).
"opt_copy_propagation_elements.cpp", line 250: Error: The function "printf" must have a prototype.
"opt_copy_propagation_elements.cpp", line 263: Error: The function "printf" must have a prototype.
"opt_copy_propagation_elements.cpp", line 265: Error: The function "printf" must have a prototype.
5 Error(s) and 37 Warning(s) detected.
gmake[2]: *** [opt_copy_propagation_elements.o] Error 5


Sun Studio isn't adding standard libary functions to the global namespace if C++-style headers are used. The Sun Studio build can be fixed by the prepending std namespace in front of standard library functions or by adding using statements. using statements were added in commit 61c59234f916406512b3591f46599cc29a5d8e23 for similar build failures but there was a subsequent discussion whether this was the best approach.
Comment 1 Ian Romanick 2011-02-10 10:29:19 UTC
Created attachment 43209 [details] [review]
Use C-style system headers in C++ code to avoid issues with std:: namespace

Vinson, could you try this patch on Sun Studio?  I think it should fix the issues you've encountered.
Comment 2 Vinson Lee 2011-02-10 17:37:59 UTC
(In reply to comment #1)
> Created an attachment (id=43209) [details]
> Use C-style system headers in C++ code to avoid issues with std:: namespace
> 
> Vinson, could you try this patch on Sun Studio?  I think it should fix the
> issues you've encountered.

I tested the patch. The glsl build still fails with Sun Studio.

Here are all the errors.

"hir_field_selection.cpp", line 84: Error: The function "strcmp" must have a prototype.
"ir_print_visitor.cpp", line 85: Error: The function "strncmp" must have a prototype.
"opt_constant_propagation.cpp", line 142: Error: The function "memset" must have a prototype.
"opt_copy_propagation_elements.cpp", line 60: Error: The function "memcpy" must have a prototype.
"opt_copy_propagation_elements.cpp", line 68: Error: The function "memcpy" must have a prototype.
"opt_dead_functions.cpp", line 93: Error: The function "strcmp" must have a prototype.
"opt_structure_splitting.cpp", line 231: Error: The function "strcmp" must have a prototype.
"opt_swizzle_swizzle.cpp", line 56: Error: The function "memset" must have a prototype.
Comment 3 Ian Romanick 2011-02-11 12:53:27 UTC
Created attachment 43264 [details] [review]
Use C-style system headers in C++ code to avoid issues with std:: namespace

The initial version missed a couple occurrences of non-C headers.  This one should get all of them.
Comment 4 Vinson Lee 2011-02-14 15:40:30 UTC
(In reply to comment #3)
> Created an attachment (id=43264) [details]
> Use C-style system headers in C++ code to avoid issues with std:: namespace
> 
> The initial version missed a couple occurrences of non-C headers.  This one
> should get all of them.

I tested patch id=43264 and the build of the glsl directory completes.

The Sun Studio build now fails in gallium/drivers/auxiliary with a different build error. This will be a different bug.
Comment 5 Ian Romanick 2011-02-22 09:26:27 UTC
Fixed on 7.9 (0f3a9643c62174028a74bd7bffdca6d745b2c743), 7.10 (5ad00ef7a367b415f47d95f5274bc749301d870d), and master (497baf4e4a6a0a2f247c7bfb9bf69a2b93c2c19f).


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.