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

Author: Yonggang Luo <luoyongg...@gmail.com>
Date:   Fri Dec 15 23:08:12 2023 +0800

glsl: Fixes glcpp/tests with mingw/gcc

glcpp mingw failing in the following way:
```
49/56 mesa:compiler+glcpp / glcpp test (unix)     FAIL             3.39s   exit 
status 1
50/56 mesa:compiler+glcpp / glcpp test (oldmac)   FAIL             3.41s   exit 
status 1
51/56 mesa:compiler+glcpp / glcpp test (bizarro)  FAIL             3.42s   exit 
status 1
52/56 mesa:compiler+glcpp / glcpp test (windows)  FAIL             3.45s   exit 
status 1
```

The test failed because on mingw, the stderr will comes after stdout,
but all the expect files, the stderr is coming first,
so we flush(stderr) first to makesure stderr out before stdout

The failing example:

039-func-arg-obj-macro-with-comma: FAIL
---

+++

@@ -1,3 +1,5 @@

+0:12(21): preprocessor error: Error: macro foo invoked with 2 arguments 
(expected 1)
+

Signed-off-by: Yonggang Luo <luoyongg...@gmail.com>
Reviewed-by: Caio Oliveira <caio.olive...@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26778>

---

 src/compiler/glsl/glcpp/glcpp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/glcpp/glcpp.c b/src/compiler/glsl/glcpp/glcpp.c
index b90a46e7769..7a1e603e255 100644
--- a/src/compiler/glsl/glcpp/glcpp.c
+++ b/src/compiler/glsl/glcpp/glcpp.c
@@ -174,8 +174,10 @@ main (int argc, char *argv[])
 
        ret = glcpp_preprocess(ctx, &shader, &info_log, NULL, NULL, &gl_ctx);
 
-       printf("%s", shader);
        fprintf(stderr, "%s", info_log);
+       fflush(stderr);
+       printf("%s", shader);
+       fflush(stdout);
 
        ralloc_free(ctx);
 

Reply via email to