public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-9849] PR modula2/114648 cc1gm2 by default does not handle C pre-processor file and line directives
@ 2024-04-09  1:40 Gaius Mulley
  0 siblings, 0 replies; only message in thread
From: Gaius Mulley @ 2024-04-09  1:40 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:600bf396799a022e65938de572ad1a79a951b95a

commit r14-9849-g600bf396799a022e65938de572ad1a79a951b95a
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date:   Tue Apr 9 02:35:11 2024 +0100

    PR modula2/114648 cc1gm2 by default does not handle C pre-processor file and line directives
    
    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>

Diff:
---
 gcc/m2/gm2-compiler/M2Options.mod                  |  2 +-
 gcc/testsuite/gm2/cpp/default/pass/AdvParse.def    |  5 +++
 gcc/testsuite/gm2/cpp/default/pass/AdvParse.mod    |  8 +++++
 .../gm2/cpp/default/pass/cpp-default-pass.exp      | 36 ++++++++++++++++++++++
 4 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/gcc/m2/gm2-compiler/M2Options.mod b/gcc/m2/gm2-compiler/M2Options.mod
index 09d62cbc732..d04cded17f0 100644
--- a/gcc/m2/gm2-compiler/M2Options.mod
+++ b/gcc/m2/gm2-compiler/M2Options.mod
@@ -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
index 00000000000..391a803116f
--- /dev/null
+++ b/gcc/testsuite/gm2/cpp/default/pass/AdvParse.def
@@ -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
index 00000000000..ed3727c63c6
--- /dev/null
+++ b/gcc/testsuite/gm2/cpp/default/pass/AdvParse.mod
@@ -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
index 00000000000..0b373cfd655
--- /dev/null
+++ b/gcc/testsuite/gm2/cpp/default/pass/cpp-default-pass.exp
@@ -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
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-09  1:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-09  1:40 [gcc r14-9849] PR modula2/114648 cc1gm2 by default does not handle C pre-processor file and line directives Gaius Mulley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).