diff mbox

Forwarding -foffload=[...] from the driver (compile-time) to libgomp (run-time)

Message ID alpine.DEB.2.10.1508251455170.326@digraph.polyomino.org.uk
State New
Headers show

Commit Message

Joseph Myers Aug. 25, 2015, 2:58 p.m. UTC
On reviewing in more detail the changes to pass offloading targets
from the driver to libgomp at link time to identify the minimal
self-contained pieces that can go to trunk, I found that the use of
fnmatch to match against target names was completely unnecessary; the
ISO C90 functions strstr and strncmp could be used instead, so
avoiding the need to add configure tests for fnmatch.  This patch duly
removes the use of and configure tests for fnmatch.

Will commit to gomp-4_0-branch subject to test results.

2015-08-25  Joseph Myers  <joseph@codesourcery.com>

	* plugin/configfrag.ac: Don't test for fnmatch.h or fnmatch.
	* configure, config.h.in: Regenerate.
	* target.c [PLUGIN_SUPPORT]: Don't include <fnmatch.h>.
	(offload_target_to_plugin_name): Use strstr and strncmp instead of
	fnmatch.
diff mbox

Patch

Index: libgomp/config.h.in
===================================================================
--- libgomp/config.h.in	(revision 227169)
+++ libgomp/config.h.in	(working copy)
@@ -24,12 +24,6 @@ 
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
-/* Define to 1 if you have the `fnmatch' function. */
-#undef HAVE_FNMATCH
-
-/* Define to 1 if you have the <fnmatch.h> header file. */
-#undef HAVE_FNMATCH_H
-
 /* Define to 1 if you have the `getloadavg' function. */
 #undef HAVE_GETLOADAVG
 
Index: libgomp/target.c
===================================================================
--- libgomp/target.c	(revision 227169)
+++ libgomp/target.c	(working copy)
@@ -41,7 +41,6 @@ 
 
 #ifdef PLUGIN_SUPPORT
 #include <dlfcn.h>
-#include <fnmatch.h>
 #include "plugin-suffix.h"
 #endif
 
@@ -1271,9 +1270,9 @@ 
 static const char *
 offload_target_to_plugin_name (const char *offload_target)
 {
-  if (fnmatch ("*-intelmic*", offload_target, 0) == 0)
+  if (strstr (offload_target, "-intelmic") != NULL)
     return "intelmic";
-  if (fnmatch ("nvptx*", offload_target, 0) == 0)
+  if (strncmp (offload_target, "nvptx", 5) == 0)
     return "nvptx";
   gomp_fatal ("Unknown offload target: %s", offload_target);
 }
Index: libgomp/configure
===================================================================
--- libgomp/configure	(revision 227169)
+++ libgomp/configure	(working copy)
@@ -15119,33 +15119,6 @@ 
 offload_targets=
 
 plugin_support=yes
-for ac_header in fnmatch.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "fnmatch.h" "ac_cv_header_fnmatch_h" "$ac_includes_default"
-if test "x$ac_cv_header_fnmatch_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_FNMATCH_H 1
-_ACEOF
-
-else
-  plugin_support=no
-fi
-
-done
-
-for ac_func in fnmatch
-do :
-  ac_fn_c_check_func "$LINENO" "fnmatch" "ac_cv_func_fnmatch"
-if test "x$ac_cv_func_fnmatch" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_FNMATCH 1
-_ACEOF
-
-else
-  plugin_support=no
-fi
-done
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlsym in -ldl" >&5
 $as_echo_n "checking for dlsym in -ldl... " >&6; }
 if test "${ac_cv_lib_dl_dlsym+set}" = set; then :
Index: libgomp/plugin/configfrag.ac
===================================================================
--- libgomp/plugin/configfrag.ac	(revision 227169)
+++ libgomp/plugin/configfrag.ac	(working copy)
@@ -29,8 +29,6 @@ 
 offload_targets=
 AC_SUBST(offload_targets)
 plugin_support=yes
-AC_CHECK_HEADERS([fnmatch.h], , [plugin_support=no])
-AC_CHECK_FUNCS([fnmatch], , [plugin_support=no])
 AC_CHECK_LIB(dl, dlsym, , [plugin_support=no])
 if test x"$plugin_support" = xyes; then
   AC_DEFINE(PLUGIN_SUPPORT, 1,