]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR modula2/114648 cc1gm2 by default does not handle C pre-processor file and line...
authorGaius Mulley <gaiusmod2@gmail.com>
Tue, 9 Apr 2024 01:35:11 +0000 (02:35 +0100)
committerGaius Mulley <gaiusmod2@gmail.com>
Tue, 9 Apr 2024 01:35:11 +0000 (02:35 +0100)
This patch fixes the default behavior of cc1gm2 to the description in
the documentation.  By default cc1gm2 will allow C preprocessor
directives (they can be turned off via -fno-cpp).

gcc/m2/ChangeLog:

PR modula2/114648
* gm2-compiler/M2Options.mod (LineDirectives): Initially
set to true.

gcc/testsuite/ChangeLog:

PR modula2/114648
* gm2/cpp/default/pass/AdvParse.def: New test.
* gm2/cpp/default/pass/AdvParse.mod: New test.
* gm2/cpp/default/pass/cpp-default-pass.exp: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
gcc/m2/gm2-compiler/M2Options.mod
gcc/testsuite/gm2/cpp/default/pass/AdvParse.def [new file with mode: 0644]
gcc/testsuite/gm2/cpp/default/pass/AdvParse.mod [new file with mode: 0644]
gcc/testsuite/gm2/cpp/default/pass/cpp-default-pass.exp [new file with mode: 0644]

index 09d62cbc732ccd2250f64eedd0174f442156ec9e..d04cded17f0561bea73b26db7f66e9d66d7f9ad3 100644 (file)
@@ -1944,7 +1944,7 @@ BEGIN
    ReturnChecking                    := FALSE ;
    CaseElseChecking                  := FALSE ;
    CPreProcessor                     := FALSE ;
-   LineDirectives                    := FALSE ;
+   LineDirectives                    := TRUE ;
    ExtendedOpaque                    := FALSE ;
    UnboundedByReference              := FALSE ;
    VerboseUnbounded                  := FALSE ;
diff --git a/gcc/testsuite/gm2/cpp/default/pass/AdvParse.def b/gcc/testsuite/gm2/cpp/default/pass/AdvParse.def
new file mode 100644 (file)
index 0000000..391a803
--- /dev/null
@@ -0,0 +1,5 @@
+DEFINITION MODULE AdvParse ;
+
+PROCEDURE foo ;
+
+END AdvParse.
diff --git a/gcc/testsuite/gm2/cpp/default/pass/AdvParse.mod b/gcc/testsuite/gm2/cpp/default/pass/AdvParse.mod
new file mode 100644 (file)
index 0000000..ed3727c
--- /dev/null
@@ -0,0 +1,8 @@
+# 2 "AdvParse.bnf"
+IMPLEMENTATION MODULE AdvParse ;
+
+PROCEDURE foo ;
+BEGIN
+END foo ;
+
+END AdvParse.
\ No newline at end of file
diff --git a/gcc/testsuite/gm2/cpp/default/pass/cpp-default-pass.exp b/gcc/testsuite/gm2/cpp/default/pass/cpp-default-pass.exp
new file mode 100644 (file)
index 0000000..0b373cf
--- /dev/null
@@ -0,0 +1,36 @@
+# Copyright (C) 2024 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# This file was written by Gaius Mulley (gaiusmod2@gmail.com)
+# for GNU Modula-2.
+
+if $tracelevel then {
+    strace $tracelevel
+}
+
+# load support procs
+load_lib gm2-torture.exp
+
+gm2_init_pim "${srcdir}/gm2/cpp/default/pass/"
+
+foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
+    # If we're only testing specific files and this isn't one of them, skip it.
+    if ![runtest_file_p $runtests $testcase] then {
+       continue
+    }
+
+    gm2-torture $testcase
+}