Re: [Mesa-dev] [PATCH] nir: no-op C99 _Pragma() with MSVC
On 2019-11-23 12:38 p.m., Brian Paul wrote: > BTW, With gcc 5.4.0, there's a lot of warnings about the pragma not > being understood: > > ../src/compiler/nir/nir_range_analysis.c:268:0: warning: ignoring > #pragma GCC unroll [-Wunknown-pragmas] > ASSERT_TABLE_IS_COMMUTATIVE(union_table); > ^ > ../src/compiler/nir/nir_range_analysis.c:268:0: warning: ignoring > #pragma GCC unroll [-Wunknown-pragmas] > ../src/compiler/nir/nir_range_analysis.c:269:0: warning: ignoring > #pragma GCC unroll [-Wunknown-pragmas] > > I'd have to dig to see what version of gcc added that to add more > preprocessor tests to silence it. #pragma GCC unroll is since GCC 8. "A new pragma GCC unroll has been implemented in the C family of languages, as well as Fortran and Ada, so as to make it possible for the user to have a finer-grained control over the loop unrolling optimization. " -- https://gcc.gnu.org/gcc-8/changes.html ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] nir: no-op C99 _Pragma() with MSVC
On 11/22/2019 09:16 PM, Ian Romanick wrote: On 11/22/19 6:49 PM, Brian Paul wrote: This fixes a build failure on MSVC. BTW, it looks like clang supports _Pragma() but I don't know if it understands the "gcc unroll N" directive. It probably doesn't, but that should be okay. This just exists to speed up the debug builds in the pre-merge CI. Reviewed-by: Ian Romanick BTW, With gcc 5.4.0, there's a lot of warnings about the pragma not being understood: ../src/compiler/nir/nir_range_analysis.c:268:0: warning: ignoring #pragma GCC unroll [-Wunknown-pragmas] ASSERT_TABLE_IS_COMMUTATIVE(union_table); ^ ../src/compiler/nir/nir_range_analysis.c:268:0: warning: ignoring #pragma GCC unroll [-Wunknown-pragmas] ../src/compiler/nir/nir_range_analysis.c:269:0: warning: ignoring #pragma GCC unroll [-Wunknown-pragmas] I'd have to dig to see what version of gcc added that to add more preprocessor tests to silence it. -Brian Signed-off-by: Brian Paul --- src/compiler/nir/nir_range_analysis.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/compiler/nir/nir_range_analysis.c b/src/compiler/nir/nir_range_analysis.c index df5d4da..d38bcc0 100644 --- a/src/compiler/nir/nir_range_analysis.c +++ b/src/compiler/nir/nir_range_analysis.c @@ -218,6 +218,13 @@ analyze_constant(const struct nir_alu_instr *instr, unsigned src, */ #define ___ unknown + +/* MSVC doesn't have C99's _Pragma() */ +#ifdef _MSC_VER +#define _Pragma(x) +#endif + + #ifndef NDEBUG #define ASSERT_TABLE_IS_COMMUTATIVE(t)\ do { \ ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] nir: no-op C99 _Pragma() with MSVC
On Sat, Nov 23, 2019 at 3:49 AM Brian Paul wrote: > + > +/* MSVC doesn't have C99's _Pragma() */ > +#ifdef _MSC_VER > +#define _Pragma(x) > +#endif FWIW, MSVC has its own __pragma() extension instead of _Pragma(), but IIRC the syntax is slightly different (the contents are tokens, not a string to be tokenized), so supporting both with a common syntax would probably require some sophisticated preprocessor hoop jumping. Cheers, -- Giuseppe "Oblomov" Bilotta ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] nir: no-op C99 _Pragma() with MSVC
On 11/22/19 6:49 PM, Brian Paul wrote: > This fixes a build failure on MSVC. > > BTW, it looks like clang supports _Pragma() but I don't know if it > understands the "gcc unroll N" directive. It probably doesn't, but that should be okay. This just exists to speed up the debug builds in the pre-merge CI. Reviewed-by: Ian Romanick > Signed-off-by: Brian Paul > --- > src/compiler/nir/nir_range_analysis.c | 7 +++ > 1 file changed, 7 insertions(+) > > diff --git a/src/compiler/nir/nir_range_analysis.c > b/src/compiler/nir/nir_range_analysis.c > index df5d4da..d38bcc0 100644 > --- a/src/compiler/nir/nir_range_analysis.c > +++ b/src/compiler/nir/nir_range_analysis.c > @@ -218,6 +218,13 @@ analyze_constant(const struct nir_alu_instr *instr, > unsigned src, > */ > #define ___ unknown > > + > +/* MSVC doesn't have C99's _Pragma() */ > +#ifdef _MSC_VER > +#define _Pragma(x) > +#endif > + > + > #ifndef NDEBUG > #define ASSERT_TABLE_IS_COMMUTATIVE(t)\ > do { \ > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] nir: no-op C99 _Pragma() with MSVC
This fixes a build failure on MSVC. BTW, it looks like clang supports _Pragma() but I don't know if it understands the "gcc unroll N" directive. Signed-off-by: Brian Paul --- src/compiler/nir/nir_range_analysis.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/compiler/nir/nir_range_analysis.c b/src/compiler/nir/nir_range_analysis.c index df5d4da..d38bcc0 100644 --- a/src/compiler/nir/nir_range_analysis.c +++ b/src/compiler/nir/nir_range_analysis.c @@ -218,6 +218,13 @@ analyze_constant(const struct nir_alu_instr *instr, unsigned src, */ #define ___ unknown + +/* MSVC doesn't have C99's _Pragma() */ +#ifdef _MSC_VER +#define _Pragma(x) +#endif + + #ifndef NDEBUG #define ASSERT_TABLE_IS_COMMUTATIVE(t)\ do { \ -- 1.8.5.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev