[1/2] Add gdb_compile_openmp to lib/gdb.exp

Message ID 20190822171408.28271-2-kevinb@redhat.com
State New, archived
Headers

Commit Message

Kevin Buettner Aug. 22, 2019, 5:14 p.m. UTC
  gdb/testsuite/ChangeLog:

	* lib/gdb.exp (gdb_compile_openmp): New proc.
---
 gdb/testsuite/lib/gdb.exp | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
  

Comments

Terekhov, Mikhail via Gdb-patches Aug. 22, 2019, 5:18 p.m. UTC | #1
On Thu, Aug 22, 2019 at 12:14 PM Kevin Buettner <kevinb@redhat.com> wrote:
>
> gdb/testsuite/ChangeLog:
>
>         * lib/gdb.exp (gdb_compile_openmp): New proc.
> ---
>  gdb/testsuite/lib/gdb.exp | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index af56e8aa12..c8bca2f277 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -4053,6 +4053,26 @@ proc gdb_compile_objc {source dest type options} {
>      }
>  }
>
> +# Build an OpenMP program from SOURCE.  See prefatory comment for
> +# gdb_compile, above, for discussion of the parameters to this proc.
> +
> +proc gdb_compile_openmp {source dest type options} {
> +    switch -glob [test_compiler_info] {
> +        "gcc-*" {
> +            if { !([istarget "*-*-cygwin*"]
> +                   || [istarget "*-*-mingw*"]
> +                   || [istarget "*-*-pe*"]) } {
> +                lappend options "additional_flags=-fopenmp"

Why exclude cygwin/mingw here?

> +            }
> +        }
> +        default {
> +           # Don't know what flags to pass for this compiler
> +        }
> +    }
> +
> +    return [gdb_compile $source $dest $type $options]
> +}
> +
>  # Send a command to GDB.
>  # For options for TYPE see gdb_stdin_log_write
>
> --
> 2.21.0
>
  
Kevin Buettner Aug. 22, 2019, 5:27 p.m. UTC | #2
On Thu, 22 Aug 2019 12:18:13 -0500
Christian Biesinger <cbiesinger@google.com> wrote:

> > +# Build an OpenMP program from SOURCE.  See prefatory comment for
> > +# gdb_compile, above, for discussion of the parameters to this proc.
> > +
> > +proc gdb_compile_openmp {source dest type options} {
> > +    switch -glob [test_compiler_info] {
> > +        "gcc-*" {
> > +            if { !([istarget "*-*-cygwin*"]
> > +                   || [istarget "*-*-mingw*"]
> > +                   || [istarget "*-*-pe*"]) } {
> > +                lappend options "additional_flags=-fopenmp"  
> 
> Why exclude cygwin/mingw here?

No good reason.  I've removed those lines from my local sources.

Thanks for noticing this.

Kevin
  

Patch

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index af56e8aa12..c8bca2f277 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4053,6 +4053,26 @@  proc gdb_compile_objc {source dest type options} {
     }
 }
 
+# Build an OpenMP program from SOURCE.  See prefatory comment for
+# gdb_compile, above, for discussion of the parameters to this proc.
+
+proc gdb_compile_openmp {source dest type options} {
+    switch -glob [test_compiler_info] {
+        "gcc-*" {
+            if { !([istarget "*-*-cygwin*"]
+                   || [istarget "*-*-mingw*"]
+                   || [istarget "*-*-pe*"]) } {
+                lappend options "additional_flags=-fopenmp"
+            }
+        }
+        default {
+	    # Don't know what flags to pass for this compiler
+        }
+    }
+
+    return [gdb_compile $source $dest $type $options]
+}
+
 # Send a command to GDB.
 # For options for TYPE see gdb_stdin_log_write