mesa: 4ccf8c952abb471f94d6f40786d896723f94c0ea (master 11.3.0-devel) $ gcc --version gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17) Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. CC state_tracker/st_nir_lower_builtin.lo In file included from state_tracker/st_nir_lower_builtin.c:61: state_tracker/st_nir.h:34: error: redefinition of typedef ‘nir_shader’ ../../src/compiler/nir/nir.h:1828: note: previous declaration of ‘nir_shader’ was here
Using the forward declaration allows us to avoid including the nir.h header, thus keeping headers include chain shorter and less things get rebuild as a result. On the other hand, typedef redefinition is a C11 feature (iirc) which we cannot enforce atm. There was a lengthy discussion about killing off the typedefs in NIR, as they made sense in the C++ GLSL but not the C based NIR. Don't recall the conclusion of the thread, but fwiw I'm for killing the typedefs thus being able to build mesa with GCC 4.x series and (in due time) killing off the unneeded includes of nir*.h and replacing them with fwd declarations.
commit 3fea592c4eb26f6652bef1e5dc430e2296e14bac Author: Vinson Lee <vlee@freedesktop.org> Date: Wed Jun 29 20:15:03 2016 -0700 mesa/st: Use 'struct nir_shader' instead of 'nir_shader'. Fix this build error with GCC 4.4. CC state_tracker/st_nir_lower_builtin.lo In file included from state_tracker/st_nir_lower_builtin.c:61: state_tracker/st_nir.h:34: error: redefinition of typedef ‘nir_shader’ ../../src/compiler/nir/nir.h:1830: note: previous declaration of ‘nir_shader’ was here Suggested-by: Rob Clark <robdclark@gmail.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96235 Signed-off-by: Vinson Lee <vlee@freedesktop.org> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Rob Clark <robdclark@gmail.com>
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.