Bug 93188 - "nir/nir.h", line 552: Error: Unexpected type name "nir_src" encountered.
Summary: "nir/nir.h", line 552: Error: Unexpected type name "nir_src" encountered.
Status: RESOLVED WONTFIX
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: x86 (IA32) Solaris
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-01 08:17 UTC by Vinson Lee
Modified: 2015-12-04 22:35 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Vinson Lee 2015-12-01 08:17:30 UTC
mesa: 750393ff7d6162372f368f5ed726b23f4cae49a0 (master 11.2.0-devel)

Oracle Solaris Studio build error

  CXX    nir/glsl_to_nir.lo
"nir/../list.h", line 83: Warning (Anachronism): Using void(*)(void*) to initialize extern "C" void(*)(void*).
"nir/../list.h", line 315: Warning (Anachronism): Using void(*)(void*) to initialize extern "C" void(*)(void*).
"../../src/gallium/auxiliary/util/u_math.h", line 397: Error: ffsll(long long) was previously declared "extern", not "inline".
"../../include/c11/threads_posix.h", line 96: Warning (Anachronism): Using void(*)() to initialize extern "C" void(*)().
"../../include/c11/threads_posix.h", line 265: Warning (Anachronism): Using void*(*)(void*) to initialize extern "C" void*(*)(void*).
"../../include/c11/threads_posix.h", line 337: Warning (Anachronism): Using void(*)(void*) to initialize extern "C" void(*)(void*).
"../../src/glsl/nir/shader_enums.h", line 44: Warning: Identifier expected instead of "}".
"../../src/glsl/nir/shader_enums.h", line 234: Warning: Identifier expected instead of "}".
"../../src/glsl/nir/shader_enums.h", line 478: Warning: Identifier expected instead of "}".
"../../src/mesa/main/formats.h", line 76: Warning: Identifier expected instead of "}".
"../../src/mesa/main/formats.h", line 90: Warning: Identifier expected instead of "}".
"../../src/mesa/main/formats.h", line 110: Warning: Identifier expected instead of "}".
"../../src/mesa/main/mtypes.h", line 1256: Warning: Identifier expected instead of "}".
"nir/glsl_types.h", line 601: Warning: base_type hides glsl_type::base_type.
"nir/nir.h", line 410: Warning: Identifier expected instead of "}".
"nir/nir.h", line 552: Error: Unexpected type name "nir_src" encountered.
"nir/nir.h", line 552: Error: Use ";" to terminate declarations.
"nir/nir.h", line 552: Error: Use ";" to terminate statements.
"nir/nir.h", line 563: Error: Unexpected type name "nir_src" encountered.
"nir/nir.h", line 563: Error: Use ";" to terminate declarations.
"nir/nir.h", line 563: Error: Use ";" to terminate statements.
"nir/nir.h", line 576: Error: Unexpected type name "nir_dest" encountered.
"nir/nir.h", line 576: Error: Use ";" to terminate declarations.
"nir/nir.h", line 576: Error: Use ";" to terminate statements.
"nir/nir.h", line 644: Warning: Identifier expected instead of "}".
"nir/nir.h", line 698: Error: In this declaration "src" is of an incomplete type "nir_alu_src[]".
"nir/nir.h", line 761: Warning: Identifier expected instead of "}".
"nir/nir.h", line 861: Error: In this declaration "src" is of an incomplete type "nir_src[]".
"nir/nir.h", line 884: Warning: Identifier expected instead of "}".
"nir/nir.h", line 962: Warning: Identifier expected instead of "}".
"nir/nir.h", line 1120: Warning: Identifier expected instead of "}".
"nir/nir.h", line 1346: Warning: Identifier expected instead of "}".
"nir/nir.h", line 1430: Warning: Identifier expected instead of "}".
"nir/nir.h", line 1575: Warning: Types cannot be declared in anonymous union.
"nir/nir.h", line 1724: Warning: Identifier expected instead of "}".
Comment 1 Alan Coopersmith 2015-12-01 08:23:52 UTC
The Studio C++ compiler does not support C99 compound literals - when I raised
this to the Studio C++ team they said:

> This:
>   (nir_src) { init }
> 
> is a C99 feature called "compound literals", which is not part of any C++
> standard. G++ supports it as an extension, Studio C++ does not support it.
> 
> C++ code using this feature is non-portable...

I filed Oracle bug 21371509 to request support as an enhancement, but if
you want to build Mesa with Studio now, you'll need to rewrite that code
to use a portable construct instead.
Comment 2 Jose Fonseca 2015-12-02 07:56:12 UTC
As of commit 51564f04b77e6d29a888a4fbd83d96de062ac634 we now require GCC on Solaris.
Comment 3 Jose Fonseca 2015-12-02 07:58:56 UTC
Though we still might want to avoid non-standard C++ constructs regardless.

C++ is not a superset of C99 (though some portions are widely supported), so NIR needs to take care when mixing both things.
Comment 4 Ian Romanick 2015-12-04 01:02:39 UTC
I guess the question is whether or not this builds with Visual Studio's C++ compiler.  If not, maybe we should reopen with changes to the summary?
Comment 5 Emil Velikov 2015-12-04 16:44:24 UTC
(In reply to Ian Romanick from comment #4)
> I guess the question is whether or not this builds with Visual Studio's C++
> compiler.  If not, maybe we should reopen with changes to the summary?

Afaict MSVC was the first one to use anonymous struct/unions. After all GCC allowed/implemented it as -fms-extensions way before C99 came along.

That aside I did explicitly pointed out the lack of portability as this was introduced, yet was greeted by hostility (~ish) and absolutely no support on the topic. Oh well :-\
Comment 6 Jason Ekstrand 2015-12-04 22:35:41 UTC
I had a patch at one point to help C++ out here.  I ended up not sending it out because it only fixed warnings that only came up if you had extra warnings turned on.  basically it boiled down to

#ifdef __cplusplus
#  define NIR_SRC_INIT nir_src()
#else
#  define NIR_SRC_INIT (nir_src) { { NULL } }
#endif

And the same thing for NIR_DEST_INIT.  Can you try that?


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.