Enable macro test for clang compiler
authorSourabh Singh Tomar <SourabhSingh.Tomar@amd.com>
Fri, 19 Mar 2021 05:07:58 +0000 (10:37 +0530)
committerAlok Kumar Sharma <AlokKumar.Sharma@amd.com>
Fri, 19 Mar 2021 05:14:56 +0000 (10:44 +0530)
`clang` uses `-fdebug-macro` switch to enable debug-info
for macros.

gdb/testsuite/ChangeLog:

2021-03-19  Sourabh Singh Tomar  <SourabhSingh.Tomar@amd.com>

* gdb.base/info-macros.exp: Append -fdebug-macro to
  additional_flags for clang.
* gdb.base/macscp.exp: Likewise.
* gdb.base/style.exp: Likewise.
* gdb.linespec/macro-relative.exp: Likewise.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/info-macros.exp
gdb/testsuite/gdb.base/macscp.exp
gdb/testsuite/gdb.base/style.exp
gdb/testsuite/gdb.linespec/macro-relative.exp

index c1d7fec6cc4598a80ee0bd2811202f16699f5dda..42484fa588a7fab9755a451956e7ab2acb8fb626 100644 (file)
@@ -1,3 +1,11 @@
+2021-03-19  Sourabh Singh Tomar  <SourabhSingh.Tomar@amd.com>
+
+       * gdb.base/info-macros.exp: Append -fdebug-macro to
+         additional_flags for clang.
+       * gdb.base/macscp.exp: Likewise.
+       * gdb.base/style.exp: Likewise.
+       * gdb.linespec/macro-relative.exp: Likewise.
+
 2021-03-17  Simon Marchi  <simon.marchi@polymtl.ca>
            Pedro Alves  <pedro@palves.net>
 
index 90da9dbe16df9612790038c00c9a0e27778212c7..c75229f80d9433bc7f97cb4db295db53ab52f69d 100644 (file)
@@ -22,15 +22,17 @@ if [using_fission] {
 }
 
 get_compiler_info
-if ![test_compiler_info gcc*] {
-  untested "no compiler info"
-  return -1
+if { [test_compiler_info gcc*] } {
+    # Don't use "debug" here.  Otherwise "-g" would be appended to the gcc
+    # command line, possibly overriding "-g3" (depending on gcc version).
+    set options "additional_flags=-g3"
+} elseif { [test_compiler_info clang*] } {
+    set options "additional_flags=-fdebug-macro"
+} else {
+    untested "no compiler info"
+    return -1
 }
 
-# Don't use "debug" here.  Otherwise "-g" would be appended to the gcc
-# command line, possibly overriding "-g3" (depending on gcc version).
-set options "additional_flags=-g3"
-
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $options] } {
     return -1
 }
index 724f7377b57ee0cde32112b15a6fcb9c23d4eabe..9d295ad20de831f38608682695a6982c878c4dac 100644 (file)
@@ -21,8 +21,10 @@ set objfile [standard_output_file ${testfile}.o]
 set options { debug additional_flags=-DFROM_COMMANDLINE=ARG}
 
 get_compiler_info
-if { [test_compiler_info "gcc-*"] || [test_compiler_info "clang-*"] } {
+if { [test_compiler_info "gcc-*"] } {
     lappend options additional_flags=-g3
+} elseif { [test_compiler_info "clang-*"] } {
+    lappend options additional_flags=-fdebug-macro
 }
 
 # Generate the intermediate object file.  This is required by Darwin to
index 0754c9daa49d799dfcfdae88563a9fde34c6a547..4a3428bc63feef8907265bf28293962091f6cb55 100644 (file)
@@ -21,9 +21,12 @@ standard_testfile
 set test_macros 0
 set options debug
 get_compiler_info
-if { [test_compiler_info "gcc-*"] || [test_compiler_info "clang-*"] } {
+if { [test_compiler_info "gcc-*"] } {
     lappend options additional_flags=-g3
     set test_macros 1
+} elseif { [test_compiler_info "clang-*"] } {
+    lappend options additional_flags=-fdebug-macro
+    set test_macros 1
 }
 
 if {[build_executable "failed to build" $testfile $srcfile $options]} {
index 32375e5cb7c8ea5db34ea13b93c59028a7c906d4..c8e5b29d81f0d17406f8d5893f869a35436273ca 100644 (file)
@@ -31,6 +31,8 @@ set opts {debug additional_flags=-I.}
 get_compiler_info
 if [test_compiler_info gcc*] {
     lappend opts additional_flags=-g3
+} elseif [test_compiler_info clang*] {
+    lappend opts additional_flags=-fdebug-macro
 }
 
 if { [file pathtype $objdir] == "relative" } {