public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-6266] c-family: Fix up -fno-debug-cpp [PR111965]
@ 2023-12-07  8:48 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2023-12-07  8:48 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:8c088c4307dbb855596acb6366b0882e95d20b91

commit r14-6266-g8c088c4307dbb855596acb6366b0882e95d20b91
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Dec 7 09:47:54 2023 +0100

    c-family: Fix up -fno-debug-cpp [PR111965]
    
    As can be seen in the second testcase, -fno-debug-cpp is actually
    implemented the same as -fdebug-cpp and so doesn't turn the debugging
    off.
    
    The following patch fixes that.
    
    2023-12-07  Andrew Pinski  <pinskia@gmail.com>
                Jakub Jelinek  <jakub@redhat.com>
    
            PR preprocessor/111965
    gcc/c-family/
            * c-opts.cc (c_common_handle_option) <case OPT_fdebug_cpp>: Set
            cpp_opts->debug to value rather than 1.
    gcc/testsuite/
            * gcc.dg/cpp/pr111965-1.c: New test.
            * gcc.dg/cpp/pr111965-2.c: New test.

Diff:
---
 gcc/c-family/c-opts.cc                | 2 +-
 gcc/testsuite/gcc.dg/cpp/pr111965-1.c | 5 +++++
 gcc/testsuite/gcc.dg/cpp/pr111965-2.c | 5 +++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc
index 60aa7c5fd43..0399899387f 100644
--- a/gcc/c-family/c-opts.cc
+++ b/gcc/c-family/c-opts.cc
@@ -532,7 +532,7 @@ c_common_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
       break;
 
     case OPT_fdebug_cpp:
-      cpp_opts->debug = 1;
+      cpp_opts->debug = value;
       break;
 
     case OPT_ftrack_macro_expansion:
diff --git a/gcc/testsuite/gcc.dg/cpp/pr111965-1.c b/gcc/testsuite/gcc.dg/cpp/pr111965-1.c
new file mode 100644
index 00000000000..97900552a4c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/pr111965-1.c
@@ -0,0 +1,5 @@
+/* PR preprocessor/111965
+   { dg-do preprocess }
+   { dg-options "-fdebug-cpp" }
+   { dg-final { scan-file pr111965-1.i "P:<built-in>;F:<NULL>;" } } */
+int x;
diff --git a/gcc/testsuite/gcc.dg/cpp/pr111965-2.c b/gcc/testsuite/gcc.dg/cpp/pr111965-2.c
new file mode 100644
index 00000000000..44f30121092
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/pr111965-2.c
@@ -0,0 +1,5 @@
+/* PR preprocessor/111965
+   { dg-do preprocess }
+   { dg-options "-fdebug-cpp -fno-debug-cpp" }
+   { dg-final { scan-file-not pr111965-2.i "P:<built-in>;F:<NULL>;" } } */
+int x;

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

only message in thread, other threads:[~2023-12-07  8:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-07  8:48 [gcc r14-6266] c-family: Fix up -fno-debug-cpp [PR111965] Jakub Jelinek

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).