From b11aaa029e6f90954cd597032a84e5ffa7584e3a Mon Sep 17 00:00:00 2001
From: Thibault Martin <thi.martin.pro@pm.me>
Date: Tue, 5 Nov 2024 10:08:07 +0100
Subject: [PATCH] [tests] Add a test for empty unions in MSVC machdep

---
 tests/syntax/empty_union.i                   |  1 +
 tests/syntax/oracle/empty_union.1.res.oracle | 16 +++++++---------
 tests/syntax/oracle/empty_union.2.res.oracle | 10 ++++++++++
 3 files changed, 18 insertions(+), 9 deletions(-)
 create mode 100644 tests/syntax/oracle/empty_union.2.res.oracle

diff --git a/tests/syntax/empty_union.i b/tests/syntax/empty_union.i
index e6a8d86207..4b656499b0 100644
--- a/tests/syntax/empty_union.i
+++ b/tests/syntax/empty_union.i
@@ -1,5 +1,6 @@
 /* run.config*
    STDOPT: +"-machdep gcc_x86_32 -print -ocode @PTEST_NAME@_reparse.c -then @PTEST_NAME@_reparse.c -ocode=''"
+   STDOPT: +"-machdep msvc_x86_64 -print -ocode @PTEST_NAME@_reparse.c -then @PTEST_NAME@_reparse.c -ocode=''"
  EXIT: 1
    STDOPT:
  */
diff --git a/tests/syntax/oracle/empty_union.1.res.oracle b/tests/syntax/oracle/empty_union.1.res.oracle
index 09d71d5930..7d386369f1 100644
--- a/tests/syntax/oracle/empty_union.1.res.oracle
+++ b/tests/syntax/oracle/empty_union.1.res.oracle
@@ -1,10 +1,8 @@
 [kernel] Parsing empty_union.i (no preprocessing)
-[kernel] empty_union.i:8: User Error: 
-  empty unions only allowed for GCC/MSVC machdeps; see option -machdep or run 'frama-c -machdep help' for the list of available machdeps
-[kernel] empty_union.i:8: User Error: 
-  empty initializers only allowed for GCC/MSVC machdeps; see option -machdep or run 'frama-c -machdep help' for the list of available machdeps
-  6     
-  7     // based on GCC's 'torture' test suite
-  8     union empty {} eu = {};
-                       ^^
-[kernel] Frama-C aborted: invalid user input.
+[kernel] Parsing empty_union_reparse.c (with preprocessing)
+/* Generated by Frama-C */
+union empty {
+   
+};
+union empty eu = {};
+
diff --git a/tests/syntax/oracle/empty_union.2.res.oracle b/tests/syntax/oracle/empty_union.2.res.oracle
new file mode 100644
index 0000000000..c1a338cee3
--- /dev/null
+++ b/tests/syntax/oracle/empty_union.2.res.oracle
@@ -0,0 +1,10 @@
+[kernel] Parsing empty_union.i (no preprocessing)
+[kernel] empty_union.i:9: User Error: 
+  empty unions only allowed for GCC/MSVC machdeps; see option -machdep or run 'frama-c -machdep help' for the list of available machdeps
+[kernel] empty_union.i:9: User Error: 
+  empty initializers only allowed for GCC/MSVC machdeps; see option -machdep or run 'frama-c -machdep help' for the list of available machdeps
+  7     
+  8     // based on GCC's 'torture' test suite
+  9     union empty {} eu = {};
+                       ^^
+[kernel] Frama-C aborted: invalid user input.
-- 
GitLab