+2006-01-18 Richard Henderson <rth@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+ Diego Novillo <dnovillo@redhat.com>
+
+ * libgomp: New directory.
+ * Makefile.def: Add target_module libgomp.
+ * Makefile.in: Regenerate.
+ * configure.in (target_libraries): Add target-libgomp.
+ * configure: Regenerate.
+
2006-01-05 Alexandre Oliva <aoliva@redhat.com>
* Makefile.tpl (clean-stage[+id+]-[+prefix+][+module+]): Remove
(EXTRA_HOST_FLAGS): Add it.
(EXTRA_GCC_FLAGS): Remove flags already specified in flags_to_pass.
- * Makefile.tpl (stage[+id+]-start, stage[+id+]-end): Do not try
- to use symbolic links between directories. Avoid race conditions
- or make them harmless.
- * configure.in: Do not try to use symbolic links between directories.
+ * Makefile.tpl (stage[+id+]-start, stage[+id+]-end): Do not try
+ to use symbolic links between directories. Avoid race conditions
+ or make them harmless.
+ * configure.in: Do not try to use symbolic links between directories.
* Makefile.def (LEAN): Pass.
* Makefile.tpl (LEAN): Define.
([+bootstrap-target+]-lean): New.
* configure.in: Remove lean bootstrap support from here.
- * Makefile.in: Regenerate.
- * configure: Regenerate.
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
2006-01-04 Ben Elliston <bje@au.ibm.com>
target_modules = { module= qthreads; };
target_modules = { module= rda; };
target_modules = { module= libada; };
+target_modules = { module= libgomp; lib_path=.libs; };
// These are (some of) the make targets to be done in each subdirectory.
// Not all; these are the ones which don't have special options.
# This is the list of directories that may be needed in RPATH_ENVVAR
# so that prorgams built for the target machine work.
-TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libmudflap)$(TARGET_LIB_PATH_libssp)$(HOST_LIB_PATH_gcc)
+TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libmudflap)$(TARGET_LIB_PATH_libssp)$(TARGET_LIB_PATH_libgomp)$(HOST_LIB_PATH_gcc)
@if target-libstdc++-v3
TARGET_LIB_PATH_libstdc++-v3 = $$r/$(TARGET_SUBDIR)/libstdc++-v3/.libs:
TARGET_LIB_PATH_libssp = $$r/$(TARGET_SUBDIR)/libssp/.libs:
@endif target-libssp
+@if target-libgomp
+TARGET_LIB_PATH_libgomp = $$r/$(TARGET_SUBDIR)/libgomp/.libs:
+@endif target-libgomp
+
# This is the list of directories that may be needed in RPATH_ENVVAR
maybe-configure-target-boehm-gc \
maybe-configure-target-qthreads \
maybe-configure-target-rda \
- maybe-configure-target-libada
+ maybe-configure-target-libada \
+ maybe-configure-target-libgomp
# The target built for a native non-bootstrap build.
.PHONY: all
maybe-all-target-boehm-gc \
maybe-all-target-qthreads \
maybe-all-target-rda \
- maybe-all-target-libada
+ maybe-all-target-libada \
+ maybe-all-target-libgomp
# Do a target for all the subdirectories. A ``make do-X'' will do a
# ``make X'' in all subdirectories (because, in general, there is a
maybe-info-target-boehm-gc \
maybe-info-target-qthreads \
maybe-info-target-rda \
- maybe-info-target-libada
+ maybe-info-target-libada \
+ maybe-info-target-libgomp
.PHONY: do-dvi
do-dvi:
maybe-dvi-target-boehm-gc \
maybe-dvi-target-qthreads \
maybe-dvi-target-rda \
- maybe-dvi-target-libada
+ maybe-dvi-target-libada \
+ maybe-dvi-target-libgomp
.PHONY: do-html
do-html:
maybe-html-target-boehm-gc \
maybe-html-target-qthreads \
maybe-html-target-rda \
- maybe-html-target-libada
+ maybe-html-target-libada \
+ maybe-html-target-libgomp
.PHONY: do-TAGS
do-TAGS:
maybe-TAGS-target-boehm-gc \
maybe-TAGS-target-qthreads \
maybe-TAGS-target-rda \
- maybe-TAGS-target-libada
+ maybe-TAGS-target-libada \
+ maybe-TAGS-target-libgomp
.PHONY: do-install-info
do-install-info:
maybe-install-info-target-boehm-gc \
maybe-install-info-target-qthreads \
maybe-install-info-target-rda \
- maybe-install-info-target-libada
+ maybe-install-info-target-libada \
+ maybe-install-info-target-libgomp
.PHONY: do-installcheck
do-installcheck:
maybe-installcheck-target-boehm-gc \
maybe-installcheck-target-qthreads \
maybe-installcheck-target-rda \
- maybe-installcheck-target-libada
+ maybe-installcheck-target-libada \
+ maybe-installcheck-target-libgomp
.PHONY: do-mostlyclean
do-mostlyclean:
maybe-mostlyclean-target-boehm-gc \
maybe-mostlyclean-target-qthreads \
maybe-mostlyclean-target-rda \
- maybe-mostlyclean-target-libada
+ maybe-mostlyclean-target-libada \
+ maybe-mostlyclean-target-libgomp
.PHONY: do-clean
do-clean:
maybe-clean-target-boehm-gc \
maybe-clean-target-qthreads \
maybe-clean-target-rda \
- maybe-clean-target-libada
+ maybe-clean-target-libada \
+ maybe-clean-target-libgomp
.PHONY: do-distclean
do-distclean:
maybe-distclean-target-boehm-gc \
maybe-distclean-target-qthreads \
maybe-distclean-target-rda \
- maybe-distclean-target-libada
+ maybe-distclean-target-libada \
+ maybe-distclean-target-libgomp
.PHONY: do-maintainer-clean
do-maintainer-clean:
maybe-maintainer-clean-target-boehm-gc \
maybe-maintainer-clean-target-qthreads \
maybe-maintainer-clean-target-rda \
- maybe-maintainer-clean-target-libada
+ maybe-maintainer-clean-target-libada \
+ maybe-maintainer-clean-target-libgomp
# Here are the targets which correspond to the do-X targets.
maybe-check-target-boehm-gc \
maybe-check-target-qthreads \
maybe-check-target-rda \
- maybe-check-target-libada
+ maybe-check-target-libada \
+ maybe-check-target-libgomp
do-check:
@: $(MAKE); $(unstage)
maybe-install-target-boehm-gc \
maybe-install-target-qthreads \
maybe-install-target-rda \
- maybe-install-target-libada
+ maybe-install-target-libada \
+ maybe-install-target-libgomp
uninstall:
@echo "the uninstall target is not supported in this tree"
+
+
+.PHONY: configure-target-libgomp maybe-configure-target-libgomp
+maybe-configure-target-libgomp:
+@if target-libgomp
+maybe-configure-target-libgomp: configure-target-libgomp
+configure-target-libgomp:
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ echo "Checking multilib configuration for libgomp..."; \
+ $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgomp ; \
+ $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libgomp/multilib.tmp 2> /dev/null ; \
+ if test -r $(TARGET_SUBDIR)/libgomp/multilib.out; then \
+ if cmp -s $(TARGET_SUBDIR)/libgomp/multilib.tmp $(TARGET_SUBDIR)/libgomp/multilib.out; then \
+ rm -f $(TARGET_SUBDIR)/libgomp/multilib.tmp; \
+ else \
+ rm -f $(TARGET_SUBDIR)/libgomp/Makefile; \
+ mv $(TARGET_SUBDIR)/libgomp/multilib.tmp $(TARGET_SUBDIR)/libgomp/multilib.out; \
+ fi; \
+ else \
+ mv $(TARGET_SUBDIR)/libgomp/multilib.tmp $(TARGET_SUBDIR)/libgomp/multilib.out; \
+ fi
+ @test ! -f $(TARGET_SUBDIR)/libgomp/Makefile || exit 0; \
+ $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgomp ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo Configuring in $(TARGET_SUBDIR)/libgomp; \
+ cd "$(TARGET_SUBDIR)/libgomp" || exit 1; \
+ case $(srcdir) in \
+ /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+ *) topdir=`echo $(TARGET_SUBDIR)/libgomp/ | \
+ sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+ esac; \
+ srcdiroption="--srcdir=$${topdir}/libgomp"; \
+ libsrcdir="$$s/libgomp"; \
+ rm -f no-such-file || : ; \
+ CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
+ $(TARGET_CONFIGARGS) $${srcdiroption} \
+ || exit 1
+@endif target-libgomp
+
+
+
+
+
+.PHONY: all-target-libgomp maybe-all-target-libgomp
+maybe-all-target-libgomp:
+@if target-libgomp
+TARGET-target-libgomp=all
+maybe-all-target-libgomp: all-target-libgomp
+all-target-libgomp: configure-target-libgomp
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ (cd $(TARGET_SUBDIR)/libgomp && \
+ $(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-libgomp))
+@endif target-libgomp
+
+
+
+
+
+.PHONY: check-target-libgomp maybe-check-target-libgomp
+maybe-check-target-libgomp:
+@if target-libgomp
+maybe-check-target-libgomp: check-target-libgomp
+
+check-target-libgomp:
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ (cd $(TARGET_SUBDIR)/libgomp && \
+ $(MAKE) $(TARGET_FLAGS_TO_PASS) check)
+
+@endif target-libgomp
+
+.PHONY: install-target-libgomp maybe-install-target-libgomp
+maybe-install-target-libgomp:
+@if target-libgomp
+maybe-install-target-libgomp: install-target-libgomp
+
+install-target-libgomp: installdirs
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ (cd $(TARGET_SUBDIR)/libgomp && \
+ $(MAKE) $(TARGET_FLAGS_TO_PASS) install)
+
+@endif target-libgomp
+
+# Other targets (info, dvi, etc.)
+
+.PHONY: maybe-info-target-libgomp info-target-libgomp
+maybe-info-target-libgomp:
+@if target-libgomp
+maybe-info-target-libgomp: info-target-libgomp
+
+info-target-libgomp: \
+ configure-target-libgomp
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing info in $(TARGET_SUBDIR)/libgomp" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgomp && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+ info) \
+ || exit 1
+
+@endif target-libgomp
+
+.PHONY: maybe-dvi-target-libgomp dvi-target-libgomp
+maybe-dvi-target-libgomp:
+@if target-libgomp
+maybe-dvi-target-libgomp: dvi-target-libgomp
+
+dvi-target-libgomp: \
+ configure-target-libgomp
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing dvi in $(TARGET_SUBDIR)/libgomp" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgomp && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+ dvi) \
+ || exit 1
+
+@endif target-libgomp
+
+.PHONY: maybe-html-target-libgomp html-target-libgomp
+maybe-html-target-libgomp:
+@if target-libgomp
+maybe-html-target-libgomp: html-target-libgomp
+
+html-target-libgomp: \
+ configure-target-libgomp
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing html in $(TARGET_SUBDIR)/libgomp" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgomp && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+ html) \
+ || exit 1
+
+@endif target-libgomp
+
+.PHONY: maybe-TAGS-target-libgomp TAGS-target-libgomp
+maybe-TAGS-target-libgomp:
+@if target-libgomp
+maybe-TAGS-target-libgomp: TAGS-target-libgomp
+
+TAGS-target-libgomp: \
+ configure-target-libgomp
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing TAGS in $(TARGET_SUBDIR)/libgomp" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgomp && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+ TAGS) \
+ || exit 1
+
+@endif target-libgomp
+
+.PHONY: maybe-install-info-target-libgomp install-info-target-libgomp
+maybe-install-info-target-libgomp:
+@if target-libgomp
+maybe-install-info-target-libgomp: install-info-target-libgomp
+
+install-info-target-libgomp: \
+ configure-target-libgomp \
+ info-target-libgomp
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing install-info in $(TARGET_SUBDIR)/libgomp" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgomp && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+ install-info) \
+ || exit 1
+
+@endif target-libgomp
+
+.PHONY: maybe-installcheck-target-libgomp installcheck-target-libgomp
+maybe-installcheck-target-libgomp:
+@if target-libgomp
+maybe-installcheck-target-libgomp: installcheck-target-libgomp
+
+installcheck-target-libgomp: \
+ configure-target-libgomp
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing installcheck in $(TARGET_SUBDIR)/libgomp" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgomp && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+ installcheck) \
+ || exit 1
+
+@endif target-libgomp
+
+.PHONY: maybe-mostlyclean-target-libgomp mostlyclean-target-libgomp
+maybe-mostlyclean-target-libgomp:
+@if target-libgomp
+maybe-mostlyclean-target-libgomp: mostlyclean-target-libgomp
+
+mostlyclean-target-libgomp:
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing mostlyclean in $(TARGET_SUBDIR)/libgomp" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgomp && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+ mostlyclean) \
+ || exit 1
+
+@endif target-libgomp
+
+.PHONY: maybe-clean-target-libgomp clean-target-libgomp
+maybe-clean-target-libgomp:
+@if target-libgomp
+maybe-clean-target-libgomp: clean-target-libgomp
+
+clean-target-libgomp:
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing clean in $(TARGET_SUBDIR)/libgomp" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgomp && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+ clean) \
+ || exit 1
+
+@endif target-libgomp
+
+.PHONY: maybe-distclean-target-libgomp distclean-target-libgomp
+maybe-distclean-target-libgomp:
+@if target-libgomp
+maybe-distclean-target-libgomp: distclean-target-libgomp
+
+distclean-target-libgomp:
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing distclean in $(TARGET_SUBDIR)/libgomp" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgomp && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+ distclean) \
+ || exit 1
+
+@endif target-libgomp
+
+.PHONY: maybe-maintainer-clean-target-libgomp maintainer-clean-target-libgomp
+maybe-maintainer-clean-target-libgomp:
+@if target-libgomp
+maybe-maintainer-clean-target-libgomp: maintainer-clean-target-libgomp
+
+maintainer-clean-target-libgomp:
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libgomp" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/libgomp && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+ "RANLIB=$${RANLIB}" \
+ "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+ maintainer-clean) \
+ || exit 1
+
+@endif target-libgomp
+
+
+
# ----------
# GCC module
# ----------
configure-target-libada: maybe-all-gcc
+configure-target-libgomp: maybe-all-gcc
+
configure-target-boehm-gc: maybe-all-target-newlib maybe-all-target-libgloss
target-libgfortran \
${libgcj} \
target-libobjc \
- target-libada"
+ target-libada \
+ target-libgomp"
# these tools are built using the target libraries, and are intended to
# run only in the target environment
esac
esac
+# Allow --disable-libgomp to exclude target-libgomp
+case $enable_libgomp in
+yes)
+ ;;
+no)
+ noconfigdirs="$noconfigdirs target-libgomp"
+ ;;
+"")
+ # Enable libgomp by default on hosted POSIX systems.
+ case "${target}" in
+ *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu)
+ ;;
+ *-*-netbsd* | *-*-freebsd* | *-*-openbsd*)
+ ;;
+ *-*-solaris2* | *-*-sysv4* | *-*-irix* | *-*-osf* | *-*-hpux*)
+ ;;
+ *-*-darwin*)
+ ;;
+ *)
+ noconfigdirs="$noconfigdirs target-libgomp"
+ ;;
+ esac
+esac
+
case "${target}" in
*-*-chorusos)
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1831: checking for $ac_word" >&5
+echo "configure:1856: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1861: checking for $ac_word" >&5
+echo "configure:1886: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1912: checking for $ac_word" >&5
+echo "configure:1937: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1944: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1969: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
cat > conftest.$ac_ext << EOF
-#line 1955 "configure"
+#line 1980 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:1960: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1986: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2011: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1991: checking whether we are using GNU C" >&5
+echo "configure:2016: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2000: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2025: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:2019: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:2044: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ac_tool_prefix}gnatbind", so it can be a program name with args.
set dummy ${ac_tool_prefix}gnatbind; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2086: checking for $ac_word" >&5
+echo "configure:2111: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "gnatbind", so it can be a program name with args.
set dummy gnatbind; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2118: checking for $ac_word" >&5
+echo "configure:2143: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking whether compiler driver understands Ada""... $ac_c" 1>&6
-echo "configure:2151: checking whether compiler driver understands Ada" >&5
+echo "configure:2176: checking whether compiler driver understands Ada" >&5
if eval "test \"`echo '$''{'acx_cv_cc_gcc_supports_ada'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking how to compare bootstrapped objects""... $ac_c" 1>&6
-echo "configure:2183: checking how to compare bootstrapped objects" >&5
+echo "configure:2208: checking how to compare bootstrapped objects" >&5
if eval "test \"`echo '$''{'gcc_cv_prog_cmp_skip'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
CFLAGS="$CFLAGS $gmpinc"
# Check GMP actually works
echo $ac_n "checking for correct version of gmp.h""... $ac_c" 1>&6
-echo "configure:2281: checking for correct version of gmp.h" >&5
+echo "configure:2306: checking for correct version of gmp.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 2283 "configure"
+#line 2308 "configure"
#include "confdefs.h"
#include "gmp.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:2294: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2319: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
else
if test x"$have_gmp" = xyes; then
echo $ac_n "checking for MPFR""... $ac_c" 1>&6
-echo "configure:2307: checking for MPFR" >&5
+echo "configure:2332: checking for MPFR" >&5
saved_LIBS="$LIBS"
LIBS="$LIBS $gmplibs"
cat > conftest.$ac_ext <<EOF
-#line 2312 "configure"
+#line 2337 "configure"
#include "confdefs.h"
#include <gmp.h>
#include <mpfr.h>
mpfr_t n; mpfr_init(n);
; return 0; }
EOF
-if { (eval echo configure:2320: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3316: checking for $ac_word" >&5
+echo "configure:3341: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3356: checking for $ac_word" >&5
+echo "configure:3381: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_BISON'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3395: checking for $ac_word" >&5
+echo "configure:3420: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_M4'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3434: checking for $ac_word" >&5
+echo "configure:3459: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3474: checking for $ac_word" >&5
+echo "configure:3499: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_FLEX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3513: checking for $ac_word" >&5
+echo "configure:3538: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3566: checking for $ac_word" >&5
+echo "configure:3591: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_EXPECT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3607: checking for $ac_word" >&5
+echo "configure:3632: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RUNTEST'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3655: checking for $ac_word" >&5
+echo "configure:3680: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3686: checking for $ac_word" >&5
+echo "configure:3711: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3730: checking for $ac_word" >&5
+echo "configure:3755: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3761: checking for $ac_word" >&5
+echo "configure:3786: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3805: checking for $ac_word" >&5
+echo "configure:3830: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3836: checking for $ac_word" >&5
+echo "configure:3861: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3880: checking for $ac_word" >&5
+echo "configure:3905: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3911: checking for $ac_word" >&5
+echo "configure:3936: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3955: checking for $ac_word" >&5
+echo "configure:3980: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LIPO'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3986: checking for $ac_word" >&5
+echo "configure:4011: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LIPO'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4030: checking for $ac_word" >&5
+echo "configure:4055: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4061: checking for $ac_word" >&5
+echo "configure:4086: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4105: checking for $ac_word" >&5
+echo "configure:4130: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4136: checking for $ac_word" >&5
+echo "configure:4161: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4175: checking for $ac_word" >&5
+echo "configure:4200: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4206: checking for $ac_word" >&5
+echo "configure:4231: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4245: checking for $ac_word" >&5
+echo "configure:4270: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4276: checking for $ac_word" >&5
+echo "configure:4301: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4320: checking for $ac_word" >&5
+echo "configure:4345: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4351: checking for $ac_word" >&5
+echo "configure:4376: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4395: checking for $ac_word" >&5
+echo "configure:4420: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4426: checking for $ac_word" >&5
+echo "configure:4451: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4477: checking for $ac_word" >&5
+echo "configure:4502: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4508: checking for $ac_word" >&5
+echo "configure:4533: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4552: checking for $ac_word" >&5
+echo "configure:4577: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AS_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4583: checking for $ac_word" >&5
+echo "configure:4608: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AS_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4627: checking for $ac_word" >&5
+echo "configure:4652: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4658: checking for $ac_word" >&5
+echo "configure:4683: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4702: checking for $ac_word" >&5
+echo "configure:4727: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4733: checking for $ac_word" >&5
+echo "configure:4758: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4777: checking for $ac_word" >&5
+echo "configure:4802: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4808: checking for $ac_word" >&5
+echo "configure:4833: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4852: checking for $ac_word" >&5
+echo "configure:4877: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_GCC_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4883: checking for $ac_word" >&5
+echo "configure:4908: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_GCC_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4922: checking for $ac_word" >&5
+echo "configure:4947: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_GCJ_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4953: checking for $ac_word" >&5
+echo "configure:4978: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_GCJ_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4997: checking for $ac_word" >&5
+echo "configure:5022: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_GFORTRAN_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5028: checking for $ac_word" >&5
+echo "configure:5053: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_GFORTRAN_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5072: checking for $ac_word" >&5
+echo "configure:5097: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LD_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5103: checking for $ac_word" >&5
+echo "configure:5128: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LD_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5147: checking for $ac_word" >&5
+echo "configure:5172: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LIPO_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5178: checking for $ac_word" >&5
+echo "configure:5203: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LIPO_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5222: checking for $ac_word" >&5
+echo "configure:5247: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_NM_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5253: checking for $ac_word" >&5
+echo "configure:5278: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_NM_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5297: checking for $ac_word" >&5
+echo "configure:5322: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5328: checking for $ac_word" >&5
+echo "configure:5353: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5372: checking for $ac_word" >&5
+echo "configure:5397: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5403: checking for $ac_word" >&5
+echo "configure:5428: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5442: checking for $ac_word" >&5
+echo "configure:5467: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5473: checking for $ac_word" >&5
+echo "configure:5498: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5517: checking for $ac_word" >&5
+echo "configure:5542: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_WINDRES_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5548: checking for $ac_word" >&5
+echo "configure:5573: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_WINDRES_FOR_TARGET'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET"
echo $ac_n "checking where to find the target ar""... $ac_c" 1>&6
-echo "configure:5591: checking where to find the target ar" >&5
+echo "configure:5616: checking where to find the target ar" >&5
if test "x${build}" != "x${host}" ; then
# Canadian cross, just use what we found
echo "$ac_t""pre-installed" 1>&6
fi
fi
echo $ac_n "checking where to find the target as""... $ac_c" 1>&6
-echo "configure:5616: checking where to find the target as" >&5
+echo "configure:5641: checking where to find the target as" >&5
if test "x${build}" != "x${host}" ; then
# Canadian cross, just use what we found
echo "$ac_t""pre-installed" 1>&6
fi
fi
echo $ac_n "checking where to find the target cc""... $ac_c" 1>&6
-echo "configure:5641: checking where to find the target cc" >&5
+echo "configure:5666: checking where to find the target cc" >&5
if test "x${build}" != "x${host}" ; then
# Canadian cross, just use what we found
echo "$ac_t""pre-installed" 1>&6
fi
fi
echo $ac_n "checking where to find the target c++""... $ac_c" 1>&6
-echo "configure:5666: checking where to find the target c++" >&5
+echo "configure:5691: checking where to find the target c++" >&5
if test "x${build}" != "x${host}" ; then
# Canadian cross, just use what we found
echo "$ac_t""pre-installed" 1>&6
fi
fi
echo $ac_n "checking where to find the target c++ for libstdc++""... $ac_c" 1>&6
-echo "configure:5694: checking where to find the target c++ for libstdc++" >&5
+echo "configure:5719: checking where to find the target c++ for libstdc++" >&5
if test "x${build}" != "x${host}" ; then
# Canadian cross, just use what we found
echo "$ac_t""pre-installed" 1>&6
fi
fi
echo $ac_n "checking where to find the target dlltool""... $ac_c" 1>&6
-echo "configure:5722: checking where to find the target dlltool" >&5
+echo "configure:5747: checking where to find the target dlltool" >&5
if test "x${build}" != "x${host}" ; then
# Canadian cross, just use what we found
echo "$ac_t""pre-installed" 1>&6
fi
fi
echo $ac_n "checking where to find the target gcc""... $ac_c" 1>&6
-echo "configure:5747: checking where to find the target gcc" >&5
+echo "configure:5772: checking where to find the target gcc" >&5
if test "x${build}" != "x${host}" ; then
# Canadian cross, just use what we found
echo "$ac_t""pre-installed" 1>&6
fi
fi
echo $ac_n "checking where to find the target gcj""... $ac_c" 1>&6
-echo "configure:5772: checking where to find the target gcj" >&5
+echo "configure:5797: checking where to find the target gcj" >&5
if test "x${build}" != "x${host}" ; then
# Canadian cross, just use what we found
echo "$ac_t""pre-installed" 1>&6
fi
fi
echo $ac_n "checking where to find the target gfortran""... $ac_c" 1>&6
-echo "configure:5800: checking where to find the target gfortran" >&5
+echo "configure:5825: checking where to find the target gfortran" >&5
if test "x${build}" != "x${host}" ; then
# Canadian cross, just use what we found
echo "$ac_t""pre-installed" 1>&6
fi
fi
echo $ac_n "checking where to find the target ld""... $ac_c" 1>&6
-echo "configure:5828: checking where to find the target ld" >&5
+echo "configure:5853: checking where to find the target ld" >&5
if test "x${build}" != "x${host}" ; then
# Canadian cross, just use what we found
echo "$ac_t""pre-installed" 1>&6
fi
fi
echo $ac_n "checking where to find the target lipo""... $ac_c" 1>&6
-echo "configure:5853: checking where to find the target lipo" >&5
+echo "configure:5878: checking where to find the target lipo" >&5
if test "x${build}" != "x${host}" ; then
# Canadian cross, just use what we found
echo "$ac_t""pre-installed" 1>&6
fi
fi
echo $ac_n "checking where to find the target nm""... $ac_c" 1>&6
-echo "configure:5868: checking where to find the target nm" >&5
+echo "configure:5893: checking where to find the target nm" >&5
if test "x${build}" != "x${host}" ; then
# Canadian cross, just use what we found
echo "$ac_t""pre-installed" 1>&6
fi
fi
echo $ac_n "checking where to find the target objdump""... $ac_c" 1>&6
-echo "configure:5893: checking where to find the target objdump" >&5
+echo "configure:5918: checking where to find the target objdump" >&5
if test "x${build}" != "x${host}" ; then
# Canadian cross, just use what we found
echo "$ac_t""pre-installed" 1>&6
fi
fi
echo $ac_n "checking where to find the target ranlib""... $ac_c" 1>&6
-echo "configure:5918: checking where to find the target ranlib" >&5
+echo "configure:5943: checking where to find the target ranlib" >&5
if test "x${build}" != "x${host}" ; then
# Canadian cross, just use what we found
echo "$ac_t""pre-installed" 1>&6
fi
fi
echo $ac_n "checking where to find the target strip""... $ac_c" 1>&6
-echo "configure:5943: checking where to find the target strip" >&5
+echo "configure:5968: checking where to find the target strip" >&5
if test "x${build}" != "x${host}" ; then
# Canadian cross, just use what we found
echo "$ac_t""pre-installed" 1>&6
fi
fi
echo $ac_n "checking where to find the target windres""... $ac_c" 1>&6
-echo "configure:5968: checking where to find the target windres" >&5
+echo "configure:5993: checking where to find the target windres" >&5
if test "x${build}" != "x${host}" ; then
# Canadian cross, just use what we found
echo "$ac_t""pre-installed" 1>&6
echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:6021: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:6046: checking whether to enable maintainer-specific portions of Makefiles" >&5
# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
if test "${enable_maintainer_mode+set}" = set; then
enableval="$enable_maintainer_mode"
# Transform confdefs.h into DEFS.
# Protect against shell expansion while executing Makefile rules.
# Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then we branch to the quote section. Otherwise,
+# look for a macro that doesn't take arguments.
+cat >confdef2opt.sed <<\_ACEOF
+t clear
+: clear
+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
+t quote
+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
+t quote
+d
+: quote
+s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
+s,\[,\\&,g
+s,\],\\&,g
+s,\$,$$,g
+p
+_ACEOF
+# We use echo to avoid assuming a particular line-breaking character.
+# The extra dot is to prevent the shell from consuming trailing
+# line-breaks from the sub-command output. A line-break within
+# single-quotes doesn't work because, if this script is created in a
+# platform that uses two characters for line-breaks (e.g., DOS), tr
+# would break.
+ac_LF_and_DOT=`echo; echo .`
+DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
+rm -f confdef2opt.sed
# Without the "./", some shells look in PATH for config.status.
target-libgfortran \
${libgcj} \
target-libobjc \
- target-libada"
+ target-libada \
+ target-libgomp"
# these tools are built using the target libraries, and are intended to
# run only in the target environment
;;
"")
case "${target}" in
- *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu)
+ *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
# Enable libmudflap by default in GNU and friends.
;;
*-*-freebsd*)
esac
esac
+# Allow --disable-libgomp to exclude target-libgomp
+case $enable_libgomp in
+yes)
+ ;;
+no)
+ noconfigdirs="$noconfigdirs target-libgomp"
+ ;;
+"")
+ # Enable libgomp by default on hosted POSIX systems.
+ case "${target}" in
+ *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
+ ;;
+ *-*-netbsd* | *-*-freebsd* | *-*-openbsd*)
+ ;;
+ *-*-solaris2* | *-*-sysv4* | *-*-irix* | *-*-osf* | *-*-hpux*)
+ ;;
+ *-*-darwin*)
+ ;;
+ *)
+ noconfigdirs="$noconfigdirs target-libgomp"
+ ;;
+ esac
+esac
+
case "${target}" in
*-*-chorusos)
+2006-01-18 Richard Henderson <rth@redhat.com>
+ Diego Novillo <dnovillo@redhat.com>
+
+ * gcc_update (files_and_dependencies): Add libgomp files.
+
2005-12-06 Ben Elliston <bje@au.ibm.com>
* newcvsroot: Remove.
libcpp/aclocal.m4: libcpp/configure.ac
libcpp/Makefile.in: libcpp/configure.ac libcpp/aclocal.m4
libcpp/configure: libcpp/configure.ac libcpp/aclocal.m4
+libgomp/aclocal.m4: libgomp/configure.ac libgomp/acinclude.m4
+libgomp/Makefile.in: libgomp/Makefile.am libgomp/aclocal.m4
+libgomp/configure: libgomp/configure.ac libgomp/aclocal.m4
+libgomp/config.h.in: libgomp/configure.ac libgomp/aclocal.m4
# Top level
Makefile.in: Makefile.tpl Makefile.def
configure: configure.in config/acx.m4
+2006-01-18 Richard Henderson <rth@redhat.com>
+ Aldy Hernandez <aldyh@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+ Diego Novillo <dnovillo@redhat.com>
+
+ * omp-low.c: New file.
+ * c-omp.c: New file.
+
+2006-01-18 Richard Henderson <rth@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+ Diego Novillo <dnovillo@redhat.com>
+
+ * doc/invoke.texi: Document -fopenmp.
+ * tree-dump.h (debug_function): Declare.
+ * hooks.c (hook_bool_tree_bool_false): New function.
+ (hook_tree_tree_null): Remove.
+ (hook_tree_tree_tree_null): New.
+ * hooks.h: Update to match.
+ * tree-pretty-print.c (debug_tree_chain): New.
+ (print_generic_expr): Handle TDF_CHAIN.
+ (dump_generic_node): Handle BLOCK.
+ Do not abort with incomplete SWITCH_EXPRs.
+ Do not dump body of an OpenMP directive if TDF_SLIM is given.
+ <case OMP_PARALLEL, OMP_FOR, OMP_SECTIONS>: Don't
+ print space after directive name.
+ <OMP_FOR>: Handle printing OMP_FOR_PRE_BODY.
+ Handle OMP_MASTER and OMP_ORDERED.
+ Handle printing of OMP_BODY just in one place, goto
+ dump_omp_body in the rest of OMP_* nodes that have
+ OMP_BODY.
+ Don't handle clause nodes here. Update omp statements to
+ use dump_omp_clauses.
+ Handle OMP_SINGLE, OMP_SECTIONS, OMP_SECTION,
+ OMP_CLAUSE_ORDERED, OMP_CLAUSE_SCHEDULE, OMP_ATOMIC,
+ OMP_CRITICAL, OMP_CLAUSE_NOWAIT, GOMP_CLAUSE_IF,
+ GOMP_CLAUSE_NUM_THREADS, GOMP_FOR, GOMP_CLAUSE_SHARED,
+ GOMP_CLAUSE_FIRSTPRIVATE, GOMP_CLAUSE_LASTPRIVATE,
+ GOMP_CLAUSE_COPYIN and GOMP_CLAUSE_COPYPRIVATE.
+ Adjust output for GOMP_PARALLEL.
+ (dump_omp_clauses): New.
+ (print_declaration): Dump DECL_VALUE_EXPR.
+ (op_symbol_1): Split out of op_symbol.
+ (dumping_stmts): Remove. Update all users.
+ * cgraph.c (cgraph_analyze_queue): New.
+ (cgraph_add_new_function): New.
+ * cgraph.h (cgraph_analyze_queue): Declare.
+ (cgraph_add_new_function): Declare.
+ (cgraph_lower_function): Remove.
+ * tree.c (walk_tree): Walk OMP_CLAUSE_CHAIN of OMP_CLAUSE_*
+ nodes. Use switch for all nodes, handle most of IS_EXPR_CODE_CLASS
+ and TYPE_P nodes in its default clause.
+ (empty_body_p): New.
+ (tree_range_check_failed): New.
+ (build5_stat): New.
+ * tree.h (OMP_CLAUSE_REDUCTION_INIT,
+ OMP_CLAUSE_REDUCTION_MERGE,
+ OMP_CLAUSE_REDUCTION_PLACEHOLDER,
+ OMP_CLAUSE_PRIVATE_DEBUG,
+ OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE, OMP_FOR_PRE_BODY,
+ OMP_MASTER_BODY, OMP_ORDERED_BODY OMP_BODY,
+ OMP_CLAUSES, OMP_CLAUSE_DECL, OMP_CLAUSE_DEFAULT_KIND,
+ OMP_CLAUSE_CHAIN, OMP_CLAUSE_OUTER_DECL,
+ OMP_CLAUSE_INNER_DECL, OMP_CLAUSE_NUM_THREADS_EXPR,
+ OMP_CLAUSE_IF_EXPR, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR,
+ OMP_CLAUSE_SCHEDULE_CHUNK_SIZE. OMP_PARALLEL_VAR_INIT,
+ OMP_PARALLEL_VAR_REDUC, OMP_FOR_VAR_INIT,
+ OMP_FOR_VAR_LAST, OMP_FOR_VAR_REDUC,
+ OMP_SECTIONS_VAR_INIT, OMP_SECTIONS_VAR_LAST,
+ OMP_SECTIONS_VAR_REDUC, OMP_CLAUSE_REDUCTION_CODE
+ OMP_SINGLE_CLAUSES, OMP_SINGLE_BODY,
+ OMP_CLAUSE_SCHEDULE_CHUNK_SIZE, OMP_SECTION_BODY,
+ OMP_CRITICAL_NAME, OMP_CRITICAL_BODY): New.
+ (TREE_RANGE_CHECK): New.
+ (empty_body_p): Declare.
+ (enum omp_clause_default_kind): New.
+ (build_string_literal): Declare.
+ (enum omp_clause_schedule_kind, OMP_CLAUSE_SCHEDULE_KIND): New.
+ (build5_stat, build5): Declare.
+ * tree-pass.h (TDF_CHAIN): Define.
+ * tree-pass.h (PROP_gimple_lomp): Define.
+ (pass_lower_omp): Declare.
+ * diagnostic.h (debug_tree_chain): Declare.
+ * builtins.c (get_builtin_sync_mode): Use 0 as last argument to
+ mode_for_size.
+ (expand_builtin): Handle sync BUILT_IN_*_16 builtins.
+ * builtins.c (build_string_literal): Make extern.
+ * gcc.c (include_spec_function): New.
+ (static_spec_functions): Add it.
+ (main): Move load of libgomp.spec ...
+ (LINK_COMMAND_SPEC): ... here.
+ (link_gomp_spec): New.
+ (static_specs): Include it.
+ (LINK_COMMAND_SPEC): Add link_gomp.
+ (GOMP_SELF_SPECS): New.
+ (driver_self_specs): Include it.
+ (switch_matches): Don't mark inline.
+ (main): Load libgomp.spec.
+ * tree-gimple.c (is_gimple_stmt): True for OMP_MASTER,
+ OMP_ORDERED, OMP_CRITICAL, OMP_SECTIONS, OMP_SECTION,
+ and OMP_SINGLE, OMP_FOR and OMP_PARALLEL.
+ * tree-gimple.h (enum omp_parallel): Declare.
+ (determine_parallel_type): Declare.
+ (omp_firstprivatize_variable): Declare.
+ (omp_reduction_init): Declare.
+ (diagnose_omp_structured_block_errors): Declare.
+ (struct walk_stmt_info): Add want_return_expr.
+ (struct walk_stmt_info): Add want_bind_expr, want_locations.
+ (find_omp_clause): Declare.
+ (insert_field_into_struct): Declare.
+ (struct walk_stmt_info): Move from tree-nested.c
+ (walk_stmts): Declare.
+ * c-cppbuiltin.c (c_cpp_builtins): If -fopenmp, #define _OPENMP
+ to 200505.
+ * cgraphunit.c (cgraph_lower_function): Make static.
+ (cgraph_finalize_pending_functions): New.
+ (cgraph_finalize_function): Call it.
+ (cgraph_finalize_compilation_unit): Likewise.
+ * builtin-types.def (BT_I16, BT_FN_I16_VPTR_I16,
+ BT_FN_BOOL_VPTR_I16_I16, BT_FN_I16_VPTR_I16_I16): Add.
+ (BT_FN_UINT_UINT): New.
+ (DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_7,
+ DEF_FUNCTION_TYPE_VAR_4): Document.
+ (BT_PTR_LONG, BT_PTR_PTR, BT_FN_BOOL, BT_FN_INT,
+ BT_FN_VOID_PTRPTR, BT_PTR_FN_VOID_PTR,
+ BT_FN_BOOL_LONGPTR_LONGPTR, BT_FN_VOID_OMPFN_PTR_UINT,
+ BT_FN_VOID_OMPFN_PTR_UINT_UINT,
+ BT_FN_BOOL_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG,
+ BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG): New.
+ * builtins.def: Update DEF_BUILTIN comment to include COND argument.
+ Move all DEF_SYNC_BUILTIN () and DEF_GOMP_BUILTIN () builtins
+ into separate files.
+ (DEF_GOMP_BUILTIN): New.
+ (BUILT_IN_OMP_GET_THREAD_NUM, BUILT_IN_GOMP_BARRIER,
+ BUILT_IN_GOMP_CRITICAL_START, BUILT_IN_GOMP_CRITICAL_END,
+ BUILT_IN_GOMP_CRITICAL_NAME_START, BUILT_IN_GOMP_CRITICAL_NAME_END,
+ BUILT_IN_GOMP_LOOP_STATIC_START, BUILT_IN_GOMP_LOOP_DYNAMIC_START,
+ BUILT_IN_GOMP_LOOP_GUIDED_START, BUILT_IN_GOMP_LOOP_RUNTIME_START,
+ BUILT_IN_GOMP_LOOP_ORDERED_STATIC_START,
+ BUILT_IN_GOMP_LOOP_ORDERED_DYNAMIC_START,
+ BUILT_IN_GOMP_LOOP_ORDERED_GUIDED_START,
+ BUILT_IN_GOMP_LOOP_ORDERED_RUNTIME_START,
+ BUILT_IN_GOMP_LOOP_STATIC_NEXT, BUILT_IN_GOMP_LOOP_DYNAMIC_NEXT,
+ BUILT_IN_GOMP_LOOP_GUIDED_NEXT, BUILT_IN_GOMP_LOOP_RUNTIME_NEXT,
+ BUILT_IN_GOMP_LOOP_ORDERED_STATIC_NEXT,
+ BUILT_IN_GOMP_LOOP_ORDERED_DYNAMIC_NEXT,
+ BUILT_IN_GOMP_LOOP_ORDERED_GUIDED_NEXT,
+ BUILT_IN_GOMP_LOOP_ORDERED_RUNTIME_NEXT,
+ BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START,
+ BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC_START,
+ BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED_START,
+ BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME_START,
+ BUILT_IN_GOMP_LOOP_END, BUILT_IN_GOMP_LOOP_END_NOWAIT,
+ BUILT_IN_GOMP_ORDERED_START, BUILT_IN_GOMP_ORDERED_END,
+ BUILT_IN_GOMP_PARALLEL_START, BUILT_IN_GOMP_PARALLEL_END,
+ BUILT_IN_GOMP_SECTIONS_START, BUILT_IN_GOMP_SECTIONS_NEXT,
+ BUILT_IN_GOMP_PARALLEL_SECTIONS_START, BUILT_IN_GOMP_SECTIONS_END,
+ BUILT_IN_GOMP_SECTIONS_END_NOWAIT, BUILT_IN_GOMP_SINGLE_START,
+ BUILT_IN_GOMP_SINGLE_COPY_START, BUILT_IN_GOMP_SINGLE_COPY_END): New.
+ * sync-builtins.def: New file, moved from builtins.def.
+ * omp-builtins.def: New file, moved from builtins.def.
+ * c-objc-common.h (LANG_HOOKS_OMP_PREDETERMINED_SHARING): Redefine.
+ * gimple-low.c (lower_function_body): Clear data.
+ (lower_stmt): Do not handle COMPOUND_EXPR.
+ Remove call to print_node_brief.
+ * c-tree.h (c_finish_omp_clauses): New prototype.
+ (C_DECL_THREADPRIVATE_P): Define.
+ (lookup_name_no_remap, c_omp_remap_private): Remove
+ (c_begin_omp_parallel, c_finish_omp_parallel): Update.
+ (check_for_loop_decls): Update decl.
+ (lookup_name_no_remap, c_omp_remap_private): Declare.
+ (build_indirect_ref, build_modify_expr, pushdecl,
+ pushdecl_top_level): Move to c-common.h.
+ * dwarf2out.c (loc_descriptor_from_tree_1): Don't set unsignedp
+ before the switch, but just in the 2 places that need it.
+ * c-decl.c (diagnose_mismatched_decls): Do not check for
+ mismatched thread-local attributes when OLDDECL is marked
+ threadprivate and NEWDECL has no thread-local attributes.
+ (merge_decls): Merge C_DECL_THREADPRIVATE_P.
+ (c_gimple_diagnostics_recursively): Rename from
+ c_warn_unused_result_recursively. Invoke
+ diagnose_omp_structured_block_errors.
+ (check_for_loop_decls): Return a singular decl found.
+ * langhooks.c (lhd_omp_predetermined_sharing): Return
+ OMP_CLAUSE_DEFAULT_SHARED for DECL_ARTIFICIAL decls.
+ (lhd_omp_firstprivatize_type_sizes): New.
+ (lhd_omp_assignment): New.
+ (lhd_omp_predetermined_sharing): New.
+ * langhooks.h (struct gimplify_omp_ctx): Forward declare.
+ (struct lang_hooks_for_types): Add
+ omp_firstprivatize_type_sizes, omp_privatize_by_reference,
+ omp_predetermined_sharing, omp_disregard_value_expr,
+ omp_private_debug_clause, omp_clause_default_ctor,
+ omp_clause_copy_ctor, omp_clause_assign_op, omp_clause_dtor.
+ (c_finish_omp_clauses): New.
+ (c_finish_bc_stmt): Diagnose break within omp for.
+ (c_begin_omp_parallel, c_finish_omp_parallel): New.
+ (build_unary_op): Return error_mark after reporting
+ a readonly_error.
+ (build_modify_expr): Likewise.
+ * gimplify.c: Include optabs.h and pointer-set.h.
+ (enum gimplify_omp_var_data): Declare.
+ (struct gimplify_omp_ctx): Declare.
+ (struct gimplify_ctx): Add fields prev_context, combined_pre_p
+ and combined_ctxp.
+ (gimplify_ctxp, gimplify_omp_ctxp): New local variables.
+ (push_gimplify_context, pop_gimplify_context): Allow nesting.
+ (splay_tree_compare_decl_uid): New.
+ (new_omp_context): New.
+ (delete_omp_context): New.
+ (gimple_add_tmp_var): Call omp_add_variable.
+ (gimplify_bind_expr): Likewise.
+ (gimplify_var_or_parm_decl): If omp_notice_variable returned
+ true, disregard DECL_VALUE_EXPR on the decl if any.
+ (gimplify_expr_in_ctx): New.
+ (omp_firstprivatize_variable, omp_firstprivatize_type_sizes
+ omp_add_variable, omp_notice_variable, omp_is_private
+ gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses_1
+ gimplify_adjust_omp_clauses, gimplify_omp_parallel
+ gimplify_omp_for, gimplify_omp_workshare, goa_lhs_expr_p
+ gimplify_omp_atomic_fetch_op, goa_stabilize_expr
+ gimplify_omp_atomic_pipeline, gimplify_omp_atomic_mutex
+ gimplify_omp_atomic): New.
+ (gimplify_expr): Handle OMP_PARALLEL, OMP_FOR, OMP_SECTIONS,
+ OMP_SINGLE, OMP_SECTION, OMP_MASTER, OMP_ORDERED,
+ OMP_CRITICAL and OMP_ATOMIC.
+ (gimplify_body): Verify gimplify_ctxp is empty after gimplification.
+ * c-pragma.h (enum pragma_kind): Add
+ PRAGMA_OMP_ATOMIC, PRAGMA_OMP_BARRIER,
+ PRAGMA_OMP_CRITICAL, PRAGMA_OMP_FLUSH, PRAGMA_OMP_FOR,
+ PRAGMA_OMP_MASTER, PRAGMA_OMP_ORDERED,
+ PRAGMA_OMP_PARALLEL, PRAGMA_OMP_PARALLEL_FOR,
+ PRAGMA_OMP_PARALLEL_SECTIONS, PRAGMA_OMP_SECTION,
+ PRAGMA_OMP_SECTIONS, PRAGMA_OMP_SINGLE,
+ PRAGMA_OMP_THREADPRIVATE.
+ * tree.def (OMP_PARALLEL, OMP_FOR, OMP_SECTIONS,
+ OMP_SINGLE, OMP_SECTION, OMP_MASTER, OMP_ORDERED,
+ OMP_CRITICAL, OMP_ATOMIC, OMP_CLAUSE_PRIVATE,
+ OMP_CLAUSE_SHARED, OMP_CLAUSE_FIRSTPRIVATE,
+ OMP_CLAUSE_LASTPRIVATE, OMP_CLAUSE_REDUCTION,
+ OMP_CLAUSE_COPYIN, OMP_CLAUSE_COPYPRIVATE,
+ OMP_CLAUSE_IF, OMP_CLAUSE_NUM_THREADS,
+ OMP_CLAUSE_SCHEDULE, OMP_CLAUSE_NOWAIT,
+ OMP_CLAUSE_ORDERED, OMP_CLAUSE_DEFAULT): Define.
+ * print-tree.c (print_node): Dump DECL_VALUE_EXPR.
+ * tree-ssa-dce.c (find_control_dependence): Do not assume that
+ ENTRY_BLOCK_PTR->next_bb == single_succ (ENTRY_BLOCK_PTR).
+ * tree-nested.c (convert_call_expr): Call walk_body on OMP_BODY for
+ OpenMP directives.
+ (struct nesting_info): Add field_map,
+ suppress_expansion, debug_var_chain.
+ (create_nesting_tree): Initialize them.
+ (lookup_field_for_decl): Use field_map.
+ (get_nonlocal_debug_decl, get_local_debug_decl): New.
+ (convert_local_omp_clauses): New.
+ (finalize_nesting_tree_1): Add debug_var_chain to toplevel block.
+ (walk_body): Split out of walk_function.
+ (convert_nonlocal_omp_clauses, convert_local_omp_clauses): New.
+ (convert_nonlocal_reference): Handle omp statements.
+ (convert_local_reference): Likewise.
+ (unnest_nesting_tree_1): Split out of finalize_nesting_tree_1.
+ (unnest_nesting_tree): New.
+ (lower_nested_functions): Call it.
+ (insert_field_into_struct): Make extern.
+ (struct walk_stmt_info): Move to tree-gimple.h.
+ (walk_stmts): Make extern.
+ * omp-builtins.def: New file.
+ * tree-iterator.c (expr_only): Clarify comment.
+ * c-common.h (pushdecl_top_level, pushdecl,
+ build_modify_expr, build_indirect_ref,
+ c_finish_omp_master, c_finish_omp_critical,
+ c_finish_omp_ordered, c_finish_omp_barrier,
+ c_finish_omp_atomic, c_finish_omp_flush,
+ c_finish_omp_for, c_split_parallel_clauses,
+ omp_clause_default_kind, c_omp_sharing_predetermined,
+ c_omp_remap_decl): Declare.
+ * Makefile.in (BUILTINS_DEF): Add omp-builtins.def.
+ (OBJS-common): Add omp-low.o.
+ (c-omp.o, omp-low.o): Add.
+ (gimplify.o): Add dependency on $(OPTABS_H).
+ (GTFILES): Add omp-low.c.
+ (gt-stringpool.h): Add.
+ * tree-cfg.c (set_bb_for_stmt): Do not update the
+ block-to-labels map if we are currently expanding to RTL.
+ (tree_node_can_be_shared): Remove unnecessary CONSTANT_CLASS_P
+ checks.
+ Handle IDENTIFIER_NODE.
+ (tree_verify_flow_info): Do not ICE when emitting error
+ messages about invalid labels.
+ (dump_function_to_file): Reset CFUN before emitting the body
+ of the function.
+ (debug_function): New.
+ * passes.c (init_optimization_passes): Schedule
+ pass_lower_omp.
+ * langhooks-def.h (lhd_omp_predetermined_sharing,
+ lhd_omp_assignment, lhd_omp_firstprivatize_type_sizes):
+ Declare.
+ (LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES): Define.
+ (LANG_HOOKS_FOR_TYPES_INITIALIZER): Use it.
+ (LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE,
+ LANG_HOOKS_OMP_PREDETERMINED_SHARING,
+ LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR,
+ LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE,
+ LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR,
+ LANG_HOOKS_OMP_CLAUSE_COPY_CTOR,
+ LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP,
+ LANG_HOOKS_OMP_CLAUSE_DTOR): Define.
+ (LANG_HOOK_DECLS): Use them.
+
+2006-01-18 Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
+ Richard Henderson <rth@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+ Diego Novillo <dnovillo@redhat.com>
+
+ * c-parser.c (pragma_omp_clause): Define.
+ (c_parser_declaration_or_fndef): Document OpenMP syntax.
+ (c_parser_compound_statement): Likewise.
+ (c_parser_statement): Likewise.
+ (c_parser_pragma): Handle omp pragmas.
+ (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK,
+ OMP_PARALLEL_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Define.
+ (c_parser_omp_clause_name, check_no_duplicate_clause,
+ c_parser_omp_variable_list,
+ c_parser_omp_var_list_parens, c_parser_omp_clause_copyin,
+ c_parser_omp_clause_copyprivate,
+ c_parser_omp_clause_default,
+ c_parser_omp_clause_firstprivate, c_parser_omp_clause_if,
+ c_parser_omp_clause_lastprivate,
+ c_parser_omp_clause_nowait,
+ c_parser_omp_clause_num_threads,
+ c_parser_omp_clause_ordered, c_parser_omp_clause_private,
+ c_parser_omp_clause_reduction,
+ c_parser_omp_clause_schedule, c_parser_omp_clause_shared,
+ c_parser_omp_all_clauses, c_parser_omp_structured_block,
+ c_parser_omp_atomic, c_parser_omp_barrier,
+ c_parser_omp_critical, c_parser_omp_flush,
+ c_parser_omp_for_loop, c_parser_omp_for,
+ c_parser_omp_master, c_parser_omp_ordered,
+ c_parser_omp_sections_scope, c_parser_omp_sections,
+ c_parser_omp_parallel, c_parser_omp_single,
+ c_parser_omp_construct, c_parser_omp_threadprivate): New.
+ * c-pragma.c (init_pragma): Do omp pragma registration here.
+ * c.opt (fopenmp): New flag.
+
+2006-01-18 Eric Christopher <echristo@apple.com>
+
+ * gcc.c (GOMP_SELF_SPECS): Bracket in #ifndef/#endif.
+ * config/darwin.h (GOMP_SELF_SPECS): Define.
+
2006-01-18 Kazu Hirata <kazu@codesourcery.com>
* rtl.h: Remove the prototype for reg_alloc.
input.h real.h statistics.h
RTL_H = $(RTL_BASE_H) genrtl.h
PARAMS_H = params.h params.def
-BUILTINS_DEF = builtins.def sync-builtins.def
+BUILTINS_DEF = builtins.def sync-builtins.def omp-builtins.def
TREE_H = tree.h tree.def $(MACHMODE_H) tree-check.h $(BUILTINS_DEF) \
input.h statistics.h vec.h treestruct.def
BASIC_BLOCK_H = basic-block.h bitmap.h sbitmap.h varray.h $(PARTITION_H) \
c-convert.o c-aux-info.o c-common.o c-opts.o c-format.o c-semantics.o \
c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o \
c-objc-common.o c-dump.o c-pch.o c-parser.o $(C_TARGET_OBJS) \
- c-gimplify.o tree-mudflap.o c-pretty-print.o
+ c-gimplify.o tree-mudflap.o c-pretty-print.o c-omp.o
# Language-specific object files for C.
C_OBJS = c-lang.o stub-objc.o $(C_AND_OBJC_OBJS)
tree-ssa-pre.o tree-ssa-live.o tree-ssa-operands.o tree-ssa-alias.o \
tree-ssa-phiopt.o tree-ssa-forwprop.o tree-nested.o tree-ssa-dse.o \
tree-ssa-dom.o domwalk.o tree-tailcall.o gimple-low.o tree-iterator.o \
- tree-phinodes.o tree-ssanames.o tree-sra.o tree-complex.o \
+ omp-low.o tree-phinodes.o tree-ssanames.o tree-sra.o tree-complex.o \
tree-vect-generic.o tree-ssa-loop.o tree-ssa-loop-niter.o \
tree-ssa-loop-manip.o tree-ssa-threadupdate.o \
tree-vectorizer.o tree-vect-analyze.o tree-vect-transform.o \
-DHOST_MACHINE=\"$(host)\" -DTARGET_MACHINE=\"$(target)\" \
$< $(OUTPUT_OPTION)
+c-omp.o : c-omp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
+ $(FUNCTION_H) $(C_COMMON_H) toplev.h $(TREE_GIMPLE_H)
+
# Language-independent files.
DRIVER_DEFINES = \
$(DIAGNOSTIC_H) $(TREE_GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H) langhooks.h \
$(LANGHOOKS_DEF_H) $(TREE_FLOW_H) $(CGRAPH_H) $(TIMEVAR_H) $(TM_H) \
coretypes.h except.h $(FLAGS_H) $(RTL_H) $(FUNCTION_H) $(EXPR_H) output.h \
- $(GGC_H) gt-gimplify.h $(HASHTAB_H) real.h $(TARGET_H) toplev.h
+ $(GGC_H) gt-gimplify.h $(HASHTAB_H) real.h $(TARGET_H) toplev.h $(OPTABS_H)
gimple-low.o : gimple-low.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
$(DIAGNOSTIC_H) $(TREE_GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H) langhooks.h \
$(LANGHOOKS_DEF_H) $(TREE_FLOW_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
except.h $(FLAGS_H) $(RTL_H) $(FUNCTION_H) $(EXPR_H) tree-pass.h \
$(HASHTAB_H) toplev.h
+omp-low.o : omp-low.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
+ $(RTL_H) $(TREE_GIMPLE_H) $(TREE_INLINE_H) langhooks.h $(DIAGNOSTIC_H) \
+ $(TREE_FLOW_H) $(TIMEVAR_H) $(FLAGS_H) $(EXPR_H) toplev.h tree-pass.h \
+ $(GGC_H)
tree-browser.o : tree-browser.c tree-browser.def $(CONFIG_H) $(SYSTEM_H) \
$(TREE_H) $(TREE_INLINE_H) $(DIAGNOSTIC_H) $(HASHTAB_H) \
$(TM_H) coretypes.h
$(srcdir)/tree-profile.c $(srcdir)/tree-nested.c \
$(srcdir)/ipa-reference.c $(srcdir)/tree-ssa-structalias.h \
$(srcdir)/tree-ssa-structalias.c \
- $(srcdir)/c-pragma.h \
+ $(srcdir)/c-pragma.h $(srcdir)/omp-low.c \
$(srcdir)/targhooks.c $(out_file) \
@all_gtfiles@
gt-tree-phinodes.h gt-tree-nested.h \
gt-tree-ssa-operands.h gt-tree-ssa-propagate.h \
gt-tree-ssa-structalias.h \
-gt-stringpool.h gt-targhooks.h : s-gtype ; @true
+gt-stringpool.h gt-targhooks.h gt-omp-low.h : s-gtype ; @true
define echo_quoted_to_gtyp
echo "\"$(gtyp)\", " >> tmp-gtyp.h
DEF_FUNCTION_TYPE_3 (ENUM, RETURN, ARG1, ARG2, ARG3)
DEF_FUNCTION_TYPE_4 (ENUM, RETURN, ARG1, ARG2, ARG3, ARG4)
DEF_FUNCTION_TYPE_5 (ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5)
+ DEF_FUNCTION_TYPE_6 (ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6)
+ DEF_FUNCTION_TYPE_7 (ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7)
These macros describe function types. ENUM is as above. The
RETURN type is one of the enumerals already defined. ARG1, ARG2,
DEF_FUNCTION_TYPE_VAR_2 (ENUM, RETURN, ARG1, ARG2)
DEF_FUNCTION_TYPE_VAR_3 (ENUM, RETURN, ARG1, ARG2, ARG3)
DEF_FUNCTION_TYPE_VAR_4 (ENUM, RETURN, ARG1, ARG2, ARG3, ARG4)
+ DEF_FUNCTION_TYPE_VAR_4 (ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5)
Similar, but for function types that take variable arguments.
For example:
DEF_PRIMITIVE_TYPE (BT_I16, builtin_type_for_size (BITS_PER_UNIT*16, 1))
DEF_POINTER_TYPE (BT_PTR_CONST_STRING, BT_CONST_STRING)
+DEF_POINTER_TYPE (BT_PTR_LONG, BT_LONG)
+DEF_POINTER_TYPE (BT_PTR_PTR, BT_PTR)
DEF_FUNCTION_TYPE_0 (BT_FN_VOID, BT_VOID)
+DEF_FUNCTION_TYPE_0 (BT_FN_BOOL, BT_BOOL)
DEF_FUNCTION_TYPE_0 (BT_FN_PTR, BT_PTR)
DEF_FUNCTION_TYPE_0 (BT_FN_PID, BT_PID)
+DEF_FUNCTION_TYPE_0 (BT_FN_INT, BT_INT)
DEF_FUNCTION_TYPE_0 (BT_FN_UINT, BT_UINT)
DEF_FUNCTION_TYPE_0 (BT_FN_FLOAT, BT_FLOAT)
DEF_FUNCTION_TYPE_0 (BT_FN_DOUBLE, BT_DOUBLE)
DEF_FUNCTION_TYPE_1 (BT_FN_DFLOAT64_DFLOAT64, BT_DFLOAT64, BT_DFLOAT64)
DEF_FUNCTION_TYPE_1 (BT_FN_DFLOAT128_DFLOAT128, BT_DFLOAT128, BT_DFLOAT128)
DEF_FUNCTION_TYPE_1 (BT_FN_VOID_VPTR, BT_VOID, BT_VOLATILE_PTR)
+DEF_FUNCTION_TYPE_1 (BT_FN_VOID_PTRPTR, BT_VOID, BT_PTR_PTR)
+DEF_FUNCTION_TYPE_1 (BT_FN_UINT_UINT, BT_UINT, BT_UINT)
+
+DEF_POINTER_TYPE (BT_PTR_FN_VOID_PTR, BT_FN_VOID_PTR)
DEF_FUNCTION_TYPE_2 (BT_FN_VOID_PTR_INT, BT_VOID, BT_PTR, BT_INT)
DEF_FUNCTION_TYPE_2 (BT_FN_STRING_STRING_CONST_STRING,
DEF_FUNCTION_TYPE_2 (BT_FN_I4_VPTR_I4, BT_I4, BT_VOLATILE_PTR, BT_I4)
DEF_FUNCTION_TYPE_2 (BT_FN_I8_VPTR_I8, BT_I8, BT_VOLATILE_PTR, BT_I8)
DEF_FUNCTION_TYPE_2 (BT_FN_I16_VPTR_I16, BT_I16, BT_VOLATILE_PTR, BT_I16)
+DEF_FUNCTION_TYPE_2 (BT_FN_BOOL_LONGPTR_LONGPTR,
+ BT_BOOL, BT_PTR_LONG, BT_PTR_LONG)
DEF_FUNCTION_TYPE_3 (BT_FN_STRING_STRING_CONST_STRING_SIZE,
BT_STRING, BT_STRING, BT_CONST_STRING, BT_SIZE)
DEF_FUNCTION_TYPE_3 (BT_FN_I8_VPTR_I8_I8, BT_I8, BT_VOLATILE_PTR, BT_I8, BT_I8)
DEF_FUNCTION_TYPE_3 (BT_FN_I16_VPTR_I16_I16, BT_I16, BT_VOLATILE_PTR,
BT_I16, BT_I16)
+DEF_FUNCTION_TYPE_3 (BT_FN_VOID_OMPFN_PTR_UINT, BT_VOID, BT_PTR_FN_VOID_PTR,
+ BT_PTR, BT_UINT)
DEF_FUNCTION_TYPE_4 (BT_FN_SIZE_CONST_PTR_SIZE_SIZE_FILEPTR,
BT_SIZE, BT_CONST_PTR, BT_SIZE, BT_SIZE, BT_FILEPTR)
BT_STRING, BT_STRING, BT_CONST_STRING, BT_SIZE, BT_SIZE)
DEF_FUNCTION_TYPE_4 (BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG,
BT_INT, BT_FILEPTR, BT_INT, BT_CONST_STRING, BT_VALIST_ARG)
+DEF_FUNCTION_TYPE_4 (BT_FN_VOID_OMPFN_PTR_UINT_UINT,
+ BT_VOID, BT_PTR_FN_VOID_PTR, BT_PTR, BT_UINT, BT_UINT)
DEF_FUNCTION_TYPE_5 (BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG,
BT_INT, BT_STRING, BT_INT, BT_SIZE, BT_CONST_STRING,
BT_VALIST_ARG)
+DEF_FUNCTION_TYPE_5 (BT_FN_BOOL_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ BT_BOOL, BT_LONG, BT_LONG, BT_LONG,
+ BT_PTR_LONG, BT_PTR_LONG)
DEF_FUNCTION_TYPE_6 (BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG,
BT_INT, BT_STRING, BT_SIZE, BT_INT, BT_SIZE,
BT_CONST_STRING, BT_VALIST_ARG)
+DEF_FUNCTION_TYPE_6 (BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ BT_BOOL, BT_LONG, BT_LONG, BT_LONG, BT_LONG,
+ BT_PTR_LONG, BT_PTR_LONG)
+DEF_FUNCTION_TYPE_6 (BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG,
+ BT_VOID, BT_PTR_FN_VOID_PTR, BT_PTR, BT_UINT,
+ BT_LONG, BT_LONG, BT_LONG)
+
+DEF_FUNCTION_TYPE_7 (BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG,
+ BT_VOID, BT_PTR_FN_VOID_PTR, BT_PTR, BT_UINT,
+ BT_LONG, BT_LONG, BT_LONG, BT_LONG)
DEF_FUNCTION_TYPE_VAR_0 (BT_FN_VOID_VAR, BT_VOID)
DEF_FUNCTION_TYPE_VAR_0 (BT_FN_INT_VAR, BT_INT)
DEF_POINTER_TYPE (BT_PTR_FN_VOID_VAR, BT_FN_VOID_VAR)
DEF_FUNCTION_TYPE_3 (BT_FN_PTR_PTR_FN_VOID_VAR_PTR_SIZE,
BT_PTR, BT_PTR_FN_VOID_VAR, BT_PTR, BT_SIZE)
+
static rtx c_readstr (const char *, enum machine_mode);
static int target_char_cast (tree, char *);
static rtx get_memory_rtx (tree, tree);
-static tree build_string_literal (int, const char *);
static int apply_args_size (void);
static int apply_result_size (void);
#if defined (HAVE_untyped_call) || defined (HAVE_untyped_return)
/* Create a new constant string literal and return a char* pointer to it.
The STRING_CST value is the LEN characters at STR. */
-static tree
+tree
build_string_literal (int len, const char *str)
{
tree t, elem, index, type;
/* Before including this file, you should define a macro:
DEF_BUILTIN (ENUM, NAME, CLASS, TYPE, LIBTYPE, BOTH_P,
- FALLBACK_P, NONANSI_P, ATTRS, IMPLICIT)
+ FALLBACK_P, NONANSI_P, ATTRS, IMPLICIT, COND)
This macro will be called once for each builtin function. The
ENUM will be of type `enum built_in_function', and will indicate
define it's meaning. When user uses floorf we may assume that the
floorf has the meaning we expect, but we can't produce floorf by
simplifying floor((double)float) since the runtime need not implement
- it. */
-
+ it.
+
+ The builtins is registered only if COND is true. */
+
/* A GCC builtin (like __builtin_saveregs) is provided by the
compiler, but does not correspond to a function in the standard
library. */
DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, 0, 0, false, false, \
false, 0, false, false)
+/* Builtin used by the implementation of GNU OpenMP. None of these are
+ actually implemented in the compiler; they're all in libgomp. */
+#undef DEF_GOMP_BUILTIN
+#define DEF_GOMP_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
+ DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
+ false, true, true, ATTRS, false, flag_openmp)
+
/* Define an attribute list for math functions that are normally
"impure" because some of them may write into global memory for
`errno'. If !flag_errno_math they are instead "const". */
/* Synchronization Primitives. */
#include "sync-builtins.def"
+
+/* OpenMP builtins. */
+#include "omp-builtins.def"
extern tree pop_stmt_list (tree);
extern tree add_stmt (tree);
extern void push_cleanup (tree, tree, bool);
+extern tree pushdecl_top_level (tree);
+extern tree pushdecl (tree);
+extern tree build_modify_expr (tree, enum tree_code, tree);
+extern tree build_indirect_ref (tree, const char *);
extern int c_expand_decl (tree);
extern void pp_dir_change (cpp_reader *, const char *);
extern bool check_missing_format_attribute (tree, tree);
+/* In c-omp.c */
+extern tree c_finish_omp_master (tree);
+extern tree c_finish_omp_critical (tree, tree);
+extern tree c_finish_omp_ordered (tree);
+extern void c_finish_omp_barrier (void);
+extern void c_finish_omp_atomic (enum tree_code, tree, tree);
+extern void c_finish_omp_flush (void);
+extern tree c_finish_omp_for (location_t, tree, tree, tree, tree, tree, tree);
+extern void c_split_parallel_clauses (tree, tree *, tree *);
+extern enum omp_clause_default_kind c_omp_predetermined_sharing (tree);
+
+/* Not in c-omp.c; provided by the front end. */
+extern bool c_omp_sharing_predetermined (tree);
+extern tree c_omp_remap_decl (tree, bool);
+
/* In order for the format checking to accept the C frontend
diagnostic framework extensions, you must include this file before
toplev.h, not after. The C front end formats are a subset of those
else if (flag_stack_protect == 1)
cpp_define (pfile, "__SSP__=1");
+ if (flag_openmp)
+ cpp_define (pfile, "_OPENMP=200505");
+
/* A straightforward target hook doesn't work, because of problems
linking that hook's body when part of non-C front ends. */
# define preprocessing_asm_p() (cpp_get_options (pfile)->lang == CLK_ASM)
{
/* Only variables can be thread-local, and all declarations must
agree on this property. */
- if (DECL_THREAD_LOCAL_P (newdecl) != DECL_THREAD_LOCAL_P (olddecl))
+ if (C_DECL_THREADPRIVATE_P (olddecl) && !DECL_THREAD_LOCAL_P (newdecl))
+ {
+ /* Nothing to check. Since OLDDECL is marked threadprivate
+ and NEWDECL does not have a thread-local attribute, we
+ will merge the threadprivate attribute into NEWDECL. */
+ ;
+ }
+ else if (DECL_THREAD_LOCAL_P (newdecl) != DECL_THREAD_LOCAL_P (olddecl))
{
if (DECL_THREAD_LOCAL_P (newdecl))
error ("thread-local declaration of %q+D follows "
if (DECL_INITIAL (newdecl) == 0)
DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
+ /* Merge the threadprivate attribute. */
+ if (TREE_CODE (olddecl) == VAR_DECL && C_DECL_THREADPRIVATE_P (olddecl))
+ {
+ DECL_TLS_MODEL (newdecl) = DECL_TLS_MODEL (olddecl);
+ C_DECL_THREADPRIVATE_P (newdecl) = 1;
+ }
+
if (CODE_CONTAINS_STRUCT (TREE_CODE (olddecl), TS_DECL_WITH_VIS))
{
/* Merge the unused-warning information. */
cfun->x_dont_save_pending_sizes_p = 1;
}
\f
-/* Handle attribute((warn_unused_result)) on FNDECL and all its nested
- functions. */
+/* Emit diagnostics that require gimple input for detection. Operate on
+ FNDECL and all its nested functions. */
static void
-c_warn_unused_result_recursively (tree fndecl)
+c_gimple_diagnostics_recursively (tree fndecl)
{
struct cgraph_node *cgn;
/* Handle attribute((warn_unused_result)). Relies on gimple input. */
c_warn_unused_result (&DECL_SAVED_TREE (fndecl));
+ /* Notice when OpenMP structured block constraints are violated. */
+ if (flag_openmp)
+ diagnose_omp_structured_block_errors (fndecl);
+
/* Finalize all nested functions now. */
cgn = cgraph_node (fndecl);
for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested)
- c_warn_unused_result_recursively (cgn->decl);
+ c_gimple_diagnostics_recursively (cgn->decl);
}
/* Finish up a function declaration and compile that function
if (!decl_function_context (fndecl))
{
c_genericize (fndecl);
- c_warn_unused_result_recursively (fndecl);
+ c_gimple_diagnostics_recursively (fndecl);
/* ??? Objc emits functions after finalizing the compilation unit.
This should be cleaned up later and this conditional removed. */
}
\f
/* Check the declarations given in a for-loop for satisfying the C99
- constraints. */
-void
+ constraints. If exactly one such decl is found, return it. */
+
+tree
check_for_loop_decls (void)
{
struct c_binding *b;
+ tree one_decl = NULL_TREE;
+ int n_decls = 0;
+
if (!flag_isoc99)
{
the C99 for loop scope. This doesn't make much sense, so don't
allow it. */
error ("%<for%> loop initial declaration used outside C99 mode");
- return;
+ return NULL_TREE;
}
/* C99 subclause 6.8.5 paragraph 3:
error ("declaration of non-variable %q+D in %<for%> loop "
"initial declaration", decl);
}
+
+ n_decls++;
+ one_decl = decl;
}
+
+ return n_decls == 1 ? one_decl : NULL_TREE;
}
\f
/* Save and reinitialize the variables
#undef LANG_HOOKS_GIMPLIFY_EXPR
#define LANG_HOOKS_GIMPLIFY_EXPR c_gimplify_expr
+#undef LANG_HOOKS_OMP_PREDETERMINED_SHARING
+#define LANG_HOOKS_OMP_PREDETERMINED_SHARING c_omp_predetermined_sharing
+
#endif /* GCC_C_OBJC_COMMON */
--- /dev/null
+/* This file contains routines to construct GNU OpenMP constructs,
+ called from parsing in the C and C++ front ends.
+
+ Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>,
+ Diego Novillo <dnovillo@redhat.com>.
+
+This file is part of GCC.
+
+GCC 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 2, or (at your option) any later
+version.
+
+GCC 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 COPYING. If not, write to the Free
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "function.h"
+#include "c-common.h"
+#include "toplev.h"
+#include "tree-gimple.h"
+#include "bitmap.h"
+#include "langhooks.h"
+
+
+/* Complete a #pragma omp master construct. STMT is the structured-block
+ that follows the pragma. */
+
+tree
+c_finish_omp_master (tree stmt)
+{
+ return add_stmt (build1 (OMP_MASTER, void_type_node, stmt));
+}
+
+/* Complete a #pragma omp critical construct. STMT is the structured-block
+ that follows the pragma, NAME is the identifier in the pragma, or null
+ if it was omitted. */
+
+tree
+c_finish_omp_critical (tree body, tree name)
+{
+ tree stmt = make_node (OMP_CRITICAL);
+ TREE_TYPE (stmt) = void_type_node;
+ OMP_CRITICAL_BODY (stmt) = body;
+ OMP_CRITICAL_NAME (stmt) = name;
+ return add_stmt (stmt);
+}
+
+/* Complete a #pragma omp ordered construct. STMT is the structured-block
+ that follows the pragma. */
+
+tree
+c_finish_omp_ordered (tree stmt)
+{
+ return add_stmt (build1 (OMP_ORDERED, void_type_node, stmt));
+}
+
+
+/* Complete a #pragma omp barrier construct. */
+
+void
+c_finish_omp_barrier (void)
+{
+ tree x;
+
+ x = built_in_decls[BUILT_IN_GOMP_BARRIER];
+ x = build_function_call_expr (x, NULL);
+ add_stmt (x);
+}
+
+
+/* Complete a #pragma omp atomic construct. The expression to be
+ implemented atomically is LHS code= RHS. */
+
+void
+c_finish_omp_atomic (enum tree_code code, tree lhs, tree rhs)
+{
+ tree x, type, addr;
+
+ if (lhs == error_mark_node || rhs == error_mark_node)
+ return;
+
+ /* ??? According to one reading of the OpenMP spec, complex type are
+ supported, but there are no atomic stores for any architecture.
+ But at least icc 9.0 doesn't support complex types here either.
+ And lets not even talk about vector types... */
+ type = TREE_TYPE (lhs);
+ if (!INTEGRAL_TYPE_P (type)
+ && !POINTER_TYPE_P (type)
+ && !SCALAR_FLOAT_TYPE_P (type))
+ {
+ error ("invalid expression type for %<#pragma omp atomic%>");
+ return;
+ }
+
+ /* ??? Validate that rhs does not overlap lhs. */
+
+ /* Take and save the address of the lhs. From then on we'll reference it
+ via indirection. */
+ addr = build_unary_op (ADDR_EXPR, lhs, 0);
+ if (addr == error_mark_node)
+ return;
+ addr = save_expr (addr);
+ lhs = build_indirect_ref (addr, NULL);
+
+ /* There are lots of warnings, errors, and conversions that need to happen
+ in the course of interpreting a statement. Use the normal mechanisms
+ to do this, and then take it apart again. */
+ x = build_modify_expr (lhs, code, rhs);
+ if (x == error_mark_node)
+ return;
+ gcc_assert (TREE_CODE (x) == MODIFY_EXPR);
+ rhs = TREE_OPERAND (x, 1);
+
+ /* Punt the actual generation of atomic operations to common code. */
+ add_stmt (build2 (OMP_ATOMIC, void_type_node, addr, rhs));
+}
+
+
+/* Complete a #pragma omp flush construct. We don't do anything with the
+ variable list that the syntax allows. */
+
+void
+c_finish_omp_flush (void)
+{
+ tree x;
+
+ x = built_in_decls[BUILT_IN_SYNCHRONIZE];
+ x = build_function_call_expr (x, NULL);
+ add_stmt (x);
+}
+
+
+/* Check and canonicalize #pragma omp for increment expression.
+ Helper function for c_finish_omp_for. */
+
+static tree
+check_omp_for_incr_expr (tree exp, tree decl)
+{
+ tree t;
+
+ if (!INTEGRAL_TYPE_P (TREE_TYPE (exp))
+ || TYPE_PRECISION (TREE_TYPE (exp)) < TYPE_PRECISION (TREE_TYPE (decl)))
+ return error_mark_node;
+
+ if (exp == decl)
+ return build_int_cst (TREE_TYPE (exp), 0);
+
+ switch (TREE_CODE (exp))
+ {
+ case NOP_EXPR:
+ t = check_omp_for_incr_expr (TREE_OPERAND (exp, 0), decl);
+ if (t != error_mark_node)
+ return fold_convert (TREE_TYPE (exp), t);
+ break;
+ case MINUS_EXPR:
+ t = check_omp_for_incr_expr (TREE_OPERAND (exp, 0), decl);
+ if (t != error_mark_node)
+ return fold_build2 (MINUS_EXPR, TREE_TYPE (exp), t, TREE_OPERAND (exp, 1));
+ break;
+ case PLUS_EXPR:
+ t = check_omp_for_incr_expr (TREE_OPERAND (exp, 0), decl);
+ if (t != error_mark_node)
+ return fold_build2 (PLUS_EXPR, TREE_TYPE (exp), t, TREE_OPERAND (exp, 1));
+ t = check_omp_for_incr_expr (TREE_OPERAND (exp, 1), decl);
+ if (t != error_mark_node)
+ return fold_build2 (PLUS_EXPR, TREE_TYPE (exp), TREE_OPERAND (exp, 0), t);
+ break;
+ default:
+ break;
+ }
+
+ return error_mark_node;
+}
+
+/* Validate and emit code for the OpenMP directive #pragma omp for.
+ INIT, COND, INCR, BODY and PRE_BODY are the five basic elements
+ of the loop (initialization expression, controlling predicate, increment
+ expression, body of the loop and statements to go before the loop).
+ DECL is the iteration variable. */
+
+tree
+c_finish_omp_for (location_t locus, tree decl, tree init, tree cond,
+ tree incr, tree body, tree pre_body)
+{
+ location_t elocus = locus;
+ bool fail = false;
+
+ if (EXPR_HAS_LOCATION (init))
+ elocus = EXPR_LOCATION (init);
+
+ /* Validate the iteration variable. */
+ if (!INTEGRAL_TYPE_P (TREE_TYPE (decl)))
+ {
+ error ("%Hinvalid type for iteration variable %qE", &elocus, decl);
+ fail = true;
+ }
+ if (TYPE_UNSIGNED (TREE_TYPE (decl)))
+ warning (0, "%Hiteration variable %qE is unsigned", &elocus, decl);
+
+ /* In the case of "for (int i = 0...)", init will be a decl. It should
+ have a DECL_INITIAL that we can turn into an assignment. */
+ if (init == decl)
+ {
+ elocus = DECL_SOURCE_LOCATION (decl);
+
+ init = DECL_INITIAL (decl);
+ if (init == NULL)
+ {
+ error ("%H%qE is not initialized", &elocus, decl);
+ init = integer_zero_node;
+ fail = true;
+ }
+
+ init = build_modify_expr (decl, NOP_EXPR, init);
+ SET_EXPR_LOCATION (init, elocus);
+ }
+ gcc_assert (TREE_CODE (init) == MODIFY_EXPR);
+ gcc_assert (TREE_OPERAND (init, 0) == decl);
+
+ if (cond == NULL_TREE)
+ {
+ error ("%Hmissing controlling predicate", &elocus);
+ fail = true;
+ }
+ else
+ {
+ bool cond_ok = false;
+
+ if (EXPR_HAS_LOCATION (cond))
+ elocus = EXPR_LOCATION (cond);
+
+ if (TREE_CODE (cond) == LT_EXPR
+ || TREE_CODE (cond) == LE_EXPR
+ || TREE_CODE (cond) == GT_EXPR
+ || TREE_CODE (cond) == GE_EXPR)
+ {
+ tree op0 = TREE_OPERAND (cond, 0);
+ tree op1 = TREE_OPERAND (cond, 1);
+
+ /* 2.5.1. The comparison in the condition is computed in the type
+ of DECL, otherwise the behavior is undefined.
+
+ For example:
+ long n; int i;
+ i < n;
+
+ according to ISO will be evaluated as:
+ (long)i < n;
+
+ We want to force:
+ i < (int)n; */
+ if (TREE_CODE (op0) == NOP_EXPR
+ && decl == TREE_OPERAND (op0, 0))
+ {
+ TREE_OPERAND (cond, 0) = TREE_OPERAND (op0, 0);
+ TREE_OPERAND (cond, 1) = fold_build1 (NOP_EXPR, TREE_TYPE (decl),
+ TREE_OPERAND (cond, 1));
+ }
+ else if (TREE_CODE (op1) == NOP_EXPR
+ && decl == TREE_OPERAND (op1, 0))
+ {
+ TREE_OPERAND (cond, 1) = TREE_OPERAND (op1, 0);
+ TREE_OPERAND (cond, 0) = fold_build1 (NOP_EXPR, TREE_TYPE (decl),
+ TREE_OPERAND (cond, 0));
+ }
+
+ if (decl == TREE_OPERAND (cond, 0))
+ cond_ok = true;
+ else if (decl == TREE_OPERAND (cond, 1))
+ {
+ TREE_SET_CODE (cond, swap_tree_comparison (TREE_CODE (cond)));
+ TREE_OPERAND (cond, 1) = TREE_OPERAND (cond, 0);
+ TREE_OPERAND (cond, 0) = decl;
+ cond_ok = true;
+ }
+ }
+
+ if (!cond_ok)
+ {
+ error ("%Hinvalid controlling predicate", &elocus);
+ fail = true;
+ }
+ }
+
+ if (incr == NULL_TREE)
+ {
+ error ("%Hmissing increment expression", &elocus);
+ fail = true;
+ }
+ else
+ {
+ bool incr_ok = false;
+
+ if (EXPR_HAS_LOCATION (incr))
+ elocus = EXPR_LOCATION (incr);
+
+ /* Check all the valid increment expressions: v++, v--, ++v, --v,
+ v = v + incr, v = incr + v and v = v - incr. */
+ switch (TREE_CODE (incr))
+ {
+ case POSTINCREMENT_EXPR:
+ case PREINCREMENT_EXPR:
+ case POSTDECREMENT_EXPR:
+ case PREDECREMENT_EXPR:
+ incr_ok = (TREE_OPERAND (incr, 0) == decl);
+ break;
+
+ case MODIFY_EXPR:
+ if (TREE_OPERAND (incr, 0) != decl)
+ break;
+ if (TREE_OPERAND (incr, 1) == decl)
+ break;
+ if (TREE_CODE (TREE_OPERAND (incr, 1)) == PLUS_EXPR
+ && (TREE_OPERAND (TREE_OPERAND (incr, 1), 0) == decl
+ || TREE_OPERAND (TREE_OPERAND (incr, 1), 1) == decl))
+ incr_ok = true;
+ else if (TREE_CODE (TREE_OPERAND (incr, 1)) == MINUS_EXPR
+ && TREE_OPERAND (TREE_OPERAND (incr, 1), 0) == decl)
+ incr_ok = true;
+ else
+ {
+ tree t = check_omp_for_incr_expr (TREE_OPERAND (incr, 1), decl);
+ if (t != error_mark_node)
+ {
+ incr_ok = true;
+ t = build2 (PLUS_EXPR, TREE_TYPE (decl), decl, t);
+ incr = build2 (MODIFY_EXPR, void_type_node, decl, t);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ if (!incr_ok)
+ {
+ error ("%Hinvalid increment expression", &elocus);
+ fail = true;
+ }
+ }
+
+ if (fail)
+ return NULL;
+ else
+ {
+ tree t = make_node (OMP_FOR);
+
+ TREE_TYPE (t) = void_type_node;
+ OMP_FOR_INIT (t) = init;
+ OMP_FOR_COND (t) = cond;
+ OMP_FOR_INCR (t) = incr;
+ OMP_FOR_BODY (t) = body;
+ OMP_FOR_PRE_BODY (t) = pre_body;
+
+ SET_EXPR_LOCATION (t, locus);
+ return add_stmt (t);
+ }
+}
+
+
+/* Divide CLAUSES into two lists: those that apply to a parallel construct,
+ and those that apply to a work-sharing construct. Place the results in
+ *PAR_CLAUSES and *WS_CLAUSES respectively. In addition, add a nowait
+ clause to the work-sharing list. */
+
+void
+c_split_parallel_clauses (tree clauses, tree *par_clauses, tree *ws_clauses)
+{
+ tree next;
+
+ *par_clauses = NULL;
+ *ws_clauses = make_node (OMP_CLAUSE_NOWAIT);
+
+ for (; clauses ; clauses = next)
+ {
+ next = OMP_CLAUSE_CHAIN (clauses);
+
+ switch (TREE_CODE (clauses))
+ {
+ case OMP_CLAUSE_PRIVATE:
+ case OMP_CLAUSE_SHARED:
+ case OMP_CLAUSE_FIRSTPRIVATE:
+ case OMP_CLAUSE_LASTPRIVATE:
+ case OMP_CLAUSE_REDUCTION:
+ case OMP_CLAUSE_COPYIN:
+ case OMP_CLAUSE_IF:
+ case OMP_CLAUSE_NUM_THREADS:
+ case OMP_CLAUSE_DEFAULT:
+ OMP_CLAUSE_CHAIN (clauses) = *par_clauses;
+ *par_clauses = clauses;
+ break;
+
+ case OMP_CLAUSE_SCHEDULE:
+ case OMP_CLAUSE_ORDERED:
+ OMP_CLAUSE_CHAIN (clauses) = *ws_clauses;
+ *ws_clauses = clauses;
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+ }
+}
+
+/* True if OpenMP sharing attribute of DECL is predetermined. */
+
+enum omp_clause_default_kind
+c_omp_predetermined_sharing (tree decl)
+{
+ /* Variables with const-qualified type having no mutable member
+ are predetermined shared. */
+ if (TREE_READONLY (decl))
+ return OMP_CLAUSE_DEFAULT_SHARED;
+
+ return OMP_CLAUSE_DEFAULT_UNSPECIFIED;
+}
};
#define N_reswords (sizeof reswords / sizeof (struct resword))
+/* All OpenMP clauses. OpenMP 2.5. */
+typedef enum pragma_omp_clause {
+ PRAGMA_OMP_CLAUSE_NONE = 0,
+
+ PRAGMA_OMP_CLAUSE_COPYIN,
+ PRAGMA_OMP_CLAUSE_COPYPRIVATE,
+ PRAGMA_OMP_CLAUSE_DEFAULT,
+ PRAGMA_OMP_CLAUSE_FIRSTPRIVATE,
+ PRAGMA_OMP_CLAUSE_IF,
+ PRAGMA_OMP_CLAUSE_LASTPRIVATE,
+ PRAGMA_OMP_CLAUSE_NOWAIT,
+ PRAGMA_OMP_CLAUSE_NUM_THREADS,
+ PRAGMA_OMP_CLAUSE_ORDERED,
+ PRAGMA_OMP_CLAUSE_PRIVATE,
+ PRAGMA_OMP_CLAUSE_REDUCTION,
+ PRAGMA_OMP_CLAUSE_SCHEDULE,
+ PRAGMA_OMP_CLAUSE_SHARED
+} pragma_omp_clause;
+
+
/* Initialization routine for this file. */
void
static struct c_expr c_parser_expression (c_parser *);
static struct c_expr c_parser_expression_conv (c_parser *);
static tree c_parser_expr_list (c_parser *, bool);
+static void c_parser_omp_construct (c_parser *);
+static void c_parser_omp_threadprivate (c_parser *);
+static void c_parser_omp_barrier (c_parser *);
+static void c_parser_omp_flush (c_parser *);
enum pragma_context { pragma_external, pragma_stmt, pragma_compound };
static bool c_parser_pragma (c_parser *, enum pragma_context);
absence is diagnosed through the diagnosis of implicit int. In GNU
C we also allow but diagnose declarations without declaration
specifiers, but only at top level (elsewhere they conflict with
- other syntax). */
+ other syntax).
+
+ OpenMP:
+
+ declaration:
+ threadprivate-directive */
static void
c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, bool empty_ok,
prefix attributes on the declaration. ??? The syntax follows the
old parser in requiring something after label declarations.
Although they are erroneous if the labels declared aren't defined,
- is it useful for the syntax to be this way? */
+ is it useful for the syntax to be this way?
+
+ OpenMP:
+
+ block-item:
+ openmp-directive
+
+ openmp-directive:
+ barrier-directive
+ flush-directive */
static tree
c_parser_compound_statement (c_parser *parser)
objc-throw-statement:
@throw expression ;
@throw ;
-*/
+
+ OpenMP:
+
+ statement:
+ openmp-construct
+
+ openmp-construct:
+ parallel-construct
+ for-construct
+ sections-construct
+ single-construct
+ parallel-for-construct
+ parallel-sections-construct
+ master-construct
+ critical-construct
+ atomic-construct
+ ordered-construct
+
+ parallel-construct:
+ parallel-directive structured-block
+
+ for-construct:
+ for-directive iteration-statement
+
+ sections-construct:
+ sections-directive section-scope
+
+ single-construct:
+ single-directive structured-block
+
+ parallel-for-construct:
+ parallel-for-directive iteration-statement
+
+ parallel-sections-construct:
+ parallel-sections-directive section-scope
+
+ master-construct:
+ master-directive structured-block
+
+ critical-construct:
+ critical-directive structured-block
+
+ atomic-construct:
+ atomic-directive expression-statement
+
+ ordered-construct:
+ ordered-directive structured-block */
static void
c_parser_statement (c_parser *parser)
}
\f
-/* Handle pragmas. ALLOW_STMT is true if we're within the context of
- a function and such pragmas are to be allowed. Returns true if we
- actually parsed such a pragma. */
+/* Handle pragmas. Some OpenMP pragmas are associated with, and therefore
+ should be considered, statements. ALLOW_STMT is true if we're within
+ the context of a function and such pragmas are to be allowed. Returns
+ true if we actually parsed such a pragma. */
static bool
-c_parser_pragma (c_parser *parser, enum pragma_context context ATTRIBUTE_UNUSED)
+c_parser_pragma (c_parser *parser, enum pragma_context context)
{
unsigned int id;
switch (id)
{
+ case PRAGMA_OMP_BARRIER:
+ if (context != pragma_compound)
+ {
+ if (context == pragma_stmt)
+ c_parser_error (parser, "%<#pragma omp barrier%> may only be "
+ "used in compound statements");
+ goto bad_stmt;
+ }
+ c_parser_omp_barrier (parser);
+ return false;
+
+ case PRAGMA_OMP_FLUSH:
+ if (context != pragma_compound)
+ {
+ if (context == pragma_stmt)
+ c_parser_error (parser, "%<#pragma omp flush%> may only be "
+ "used in compound statements");
+ goto bad_stmt;
+ }
+ c_parser_omp_flush (parser);
+ return false;
+
+ case PRAGMA_OMP_THREADPRIVATE:
+ c_parser_omp_threadprivate (parser);
+ return false;
+
+ case PRAGMA_OMP_SECTION:
+ error ("%<#pragma omp section%> may only be used in "
+ "%<#pragma omp sections%> construct");
+ c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NULL);
+ return false;
+
case PRAGMA_GCC_PCH_PREPROCESS:
c_parser_error (parser, "%<#pragma GCC pch_preprocess%> must be first");
c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NULL);
return false;
default:
- gcc_assert (id >= PRAGMA_FIRST_EXTERNAL);
+ if (id < PRAGMA_FIRST_EXTERNAL)
+ {
+ if (context == pragma_external)
+ {
+ bad_stmt:
+ c_parser_error (parser, "expected declaration specifiers");
+ c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NULL);
+ return false;
+ }
+ c_parser_omp_construct (parser);
+ return true;
+ }
break;
}
c_common_pch_pragma (parse_in, TREE_STRING_POINTER (name));
}
\f
+/* OpenMP 2.5 parsing routines. */
+
+/* Returns name of the next clause.
+ If the clause is not recognized PRAGMA_OMP_CLAUSE_NONE is returned and
+ the token is not consumed. Otherwise appropriate pragma_omp_clause is
+ returned and the token is consumed. */
+
+static pragma_omp_clause
+c_parser_omp_clause_name (c_parser *parser)
+{
+ pragma_omp_clause result = PRAGMA_OMP_CLAUSE_NONE;
+
+ if (c_parser_next_token_is_keyword (parser, RID_IF))
+ result = PRAGMA_OMP_CLAUSE_IF;
+ else if (c_parser_next_token_is_keyword (parser, RID_DEFAULT))
+ result = PRAGMA_OMP_CLAUSE_DEFAULT;
+ else if (c_parser_next_token_is (parser, CPP_NAME))
+ {
+ const char *p = IDENTIFIER_POINTER (c_parser_peek_token (parser)->value);
+
+ switch (p[0])
+ {
+ case 'c':
+ if (!strcmp ("copyin", p))
+ result = PRAGMA_OMP_CLAUSE_COPYIN;
+ else if (!strcmp ("copyprivate", p))
+ result = PRAGMA_OMP_CLAUSE_COPYPRIVATE;
+ break;
+ case 'f':
+ if (!strcmp ("firstprivate", p))
+ result = PRAGMA_OMP_CLAUSE_FIRSTPRIVATE;
+ break;
+ case 'l':
+ if (!strcmp ("lastprivate", p))
+ result = PRAGMA_OMP_CLAUSE_LASTPRIVATE;
+ break;
+ case 'n':
+ if (!strcmp ("nowait", p))
+ result = PRAGMA_OMP_CLAUSE_NOWAIT;
+ else if (!strcmp ("num_threads", p))
+ result = PRAGMA_OMP_CLAUSE_NUM_THREADS;
+ break;
+ case 'o':
+ if (!strcmp ("ordered", p))
+ result = PRAGMA_OMP_CLAUSE_ORDERED;
+ break;
+ case 'p':
+ if (!strcmp ("private", p))
+ result = PRAGMA_OMP_CLAUSE_PRIVATE;
+ break;
+ case 'r':
+ if (!strcmp ("reduction", p))
+ result = PRAGMA_OMP_CLAUSE_REDUCTION;
+ break;
+ case 's':
+ if (!strcmp ("schedule", p))
+ result = PRAGMA_OMP_CLAUSE_SCHEDULE;
+ else if (!strcmp ("shared", p))
+ result = PRAGMA_OMP_CLAUSE_SHARED;
+ break;
+ }
+ }
+
+ if (result != PRAGMA_OMP_CLAUSE_NONE)
+ c_parser_consume_token (parser);
+
+ return result;
+}
+
+/* Validate that a clause of the given type does not already exist. */
+
+static void
+check_no_duplicate_clause (tree clauses, enum tree_code code, const char *name)
+{
+ tree c;
+
+ for (c = clauses; c ; c = OMP_CLAUSE_CHAIN (c))
+ if (TREE_CODE (c) == code)
+ {
+ error ("too many %qs clauses", name);
+ break;
+ }
+}
+
+/* OpenMP 2.5:
+ variable-list:
+ identifier
+ variable-list , identifier
+
+ If KIND is nonzero, create the appropriate node and install the decl
+ in OMP_CLAUSE_DECL and add the node to the head of the list.
+
+ If KIND is zero, create a TREE_LIST with the decl in TREE_PURPOSE;
+ return the list created. */
+
+static tree
+c_parser_omp_variable_list (c_parser *parser, enum tree_code kind, tree list)
+{
+ if (c_parser_next_token_is_not (parser, CPP_NAME)
+ || c_parser_peek_token (parser)->id_kind != C_ID_ID)
+ c_parser_error (parser, "expected identifier");
+
+ while (c_parser_next_token_is (parser, CPP_NAME)
+ && c_parser_peek_token (parser)->id_kind == C_ID_ID)
+ {
+ tree t = lookup_name (c_parser_peek_token (parser)->value);
+
+ if (t == NULL_TREE)
+ undeclared_variable (c_parser_peek_token (parser)->value,
+ c_parser_peek_token (parser)->location);
+ else if (t == error_mark_node)
+ ;
+ else if (kind != 0)
+ {
+ tree u = make_node (kind);
+ OMP_CLAUSE_DECL (u) = t;
+ OMP_CLAUSE_CHAIN (u) = list;
+ list = u;
+ }
+ else
+ list = tree_cons (t, NULL_TREE, list);
+
+ c_parser_consume_token (parser);
+
+ if (c_parser_next_token_is_not (parser, CPP_COMMA))
+ break;
+
+ c_parser_consume_token (parser);
+ }
+
+ return list;
+}
+
+/* Similarly, but expect leading and trailing parenthesis. This is a very
+ common case for omp clauses. */
+
+static tree
+c_parser_omp_var_list_parens (c_parser *parser, enum tree_code kind, tree list)
+{
+ if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
+ {
+ list = c_parser_omp_variable_list (parser, kind, list);
+ c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
+ }
+ return list;
+}
+
+/* OpenMP 2.5:
+ copyin ( variable-list ) */
+
+static tree
+c_parser_omp_clause_copyin (c_parser *parser, tree list)
+{
+ return c_parser_omp_var_list_parens (parser, OMP_CLAUSE_COPYIN, list);
+}
+
+/* OpenMP 2.5:
+ copyprivate ( variable-list ) */
+
+static tree
+c_parser_omp_clause_copyprivate (c_parser *parser, tree list)
+{
+ return c_parser_omp_var_list_parens (parser, OMP_CLAUSE_COPYPRIVATE, list);
+}
+
+/* OpenMP 2.5:
+ default ( shared | none ) */
+
+static tree
+c_parser_omp_clause_default (c_parser *parser, tree list)
+{
+ enum omp_clause_default_kind kind = OMP_CLAUSE_DEFAULT_UNSPECIFIED;
+ tree c;
+
+ if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
+ return list;
+ if (c_parser_next_token_is (parser, CPP_NAME))
+ {
+ const char *p = IDENTIFIER_POINTER (c_parser_peek_token (parser)->value);
+
+ switch (p[0])
+ {
+ case 'n':
+ if (strcmp ("none", p) != 0)
+ goto invalid_kind;
+ kind = OMP_CLAUSE_DEFAULT_NONE;
+ break;
+
+ case 's':
+ if (strcmp ("shared", p) != 0)
+ goto invalid_kind;
+ kind = OMP_CLAUSE_DEFAULT_SHARED;
+ break;
+
+ default:
+ goto invalid_kind;
+ }
+
+ c_parser_consume_token (parser);
+ }
+ else
+ {
+ invalid_kind:
+ c_parser_error (parser, "expected %<none%> or %<shared%>");
+ }
+ c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
+
+ if (kind == OMP_CLAUSE_DEFAULT_UNSPECIFIED)
+ return list;
+
+ check_no_duplicate_clause (list, OMP_CLAUSE_DEFAULT, "default");
+ c = make_node (OMP_CLAUSE_DEFAULT);
+ OMP_CLAUSE_CHAIN (c) = list;
+ OMP_CLAUSE_DEFAULT_KIND (c) = kind;
+
+ return c;
+}
+
+/* OpenMP 2.5:
+ firstprivate ( variable-list ) */
+
+static tree
+c_parser_omp_clause_firstprivate (c_parser *parser, tree list)
+{
+ return c_parser_omp_var_list_parens (parser, OMP_CLAUSE_FIRSTPRIVATE, list);
+}
+
+/* OpenMP 2.5:
+ if ( expression ) */
+
+static tree
+c_parser_omp_clause_if (c_parser *parser, tree list)
+{
+ if (c_parser_next_token_is (parser, CPP_OPEN_PAREN))
+ {
+ tree t = c_parser_paren_condition (parser);
+ tree c;
+
+ check_no_duplicate_clause (list, OMP_CLAUSE_IF, "if");
+
+ c = make_node (OMP_CLAUSE_IF);
+ OMP_CLAUSE_IF_EXPR (c) = t;
+ OMP_CLAUSE_CHAIN (c) = list;
+ list = c;
+ }
+ else
+ c_parser_error (parser, "expected %<(%>");
+
+ return list;
+}
+
+/* OpenMP 2.5:
+ lastprivate ( variable-list ) */
+
+static tree
+c_parser_omp_clause_lastprivate (c_parser *parser, tree list)
+{
+ return c_parser_omp_var_list_parens (parser, OMP_CLAUSE_LASTPRIVATE, list);
+}
+
+/* OpenMP 2.5:
+ nowait */
+
+static tree
+c_parser_omp_clause_nowait (c_parser *parser ATTRIBUTE_UNUSED, tree list)
+{
+ tree c;
+
+ check_no_duplicate_clause (list, OMP_CLAUSE_NOWAIT, "nowait");
+
+ c = make_node (OMP_CLAUSE_NOWAIT);
+ OMP_CLAUSE_CHAIN (c) = list;
+ return c;
+}
+
+/* OpenMP 2.5:
+ num_threads ( expression ) */
+
+static tree
+c_parser_omp_clause_num_threads (c_parser *parser, tree list)
+{
+ if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
+ {
+ tree c, t = c_parser_expression (parser).value;
+
+ c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
+
+ if (!INTEGRAL_TYPE_P (TREE_TYPE (t)))
+ {
+ c_parser_error (parser, "expected integer expression");
+ return list;
+ }
+
+ /* Attempt to statically determine when the number isn't positive. */
+ c = fold_build2 (LE_EXPR, boolean_type_node, t,
+ build_int_cst (TREE_TYPE (t), 0));
+ if (c == boolean_true_node)
+ {
+ warning (0, "%<num_threads%> value must be positive");
+ t = integer_one_node;
+ }
+
+ check_no_duplicate_clause (list, OMP_CLAUSE_NUM_THREADS, "num_threads");
+
+ c = make_node (OMP_CLAUSE_NUM_THREADS);
+ OMP_CLAUSE_NUM_THREADS_EXPR (c) = t;
+ OMP_CLAUSE_CHAIN (c) = list;
+ list = c;
+ }
+
+ return list;
+}
+
+/* OpenMP 2.5:
+ ordered */
+
+static tree
+c_parser_omp_clause_ordered (c_parser *parser ATTRIBUTE_UNUSED, tree list)
+{
+ tree c;
+
+ check_no_duplicate_clause (list, OMP_CLAUSE_ORDERED, "ordered");
+
+ c = make_node (OMP_CLAUSE_ORDERED);
+ OMP_CLAUSE_CHAIN (c) = list;
+ return c;
+}
+
+/* OpenMP 2.5:
+ private ( variable-list ) */
+
+static tree
+c_parser_omp_clause_private (c_parser *parser, tree list)
+{
+ return c_parser_omp_var_list_parens (parser, OMP_CLAUSE_PRIVATE, list);
+}
+
+/* OpenMP 2.5:
+ reduction ( reduction-operator : variable-list )
+
+ reduction-operator:
+ One of: + * - & ^ | && || */
+
+static tree
+c_parser_omp_clause_reduction (c_parser *parser, tree list)
+{
+ if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
+ {
+ enum tree_code code;
+
+ switch (c_parser_peek_token (parser)->type)
+ {
+ case CPP_PLUS:
+ code = PLUS_EXPR;
+ break;
+ case CPP_MULT:
+ code = MULT_EXPR;
+ break;
+ case CPP_MINUS:
+ code = MINUS_EXPR;
+ break;
+ case CPP_AND:
+ code = BIT_AND_EXPR;
+ break;
+ case CPP_XOR:
+ code = BIT_XOR_EXPR;
+ break;
+ case CPP_OR:
+ code = BIT_IOR_EXPR;
+ break;
+ case CPP_AND_AND:
+ code = TRUTH_ANDIF_EXPR;
+ break;
+ case CPP_OR_OR:
+ code = TRUTH_ORIF_EXPR;
+ break;
+ default:
+ c_parser_error (parser,
+ "expected %<+%>, %<*%>, %<-%>, %<&%>, "
+ "%<^%>, %<|%>, %<&&%>, or %<||%>");
+ c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, 0);
+ return list;
+ }
+ c_parser_consume_token (parser);
+ if (c_parser_require (parser, CPP_COLON, "expected %<:%>"))
+ {
+ tree nl, c;
+
+ nl = c_parser_omp_variable_list (parser, OMP_CLAUSE_REDUCTION, list);
+ for (c = nl; c != list; c = OMP_CLAUSE_CHAIN (c))
+ OMP_CLAUSE_REDUCTION_CODE (c) = code;
+
+ list = nl;
+ }
+ c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
+ }
+ return list;
+}
+
+/* OpenMP 2.5:
+ schedule ( schedule-kind )
+ schedule ( schedule-kind , expression )
+
+ schedule-kind:
+ static | dynamic | guided | runtime
+*/
+
+static tree
+c_parser_omp_clause_schedule (c_parser *parser, tree list)
+{
+ tree c, t;
+
+ if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
+ return list;
+
+ c = make_node (OMP_CLAUSE_SCHEDULE);
+
+ if (c_parser_next_token_is (parser, CPP_NAME))
+ {
+ tree kind = c_parser_peek_token (parser)->value;
+ const char *p = IDENTIFIER_POINTER (kind);
+
+ switch (p[0])
+ {
+ case 'd':
+ if (strcmp ("dynamic", p) != 0)
+ goto invalid_kind;
+ OMP_CLAUSE_SCHEDULE_KIND (c) = OMP_CLAUSE_SCHEDULE_DYNAMIC;
+ break;
+
+ case 'g':
+ if (strcmp ("guided", p) != 0)
+ goto invalid_kind;
+ OMP_CLAUSE_SCHEDULE_KIND (c) = OMP_CLAUSE_SCHEDULE_GUIDED;
+ break;
+
+ case 'r':
+ if (strcmp ("runtime", p) != 0)
+ goto invalid_kind;
+ OMP_CLAUSE_SCHEDULE_KIND (c) = OMP_CLAUSE_SCHEDULE_RUNTIME;
+ break;
+
+ default:
+ goto invalid_kind;
+ }
+ }
+ else if (c_parser_next_token_is_keyword (parser, RID_STATIC))
+ OMP_CLAUSE_SCHEDULE_KIND (c) = OMP_CLAUSE_SCHEDULE_STATIC;
+ else
+ goto invalid_kind;
+
+ c_parser_consume_token (parser);
+ if (c_parser_next_token_is (parser, CPP_COMMA))
+ {
+ c_parser_consume_token (parser);
+
+ t = c_parser_expr_no_commas (parser, NULL).value;
+
+ if (OMP_CLAUSE_SCHEDULE_KIND (c) == OMP_CLAUSE_SCHEDULE_RUNTIME)
+ error ("schedule %<runtime%> does not take "
+ "a %<chunk_size%> parameter");
+ else if (TREE_CODE (TREE_TYPE (t)) == INTEGER_TYPE)
+ OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (c) = t;
+ else
+ c_parser_error (parser, "expected integer expression");
+
+ c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
+ }
+ else
+ c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
+ "expected %<,%> or %<)%>");
+
+ check_no_duplicate_clause (list, OMP_CLAUSE_SCHEDULE, "schedule");
+ OMP_CLAUSE_CHAIN (c) = list;
+ return c;
+
+ invalid_kind:
+ c_parser_error (parser, "invalid schedule kind");
+ c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, 0);
+ return list;
+}
+
+/* OpenMP 2.5:
+ shared ( variable-list ) */
+
+static tree
+c_parser_omp_clause_shared (c_parser *parser, tree list)
+{
+ return c_parser_omp_var_list_parens (parser, OMP_CLAUSE_SHARED, list);
+}
+
+/* Parse all OpenMP clauses. The set clauses allowed by the directive
+ is a bitmask in MASK. Return the list of clauses found; the result
+ of clause default goes in *pdefault. */
+
+static tree
+c_parser_omp_all_clauses (c_parser *parser, unsigned int mask,
+ const char *where)
+{
+ tree clauses = NULL;
+
+ while (c_parser_next_token_is_not (parser, CPP_PRAGMA_EOL))
+ {
+ const pragma_omp_clause c_kind = c_parser_omp_clause_name (parser);
+ const char *c_name;
+ tree prev = clauses;
+
+ switch (c_kind)
+ {
+ case PRAGMA_OMP_CLAUSE_COPYIN:
+ clauses = c_parser_omp_clause_copyin (parser, clauses);
+ c_name = "copyin";
+ break;
+ case PRAGMA_OMP_CLAUSE_COPYPRIVATE:
+ clauses = c_parser_omp_clause_copyprivate (parser, clauses);
+ c_name = "copyprivate";
+ break;
+ case PRAGMA_OMP_CLAUSE_DEFAULT:
+ clauses = c_parser_omp_clause_default (parser, clauses);
+ c_name = "default";
+ break;
+ case PRAGMA_OMP_CLAUSE_FIRSTPRIVATE:
+ clauses = c_parser_omp_clause_firstprivate (parser, clauses);
+ c_name = "firstprivate";
+ break;
+ case PRAGMA_OMP_CLAUSE_IF:
+ clauses = c_parser_omp_clause_if (parser, clauses);
+ c_name = "if";
+ break;
+ case PRAGMA_OMP_CLAUSE_LASTPRIVATE:
+ clauses = c_parser_omp_clause_lastprivate (parser, clauses);
+ c_name = "lastprivate";
+ break;
+ case PRAGMA_OMP_CLAUSE_NOWAIT:
+ clauses = c_parser_omp_clause_nowait (parser, clauses);
+ c_name = "nowait";
+ break;
+ case PRAGMA_OMP_CLAUSE_NUM_THREADS:
+ clauses = c_parser_omp_clause_num_threads (parser, clauses);
+ c_name = "num_threads";
+ break;
+ case PRAGMA_OMP_CLAUSE_ORDERED:
+ clauses = c_parser_omp_clause_ordered (parser, clauses);
+ c_name = "ordered";
+ break;
+ case PRAGMA_OMP_CLAUSE_PRIVATE:
+ clauses = c_parser_omp_clause_private (parser, clauses);
+ c_name = "private";
+ break;
+ case PRAGMA_OMP_CLAUSE_REDUCTION:
+ clauses = c_parser_omp_clause_reduction (parser, clauses);
+ c_name = "reduction";
+ break;
+ case PRAGMA_OMP_CLAUSE_SCHEDULE:
+ clauses = c_parser_omp_clause_schedule (parser, clauses);
+ c_name = "schedule";
+ break;
+ case PRAGMA_OMP_CLAUSE_SHARED:
+ clauses = c_parser_omp_clause_shared (parser, clauses);
+ c_name = "shared";
+ break;
+ default:
+ c_parser_error (parser, "expected %<#pragma omp%> clause");
+ goto saw_error;
+ }
+
+ if (((mask >> c_kind) & 1) == 0 && !parser->error)
+ {
+ /* Remove the invalid clause(s) from the list to avoid
+ confusing the rest of the compiler. */
+ clauses = prev;
+ error ("%qs is not valid for %qs", c_name, where);
+ }
+ }
+
+ saw_error:
+ c_parser_skip_to_pragma_eol (parser);
+
+ return c_finish_omp_clauses (clauses);
+}
+
+/* OpenMP 2.5:
+ structured-block:
+ statement
+
+ In practice, we're also interested in adding the statement to an
+ outer node. So it is convenient if we work around the fact that
+ c_parser_statement calls add_stmt. */
+
+static tree
+c_parser_omp_structured_block (c_parser *parser)
+{
+ tree stmt = push_stmt_list ();
+ c_parser_statement (parser);
+ return pop_stmt_list (stmt);
+}
+
+/* OpenMP 2.5:
+ # pragma omp atomic new-line
+ expression-stmt
+
+ expression-stmt:
+ x binop= expr | x++ | ++x | x-- | --x
+ binop:
+ +, *, -, /, &, ^, |, <<, >>
+
+ where x is an lvalue expression with scalar type. */
+
+static void
+c_parser_omp_atomic (c_parser *parser)
+{
+ tree lhs, rhs;
+ enum tree_code code;
+
+ c_parser_skip_to_pragma_eol (parser);
+
+ lhs = c_parser_unary_expression (parser).value;
+ switch (TREE_CODE (lhs))
+ {
+ case ERROR_MARK:
+ saw_error:
+ c_parser_skip_to_end_of_block_or_statement (parser);
+ return;
+
+ case PREINCREMENT_EXPR:
+ case POSTINCREMENT_EXPR:
+ lhs = TREE_OPERAND (lhs, 0);
+ code = PLUS_EXPR;
+ rhs = integer_one_node;
+ break;
+
+ case PREDECREMENT_EXPR:
+ case POSTDECREMENT_EXPR:
+ lhs = TREE_OPERAND (lhs, 0);
+ code = MINUS_EXPR;
+ rhs = integer_one_node;
+ break;
+
+ default:
+ switch (c_parser_peek_token (parser)->type)
+ {
+ case CPP_MULT_EQ:
+ code = MULT_EXPR;
+ break;
+ case CPP_DIV_EQ:
+ code = TRUNC_DIV_EXPR;
+ break;
+ case CPP_PLUS_EQ:
+ code = PLUS_EXPR;
+ break;
+ case CPP_MINUS_EQ:
+ code = MINUS_EXPR;
+ break;
+ case CPP_LSHIFT_EQ:
+ code = LSHIFT_EXPR;
+ break;
+ case CPP_RSHIFT_EQ:
+ code = RSHIFT_EXPR;
+ break;
+ case CPP_AND_EQ:
+ code = BIT_AND_EXPR;
+ break;
+ case CPP_OR_EQ:
+ code = BIT_IOR_EXPR;
+ break;
+ case CPP_XOR_EQ:
+ code = BIT_XOR_EXPR;
+ break;
+ default:
+ c_parser_error (parser,
+ "invalid operator for %<#pragma omp atomic%>");
+ goto saw_error;
+ }
+
+ c_parser_consume_token (parser);
+ rhs = c_parser_expression (parser).value;
+ break;
+ }
+ c_finish_omp_atomic (code, lhs, rhs);
+ c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
+}
+
+
+/* OpenMP 2.5:
+ # pragma omp barrier new-line
+*/
+
+static void
+c_parser_omp_barrier (c_parser *parser)
+{
+ c_parser_consume_pragma (parser);
+ c_parser_skip_to_pragma_eol (parser);
+
+ c_finish_omp_barrier ();
+}
+
+/* OpenMP 2.5:
+ # pragma omp critical [(name)] new-line
+ structured-block
+*/
+
+static tree
+c_parser_omp_critical (c_parser *parser)
+{
+ tree stmt, name = NULL;
+
+ if (c_parser_next_token_is (parser, CPP_OPEN_PAREN))
+ {
+ c_parser_consume_token (parser);
+ if (c_parser_next_token_is (parser, CPP_NAME))
+ {
+ name = c_parser_peek_token (parser)->value;
+ c_parser_consume_token (parser);
+ c_parser_require (parser, CPP_CLOSE_PAREN, "expected %<)%>");
+ }
+ else
+ c_parser_error (parser, "expected identifier");
+ }
+ else if (c_parser_next_token_is_not (parser, CPP_PRAGMA_EOL))
+ c_parser_error (parser, "expected %<(%> or end of line");
+ c_parser_skip_to_pragma_eol (parser);
+
+ stmt = c_parser_omp_structured_block (parser);
+ return c_finish_omp_critical (stmt, name);
+}
+
+/* OpenMP 2.5:
+ # pragma omp flush flush-vars[opt] new-line
+
+ flush-vars:
+ ( variable-list ) */
+
+static void
+c_parser_omp_flush (c_parser *parser)
+{
+ c_parser_consume_pragma (parser);
+ if (c_parser_next_token_is (parser, CPP_OPEN_PAREN))
+ c_parser_omp_var_list_parens (parser, 0, NULL);
+ else if (c_parser_next_token_is_not (parser, CPP_PRAGMA_EOL))
+ c_parser_error (parser, "expected %<(%> or end of line");
+ c_parser_skip_to_pragma_eol (parser);
+
+ c_finish_omp_flush ();
+}
+
+/* Parse the restricted form of the for statment allowed by OpenMP.
+ The real trick here is to determine the loop control variable early
+ so that we can push a new decl if necessary to make it private. */
+
+static tree
+c_parser_omp_for_loop (c_parser *parser)
+{
+ tree decl, cond, incr, save_break, save_cont, body, init;
+ location_t loc;
+
+ if (!c_parser_next_token_is_keyword (parser, RID_FOR))
+ {
+ c_parser_error (parser, "for statement expected");
+ return NULL;
+ }
+ loc = c_parser_peek_token (parser)->location;
+ c_parser_consume_token (parser);
+
+ if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
+ return NULL;
+
+ /* Parse the initialization declaration or expression. */
+ if (c_parser_next_token_starts_declspecs (parser))
+ {
+ c_parser_declaration_or_fndef (parser, true, true, true, true);
+ decl = check_for_loop_decls ();
+ if (decl == NULL)
+ goto error_init;
+ init = decl;
+ }
+ else if (c_parser_next_token_is (parser, CPP_NAME)
+ && c_parser_peek_2nd_token (parser)->type == CPP_EQ)
+ {
+ decl = c_parser_postfix_expression (parser).value;
+
+ c_parser_require (parser, CPP_EQ, "expected %<=%>");
+
+ init = c_parser_expr_no_commas (parser, NULL).value;
+ init = build_modify_expr (decl, NOP_EXPR, init);
+ init = c_process_expr_stmt (init);
+
+ c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
+ }
+ else
+ goto error_init;
+
+ /* Parse the loop condition. */
+ cond = NULL_TREE;
+ if (c_parser_next_token_is_not (parser, CPP_SEMICOLON))
+ {
+ cond = c_parser_expression_conv (parser).value;
+ cond = c_objc_common_truthvalue_conversion (cond);
+ if (EXPR_P (cond))
+ SET_EXPR_LOCATION (cond, input_location);
+ }
+ c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
+
+ /* Parse the increment expression. */
+ incr = NULL_TREE;
+ if (c_parser_next_token_is_not (parser, CPP_CLOSE_PAREN))
+ incr = c_process_expr_stmt (c_parser_expression (parser).value);
+ c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
+
+ parse_body:
+ save_break = c_break_label;
+ c_break_label = size_one_node;
+ save_cont = c_cont_label;
+ c_cont_label = NULL_TREE;
+ body = push_stmt_list ();
+
+ add_stmt (c_parser_c99_block_statement (parser));
+ if (c_cont_label)
+ add_stmt (build1 (LABEL_EXPR, void_type_node, c_cont_label));
+
+ body = pop_stmt_list (body);
+ c_break_label = save_break;
+ c_cont_label = save_cont;
+
+ /* Only bother calling c_finish_omp_for if we havn't already generated
+ an error from the initialization parsing. */
+ if (decl != NULL)
+ return c_finish_omp_for (loc, decl, init, cond, incr, body, NULL);
+ return NULL;
+
+ error_init:
+ c_parser_error (parser, "expected iteration declaration or initialization");
+ c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
+ decl = init = cond = incr = NULL_TREE;
+ goto parse_body;
+}
+
+/* OpenMP 2.5:
+ #pragma omp for for-clause[optseq] new-line
+ for-loop
+*/
+
+#define OMP_FOR_CLAUSE_MASK \
+ ( (1u << PRAGMA_OMP_CLAUSE_PRIVATE) \
+ | (1u << PRAGMA_OMP_CLAUSE_FIRSTPRIVATE) \
+ | (1u << PRAGMA_OMP_CLAUSE_LASTPRIVATE) \
+ | (1u << PRAGMA_OMP_CLAUSE_REDUCTION) \
+ | (1u << PRAGMA_OMP_CLAUSE_ORDERED) \
+ | (1u << PRAGMA_OMP_CLAUSE_SCHEDULE) \
+ | (1u << PRAGMA_OMP_CLAUSE_NOWAIT))
+
+static tree
+c_parser_omp_for (c_parser *parser)
+{
+ tree block, clauses, ret;
+
+ clauses = c_parser_omp_all_clauses (parser, OMP_FOR_CLAUSE_MASK,
+ "#pragma omp for");
+
+ block = c_begin_compound_stmt (true);
+ ret = c_parser_omp_for_loop (parser);
+ if (ret)
+ OMP_FOR_CLAUSES (ret) = clauses;
+ block = c_end_compound_stmt (block, true);
+ add_stmt (block);
+
+ return ret;
+}
+
+/* OpenMP 2.5:
+ # pragma omp master new-line
+ structured-block
+*/
+
+static tree
+c_parser_omp_master (c_parser *parser)
+{
+ c_parser_skip_to_pragma_eol (parser);
+ return c_finish_omp_master (c_parser_omp_structured_block (parser));
+}
+
+/* OpenMP 2.5:
+ # pragma omp ordered new-line
+ structured-block
+*/
+
+static tree
+c_parser_omp_ordered (c_parser *parser)
+{
+ c_parser_skip_to_pragma_eol (parser);
+ return c_finish_omp_ordered (c_parser_omp_structured_block (parser));
+}
+
+/* OpenMP 2.5:
+
+ section-scope:
+ { section-sequence }
+
+ section-sequence:
+ section-directive[opt] structured-block
+ section-sequence section-directive structured-block */
+
+static tree
+c_parser_omp_sections_scope (c_parser *parser)
+{
+ tree stmt, substmt;
+ bool error_suppress = false;
+ location_t loc;
+
+ if (!c_parser_require (parser, CPP_OPEN_BRACE, "expected %<{%>"))
+ {
+ /* Avoid skipping until the end of the block. */
+ parser->error = false;
+ return NULL_TREE;
+ }
+
+ stmt = push_stmt_list ();
+
+ loc = c_parser_peek_token (parser)->location;
+ if (c_parser_peek_token (parser)->pragma_kind != PRAGMA_OMP_SECTION)
+ {
+ substmt = push_stmt_list ();
+
+ while (1)
+ {
+ c_parser_statement (parser);
+
+ if (c_parser_peek_token (parser)->pragma_kind == PRAGMA_OMP_SECTION)
+ break;
+ if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
+ break;
+ if (c_parser_next_token_is (parser, CPP_EOF))
+ break;
+ }
+
+ substmt = pop_stmt_list (substmt);
+ substmt = build1 (OMP_SECTION, void_type_node, substmt);
+ SET_EXPR_LOCATION (substmt, loc);
+ add_stmt (substmt);
+ }
+
+ while (1)
+ {
+ if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
+ break;
+ if (c_parser_next_token_is (parser, CPP_EOF))
+ break;
+
+ loc = c_parser_peek_token (parser)->location;
+ if (c_parser_peek_token (parser)->pragma_kind == PRAGMA_OMP_SECTION)
+ {
+ c_parser_consume_pragma (parser);
+ c_parser_skip_to_pragma_eol (parser);
+ error_suppress = false;
+ }
+ else if (!error_suppress)
+ {
+ error ("expected %<#pragma omp section%> or %<}%>");
+ error_suppress = true;
+ }
+
+ substmt = c_parser_omp_structured_block (parser);
+ substmt = build1 (OMP_SECTION, void_type_node, substmt);
+ SET_EXPR_LOCATION (substmt, loc);
+ add_stmt (substmt);
+ }
+ c_parser_skip_until_found (parser, CPP_CLOSE_BRACE,
+ "expected %<#pragma omp section%> or %<}%>");
+
+ substmt = pop_stmt_list (stmt);
+
+ stmt = make_node (OMP_SECTIONS);
+ TREE_TYPE (stmt) = void_type_node;
+ OMP_SECTIONS_BODY (stmt) = substmt;
+
+ return add_stmt (stmt);
+}
+
+/* OpenMP 2.5:
+ # pragma omp sections sections-clause[optseq] newline
+ sections-scope
+*/
+
+#define OMP_SECTIONS_CLAUSE_MASK \
+ ( (1u << PRAGMA_OMP_CLAUSE_PRIVATE) \
+ | (1u << PRAGMA_OMP_CLAUSE_FIRSTPRIVATE) \
+ | (1u << PRAGMA_OMP_CLAUSE_LASTPRIVATE) \
+ | (1u << PRAGMA_OMP_CLAUSE_REDUCTION) \
+ | (1u << PRAGMA_OMP_CLAUSE_NOWAIT))
+
+static tree
+c_parser_omp_sections (c_parser *parser)
+{
+ tree block, clauses, ret;
+
+ clauses = c_parser_omp_all_clauses (parser, OMP_SECTIONS_CLAUSE_MASK,
+ "#pragma omp sections");
+
+ block = c_begin_compound_stmt (true);
+ ret = c_parser_omp_sections_scope (parser);
+ if (ret)
+ OMP_SECTIONS_CLAUSES (ret) = clauses;
+ block = c_end_compound_stmt (block, true);
+ add_stmt (block);
+
+ return ret;
+}
+
+/* OpenMP 2.5:
+ # pragma parallel parallel-clause new-line
+ # pragma parallel for parallel-for-clause new-line
+ # pragma parallel sections parallel-sections-clause new-line
+*/
+
+#define OMP_PARALLEL_CLAUSE_MASK \
+ ( (1u << PRAGMA_OMP_CLAUSE_IF) \
+ | (1u << PRAGMA_OMP_CLAUSE_PRIVATE) \
+ | (1u << PRAGMA_OMP_CLAUSE_FIRSTPRIVATE) \
+ | (1u << PRAGMA_OMP_CLAUSE_DEFAULT) \
+ | (1u << PRAGMA_OMP_CLAUSE_SHARED) \
+ | (1u << PRAGMA_OMP_CLAUSE_COPYIN) \
+ | (1u << PRAGMA_OMP_CLAUSE_REDUCTION) \
+ | (1u << PRAGMA_OMP_CLAUSE_NUM_THREADS))
+
+static tree
+c_parser_omp_parallel (c_parser *parser)
+{
+ enum pragma_kind p_kind = PRAGMA_OMP_PARALLEL;
+ const char *p_name = "#pragma omp parallel";
+ tree stmt, clauses, par_clause, ws_clause, block;
+ unsigned int mask = OMP_PARALLEL_CLAUSE_MASK;
+
+ if (c_parser_next_token_is_keyword (parser, RID_FOR))
+ {
+ c_parser_consume_token (parser);
+ p_kind = PRAGMA_OMP_PARALLEL_FOR;
+ p_name = "#pragma omp parallel for";
+ mask |= OMP_FOR_CLAUSE_MASK;
+ mask &= ~(1u << PRAGMA_OMP_CLAUSE_NOWAIT);
+ }
+ else if (c_parser_next_token_is (parser, CPP_NAME))
+ {
+ const char *p = IDENTIFIER_POINTER (c_parser_peek_token (parser)->value);
+ if (strcmp (p, "sections") == 0)
+ {
+ c_parser_consume_token (parser);
+ p_kind = PRAGMA_OMP_PARALLEL_SECTIONS;
+ p_name = "#pragma omp parallel sections";
+ mask |= OMP_SECTIONS_CLAUSE_MASK;
+ mask &= ~(1u << PRAGMA_OMP_CLAUSE_NOWAIT);
+ }
+ }
+
+ clauses = c_parser_omp_all_clauses (parser, mask, p_name);
+
+ switch (p_kind)
+ {
+ case PRAGMA_OMP_PARALLEL:
+ block = c_begin_omp_parallel ();
+ c_parser_statement (parser);
+ stmt = c_finish_omp_parallel (clauses, block);
+ break;
+
+ case PRAGMA_OMP_PARALLEL_FOR:
+ block = c_begin_omp_parallel ();
+ c_split_parallel_clauses (clauses, &par_clause, &ws_clause);
+ stmt = c_parser_omp_for_loop (parser);
+ if (stmt)
+ OMP_FOR_CLAUSES (stmt) = ws_clause;
+ stmt = c_finish_omp_parallel (par_clause, block);
+ break;
+
+ case PRAGMA_OMP_PARALLEL_SECTIONS:
+ block = c_begin_omp_parallel ();
+ c_split_parallel_clauses (clauses, &par_clause, &ws_clause);
+ stmt = c_parser_omp_sections_scope (parser);
+ if (stmt)
+ OMP_SECTIONS_CLAUSES (stmt) = ws_clause;
+ stmt = c_finish_omp_parallel (par_clause, block);
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+
+ return stmt;
+}
+
+/* OpenMP 2.5:
+ # pragma omp single single-clause[optseq] new-line
+ structured-block
+*/
+
+#define OMP_SINGLE_CLAUSE_MASK \
+ ( (1u << PRAGMA_OMP_CLAUSE_PRIVATE) \
+ | (1u << PRAGMA_OMP_CLAUSE_FIRSTPRIVATE) \
+ | (1u << PRAGMA_OMP_CLAUSE_COPYPRIVATE) \
+ | (1u << PRAGMA_OMP_CLAUSE_NOWAIT))
+
+static tree
+c_parser_omp_single (c_parser *parser)
+{
+ tree stmt = make_node (OMP_SINGLE);
+ TREE_TYPE (stmt) = void_type_node;
+
+ OMP_SINGLE_CLAUSES (stmt)
+ = c_parser_omp_all_clauses (parser, OMP_SINGLE_CLAUSE_MASK,
+ "#pragma omp single");
+ OMP_SINGLE_BODY (stmt) = c_parser_omp_structured_block (parser);
+
+ return add_stmt (stmt);
+}
+
+
+/* Main entry point to parsing most OpenMP pragmas. */
+
+static void
+c_parser_omp_construct (c_parser *parser)
+{
+ enum pragma_kind p_kind;
+ location_t loc;
+ tree stmt;
+
+ loc = c_parser_peek_token (parser)->location;
+ p_kind = c_parser_peek_token (parser)->pragma_kind;
+ c_parser_consume_pragma (parser);
+
+ switch (p_kind)
+ {
+ case PRAGMA_OMP_ATOMIC:
+ c_parser_omp_atomic (parser);
+ return;
+ case PRAGMA_OMP_CRITICAL:
+ stmt = c_parser_omp_critical (parser);
+ break;
+ case PRAGMA_OMP_FOR:
+ stmt = c_parser_omp_for (parser);
+ break;
+ case PRAGMA_OMP_MASTER:
+ stmt = c_parser_omp_master (parser);
+ break;
+ case PRAGMA_OMP_ORDERED:
+ stmt = c_parser_omp_ordered (parser);
+ break;
+ case PRAGMA_OMP_PARALLEL:
+ stmt = c_parser_omp_parallel (parser);
+ break;
+ case PRAGMA_OMP_SECTIONS:
+ stmt = c_parser_omp_sections (parser);
+ break;
+ case PRAGMA_OMP_SINGLE:
+ stmt = c_parser_omp_single (parser);
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
+ if (stmt)
+ SET_EXPR_LOCATION (stmt, loc);
+}
+
+
+/* OpenMP 2.5:
+ # pragma omp threadprivate (variable-list) */
+
+static void
+c_parser_omp_threadprivate (c_parser *parser)
+{
+ tree vars, t;
+
+ c_parser_consume_pragma (parser);
+ vars = c_parser_omp_var_list_parens (parser, 0, NULL);
+
+ if (!targetm.have_tls)
+ sorry ("threadprivate variables not supported in this target");
+
+ /* Mark every variable in VARS to be assigned thread local storage. */
+ for (t = vars; t; t = TREE_CHAIN (t))
+ {
+ tree v = TREE_PURPOSE (t);
+
+ /* If V had already been marked threadprivate, it doesn't matter
+ whether it had been used prior to this point. */
+ if (TREE_USED (v) && !C_DECL_THREADPRIVATE_P (v))
+ error ("%qE declared %<threadprivate%> after first use", v);
+ else if (! TREE_STATIC (v) && ! DECL_EXTERNAL (v))
+ error ("automatic variable %qE cannot be %<threadprivate%>", v);
+ else if (! COMPLETE_TYPE_P (TREE_TYPE (v)))
+ error ("%<threadprivate%> %qE has incomplete type", v);
+ else
+ {
+ if (! DECL_THREAD_LOCAL_P (v))
+ {
+ DECL_TLS_MODEL (v) = decl_default_tls_model (v);
+ /* If rtl has been already set for this var, call
+ make_decl_rtl once again, so that encode_section_info
+ has a chance to look at the new decl flags. */
+ if (DECL_RTL_SET_P (v))
+ make_decl_rtl (v);
+ }
+ C_DECL_THREADPRIVATE_P (v) = 1;
+ }
+ }
+
+ c_parser_skip_to_pragma_eol (parser);
+}
+
+\f
/* Parse a single source file. */
void
void
init_pragma (void)
{
+ if (flag_openmp && !flag_preprocess_only)
+ {
+ struct omp_pragma_def { const char *name; unsigned int id; };
+ static const struct omp_pragma_def omp_pragmas[] = {
+ { "atomic", PRAGMA_OMP_ATOMIC },
+ { "barrier", PRAGMA_OMP_BARRIER },
+ { "critical", PRAGMA_OMP_CRITICAL },
+ { "flush", PRAGMA_OMP_FLUSH },
+ { "for", PRAGMA_OMP_FOR },
+ { "master", PRAGMA_OMP_MASTER },
+ { "ordered", PRAGMA_OMP_ORDERED },
+ { "parallel", PRAGMA_OMP_PARALLEL },
+ { "section", PRAGMA_OMP_SECTION },
+ { "sections", PRAGMA_OMP_SECTIONS },
+ { "single", PRAGMA_OMP_SINGLE },
+ { "threadprivate", PRAGMA_OMP_THREADPRIVATE }
+ };
+
+ const int n_omp_pragmas = sizeof (omp_pragmas) / sizeof (*omp_pragmas);
+ int i;
+
+ for (i = 0; i < n_omp_pragmas; ++i)
+ cpp_register_deferred_pragma (parse_in, "omp", omp_pragmas[i].name,
+ omp_pragmas[i].id, true, true);
+ }
+
cpp_register_deferred_pragma (parse_in, "GCC", "pch_preprocess",
PRAGMA_GCC_PCH_PREPROCESS, false, false);
typedef enum pragma_kind {
PRAGMA_NONE = 0,
+ PRAGMA_OMP_ATOMIC,
+ PRAGMA_OMP_BARRIER,
+ PRAGMA_OMP_CRITICAL,
+ PRAGMA_OMP_FLUSH,
+ PRAGMA_OMP_FOR,
+ PRAGMA_OMP_MASTER,
+ PRAGMA_OMP_ORDERED,
+ PRAGMA_OMP_PARALLEL,
+ PRAGMA_OMP_PARALLEL_FOR,
+ PRAGMA_OMP_PARALLEL_SECTIONS,
+ PRAGMA_OMP_SECTION,
+ PRAGMA_OMP_SECTIONS,
+ PRAGMA_OMP_SINGLE,
+ PRAGMA_OMP_THREADPRIVATE,
+
PRAGMA_GCC_PCH_PREPROCESS,
PRAGMA_FIRST_EXTERNAL
#define C_DECL_UNDEFINABLE_VM(EXP) \
DECL_LANG_FLAG_5 (LABEL_DECL_CHECK (EXP))
+/* Record whether a variable has been declared threadprivate by
+ #pragma omp threadprivate. */
+#define C_DECL_THREADPRIVATE_P(DECL) DECL_LANG_FLAG_3 (VAR_DECL_CHECK (DECL))
+
/* Nonzero for a decl which either doesn't exist or isn't a prototype.
N.B. Could be simplified if all built-in decls had complete prototypes
(but this is presently difficult because some of them need FILE*). */
extern void push_scope (void);
extern tree pop_scope (void);
extern void insert_block (tree);
-extern tree pushdecl (tree);
extern void c_expand_body (tree);
extern void c_init_decl_processing (void);
extern struct c_declarator *build_array_declarator (tree, struct c_declspecs *,
bool, bool);
extern tree build_enumerator (tree, tree);
-extern void check_for_loop_decls (void);
+extern tree check_for_loop_decls (void);
extern void mark_forward_parm_decls (void);
extern void declare_parm_level (void);
extern void undeclared_variable (tree, location_t);
extern void c_push_function_context (struct function *);
extern void c_pop_function_context (struct function *);
extern void push_parm_decl (const struct c_parm *);
-extern tree pushdecl_top_level (tree);
extern struct c_declarator *set_array_declarator_inner (struct c_declarator *,
struct c_declarator *,
bool);
extern struct c_expr default_function_array_conversion (struct c_expr);
extern tree composite_type (tree, tree);
extern tree build_component_ref (tree, tree);
-extern tree build_indirect_ref (tree, const char *);
extern tree build_array_ref (tree, tree);
extern tree build_external_ref (tree, int, location_t);
extern void pop_maybe_used (bool);
extern tree build_compound_expr (tree, tree);
extern tree c_cast_expr (struct c_type_name *, tree);
extern tree build_c_cast (tree, tree);
-extern tree build_modify_expr (tree, enum tree_code, tree);
extern void store_init_value (tree, tree);
extern void error_init (const char *);
extern void pedwarn_init (const char *);
extern void c_begin_vm_scope (unsigned int);
extern void c_end_vm_scope (unsigned int);
extern tree c_expr_to_decl (tree, bool *, bool *, bool *);
+extern tree c_begin_omp_parallel (void);
+extern tree c_finish_omp_parallel (tree, tree);
+extern tree c_finish_omp_clauses (tree);
/* Set to 0 at beginning of a function definition, set to 1 if
a return statement that specifies a return value is seen. */
/* Report a read-only lvalue. */
if (TREE_READONLY (arg))
- readonly_error (arg,
- ((code == PREINCREMENT_EXPR
- || code == POSTINCREMENT_EXPR)
- ? lv_increment : lv_decrement));
+ {
+ readonly_error (arg,
+ ((code == PREINCREMENT_EXPR
+ || code == POSTINCREMENT_EXPR)
+ ? lv_increment : lv_decrement));
+ return error_mark_node;
+ }
if (TREE_CODE (TREE_TYPE (arg)) == BOOLEAN_TYPE)
val = boolean_increment (code, arg);
|| ((TREE_CODE (lhstype) == RECORD_TYPE
|| TREE_CODE (lhstype) == UNION_TYPE)
&& C_TYPE_FIELDS_READONLY (lhstype)))
- readonly_error (lhs, lv_assign);
+ {
+ readonly_error (lhs, lv_assign);
+ return error_mark_node;
+ }
/* If storing into a structure or union member,
it has probably been given type `int'.
if (!skip)
*label_p = label = create_artificial_label ();
}
- else if (TREE_CODE (label) != LABEL_DECL)
+ else if (TREE_CODE (label) == LABEL_DECL)
+ ;
+ else switch (TREE_INT_CST_LOW (label))
{
+ case 0:
if (is_break)
error ("break statement not within loop or switch");
else
error ("continue statement not within a loop");
return NULL_TREE;
+
+ case 1:
+ gcc_assert (is_break);
+ error ("break statement used with OpenMP for loop");
+ return NULL_TREE;
+
+ default:
+ gcc_unreachable ();
}
if (skip)
else
return expr;
}
+
+\f
+/* Like c_begin_compound_stmt, except force the retension of the BLOCK. */
+
+tree
+c_begin_omp_parallel (void)
+{
+ tree block;
+
+ keep_next_level ();
+ block = c_begin_compound_stmt (true);
+
+ return block;
+}
+
+tree
+c_finish_omp_parallel (tree clauses, tree block)
+{
+ tree stmt;
+
+ block = c_end_compound_stmt (block, true);
+
+ stmt = make_node (OMP_PARALLEL);
+ TREE_TYPE (stmt) = void_type_node;
+ OMP_PARALLEL_CLAUSES (stmt) = clauses;
+ OMP_PARALLEL_BODY (stmt) = block;
+
+ return add_stmt (stmt);
+}
+
+/* For all elements of CLAUSES, validate them vs OpenMP constraints.
+ Remove any elements from the list that are invalid. */
+
+tree
+c_finish_omp_clauses (tree clauses)
+{
+ bitmap_head generic_head, firstprivate_head, lastprivate_head;
+ tree c, t, *pc = &clauses;
+ const char *name;
+
+ bitmap_obstack_initialize (NULL);
+ bitmap_initialize (&generic_head, &bitmap_default_obstack);
+ bitmap_initialize (&firstprivate_head, &bitmap_default_obstack);
+ bitmap_initialize (&lastprivate_head, &bitmap_default_obstack);
+
+ for (pc = &clauses, c = clauses; c ; c = *pc)
+ {
+ bool remove = false;
+ bool need_complete = false;
+ bool need_implicitly_determined = false;
+
+ switch (TREE_CODE (c))
+ {
+ case OMP_CLAUSE_SHARED:
+ name = "shared";
+ need_implicitly_determined = true;
+ goto check_dup_generic;
+
+ case OMP_CLAUSE_PRIVATE:
+ name = "private";
+ need_complete = true;
+ need_implicitly_determined = true;
+ goto check_dup_generic;
+
+ case OMP_CLAUSE_REDUCTION:
+ name = "reduction";
+ need_implicitly_determined = true;
+ t = OMP_CLAUSE_DECL (c);
+ if (AGGREGATE_TYPE_P (TREE_TYPE (t))
+ || POINTER_TYPE_P (TREE_TYPE (t)))
+ {
+ error ("%qE has invalid type for %<reduction%>", t);
+ remove = true;
+ }
+ else if (FLOAT_TYPE_P (TREE_TYPE (t)))
+ {
+ enum tree_code r_code = OMP_CLAUSE_REDUCTION_CODE (c);
+ const char *r_name = NULL;
+
+ switch (r_code)
+ {
+ case PLUS_EXPR:
+ case MULT_EXPR:
+ case MINUS_EXPR:
+ break;
+ case BIT_AND_EXPR:
+ r_name = "&";
+ break;
+ case BIT_XOR_EXPR:
+ r_name = "^";
+ break;
+ case BIT_IOR_EXPR:
+ r_name = "|";
+ break;
+ case TRUTH_ANDIF_EXPR:
+ r_name = "&&";
+ break;
+ case TRUTH_ORIF_EXPR:
+ r_name = "||";
+ break;
+ default:
+ gcc_unreachable ();
+ }
+ if (r_name)
+ {
+ error ("%qE has invalid type for %<reduction(%s)%>",
+ t, r_name);
+ remove = true;
+ }
+ }
+ goto check_dup_generic;
+
+ case OMP_CLAUSE_COPYPRIVATE:
+ name = "copyprivate";
+ goto check_dup_generic;
+
+ case OMP_CLAUSE_COPYIN:
+ name = "copyin";
+ t = OMP_CLAUSE_DECL (c);
+ if (TREE_CODE (t) != VAR_DECL || !DECL_THREAD_LOCAL_P (t))
+ {
+ error ("%qE must be %<threadprivate%> for %<copyin%>", t);
+ remove = true;
+ }
+ goto check_dup_generic;
+
+ check_dup_generic:
+ t = OMP_CLAUSE_DECL (c);
+ if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL)
+ {
+ error ("%qE is not a variable in clause %qs", t, name);
+ remove = true;
+ }
+ else if (bitmap_bit_p (&generic_head, DECL_UID (t))
+ || bitmap_bit_p (&firstprivate_head, DECL_UID (t))
+ || bitmap_bit_p (&lastprivate_head, DECL_UID (t)))
+ {
+ error ("%qE appears more than once in data clauses", t);
+ remove = true;
+ }
+ else
+ bitmap_set_bit (&generic_head, DECL_UID (t));
+ break;
+
+ case OMP_CLAUSE_FIRSTPRIVATE:
+ name = "firstprivate";
+ t = OMP_CLAUSE_DECL (c);
+ need_complete = true;
+ need_implicitly_determined = true;
+ if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL)
+ {
+ error ("%qE is not a variable in clause %<firstprivate%>", t);
+ remove = true;
+ }
+ else if (bitmap_bit_p (&generic_head, DECL_UID (t))
+ || bitmap_bit_p (&firstprivate_head, DECL_UID (t)))
+ {
+ error ("%qE appears more than once in data clauses", t);
+ remove = true;
+ }
+ else
+ bitmap_set_bit (&firstprivate_head, DECL_UID (t));
+ break;
+
+ case OMP_CLAUSE_LASTPRIVATE:
+ name = "lastprivate";
+ t = OMP_CLAUSE_DECL (c);
+ need_complete = true;
+ need_implicitly_determined = true;
+ if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL)
+ {
+ error ("%qE is not a variable in clause %<lastprivate%>", t);
+ remove = true;
+ }
+ else if (bitmap_bit_p (&generic_head, DECL_UID (t))
+ || bitmap_bit_p (&lastprivate_head, DECL_UID (t)))
+ {
+ error ("%qE appears more than once in data clauses", t);
+ remove = true;
+ }
+ else
+ bitmap_set_bit (&lastprivate_head, DECL_UID (t));
+ break;
+
+ case OMP_CLAUSE_IF:
+ case OMP_CLAUSE_NUM_THREADS:
+ case OMP_CLAUSE_SCHEDULE:
+ case OMP_CLAUSE_NOWAIT:
+ case OMP_CLAUSE_ORDERED:
+ case OMP_CLAUSE_DEFAULT:
+ pc = &OMP_CLAUSE_CHAIN (c);
+ continue;
+
+ default:
+ gcc_unreachable ();
+ }
+
+ if (!remove)
+ {
+ t = OMP_CLAUSE_DECL (c);
+
+ if (need_complete)
+ {
+ t = require_complete_type (t);
+ if (t == error_mark_node)
+ remove = true;
+ }
+
+ if (need_implicitly_determined)
+ {
+ const char *share_name = NULL;
+
+ if (TREE_CODE (t) == VAR_DECL && DECL_THREAD_LOCAL_P (t))
+ share_name = "threadprivate";
+ else switch (c_omp_predetermined_sharing (t))
+ {
+ case OMP_CLAUSE_DEFAULT_UNSPECIFIED:
+ break;
+ case OMP_CLAUSE_DEFAULT_SHARED:
+ share_name = "shared";
+ break;
+ case OMP_CLAUSE_DEFAULT_PRIVATE:
+ share_name = "private";
+ break;
+ default:
+ gcc_unreachable ();
+ }
+ if (share_name)
+ {
+ error ("%qE is predetermined %qs for %qs",
+ t, share_name, name);
+ remove = true;
+ }
+ }
+ }
+
+ if (remove)
+ *pc = OMP_CLAUSE_CHAIN (c);
+ else
+ pc = &OMP_CLAUSE_CHAIN (c);
+ }
+
+ bitmap_obstack_release (NULL);
+ return clauses;
+}
ObjC ObjC++ Var(flag_objc_sjlj_exceptions) Init(-1)
Enable Objective-C setjmp exception handling runtime
+fopenmp
+C ObjC C++ ObjC++ Var(flag_openmp)
+Enable OpenMP
+
foperator-names
C++ ObjC++
Recognize C++ kewords like \"compl\" and \"xor\"
/* Queue of cgraph nodes scheduled to be lowered. */
struct cgraph_node *cgraph_nodes_queue;
+/* Queue of cgraph nodes scheduled to be analyzed. */
+struct cgraph_node *cgraph_analyze_queue;
+
/* Number of nodes in existence. */
int cgraph_n_nodes;
return AVAIL_AVAILABLE;
}
+
+/* Add the function FNDECL to the call graph. This assumes that the
+ body of FNDECL is in GENERIC form and ready to be processed by
+ cgraph_finalize_function. */
+
+void
+cgraph_add_new_function (tree fndecl)
+{
+ /* We're called while lowering another function. We can't do anything
+ at this time without recursing. Which would cause a GC at an
+ inappropriate time. */
+ struct cgraph_node *n = cgraph_node (fndecl);
+ n->next_needed = cgraph_analyze_queue;
+ cgraph_analyze_queue = n;
+}
+
#include "gt-cgraph.h"
extern bool cgraph_global_info_ready;
extern bool cgraph_function_flags_ready;
extern GTY(()) struct cgraph_node *cgraph_nodes_queue;
+extern GTY(()) struct cgraph_node *cgraph_analyze_queue;
extern GTY(()) struct cgraph_varpool_node *cgraph_varpool_first_unanalyzed_node;
extern GTY(()) struct cgraph_varpool_node *cgraph_varpool_nodes_queue;
enum availability cgraph_variable_initializer_availability (struct cgraph_varpool_node *);
bool cgraph_is_master_clone (struct cgraph_node *);
struct cgraph_node *cgraph_master_clone (struct cgraph_node *);
+void cgraph_add_new_function (tree);
/* In cgraphunit.c */
bool cgraph_assemble_pending_functions (void);
bool cgraph_varpool_assemble_pending_decls (void);
void cgraph_finalize_function (tree, bool);
-void cgraph_lower_function (struct cgraph_node *);
void cgraph_finalize_compilation_unit (void);
void cgraph_optimize (void);
void cgraph_mark_needed_node (struct cgraph_node *);
void init_cgraph (void);
struct cgraph_node *cgraph_function_versioning (struct cgraph_node *,
varray_type, varray_type);
+void cgraph_analyze_function (struct cgraph_node *);
struct cgraph_node *save_inline_function_body (struct cgraph_node *);
/* In ipa.c */
static void cgraph_mark_functions_to_output (void);
static void cgraph_expand_function (struct cgraph_node *);
static tree record_reference (tree *, int *, void *);
-static void cgraph_analyze_function (struct cgraph_node *node);
/* Records tree nodes seen in record_reference. Simply using
walk_tree_without_duplicates doesn't guarantee each node is visited
}
}
+static void
+cgraph_lower_function (struct cgraph_node *node)
+{
+ if (node->lowered)
+ return;
+ tree_lowering_passes (node->decl);
+ node->lowered = true;
+}
+
+static void
+cgraph_finalize_pending_functions (void)
+{
+ struct cgraph_node *next, *node = cgraph_analyze_queue;
+
+ cgraph_analyze_queue = NULL;
+ for (; node ; node = next)
+ {
+ next = node->next_needed;
+ node->next_needed = NULL;
+ cgraph_finalize_function (node->decl, true);
+ }
+}
+
/* DECL has been parsed. Take it, queue it, compile it at the whim of the
logic in effect. If NESTED is true, then our caller cannot stand to have
the garbage collector run at the moment. We would need to either create
if (!flag_unit_at_a_time)
{
cgraph_analyze_function (node);
+ cgraph_finalize_pending_functions ();
cgraph_decide_inlining_incrementally (node, false);
}
do_warn_unused_parameter (decl);
}
-void
-cgraph_lower_function (struct cgraph_node *node)
-{
- if (node->lowered)
- return;
- tree_lowering_passes (node->decl);
- node->lowered = true;
-}
-
/* Walk tree and record all calls. Called via walk_tree. */
static tree
record_reference (tree *tp, int *walk_subtrees, void *data)
}
/* Analyze the function scheduled to be output. */
-static void
+void
cgraph_analyze_function (struct cgraph_node *node)
{
tree decl = node->decl;
gcc_assert (DECL_SAVED_TREE (decl));
cgraph_analyze_function (node);
+ cgraph_finalize_pending_functions ();
for (edge = node->callees; edge; edge = edge->next_callee)
if (!edge->callee->reachable)
#define WINT_TYPE "int"
+/* Every program on darwin links against libSystem which contains the pthread
+ routines, so there's no need to explicitly call out when doing threaded
+ work. */
+#undef GOMP_SELF_SPECS
+#define GOMP_SELF_SPECS ""
+
#endif /* CONFIG_DARWIN_H */
extern void debug_generic_expr (tree);
extern void debug_generic_stmt (tree);
+extern void debug_tree_chain (tree);
extern void debug_c_tree (tree);
#endif /* ! GCC_DIAGNOSTIC_H */
-fargument-noalias-global -fleading-underscore @gol
-ftls-model=@var{model} @gol
-ftrapv -fwrapv -fbounds-check @gol
--fvisibility}
+-fvisibility -fopenmp}
@end table
@menu
some protection against outright memory corrupting writes, but allows
erroneously read data to propagate within a program.
+@item -fopenmp
+@opindex fopenmp
+@cindex openmp parallel
+Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
+@code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
+compiler generates parallel code according to the OpenMP Application
+Program Interface v2.5. To generate the final exectuable, the runtime
+library @code{libgomp} must be linked in using @option{-lgomp}.
+
@item -fstrength-reduce
@opindex fstrength-reduce
Perform the optimizations of loop strength reduction and
{
dw_loc_descr_ref ret, ret1;
int have_address = 0;
- int unsignedp = TYPE_UNSIGNED (TREE_TYPE (loc));
enum dwarf_location_atom op;
/* ??? Most of the time we do not take proper care for sign/zero
HOST_WIDE_INT bitsize, bitpos, bytepos;
enum machine_mode mode;
int volatilep;
+ int unsignedp = TYPE_UNSIGNED (TREE_TYPE (loc));
obj = get_inner_reference (loc, &bitsize, &bitpos, &offset, &mode,
&unsignedp, &volatilep, false);
goto do_binop;
case RSHIFT_EXPR:
- op = (unsignedp ? DW_OP_shr : DW_OP_shra);
+ op = (TYPE_UNSIGNED (TREE_TYPE (loc)) ? DW_OP_shr : DW_OP_shra);
goto do_binop;
case PLUS_EXPR:
static const char *if_exists_else_spec_function (int, const char **);
static const char *replace_outfile_spec_function (int, const char **);
static const char *version_compare_spec_function (int, const char **);
+static const char *include_spec_function (int, const char **);
\f
/* The Specs Language
%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
%(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
- %{static:} %{L*} %(mfwrap) %(link_libgcc) %o %(mflib)\
+ %{static:} %{L*} %(mfwrap) %{fopenmp:%:include(libgomp.spec)%(link_gomp)}\
+ %(link_libgcc) %o %(mflib)\
%{fprofile-arcs|fprofile-generate|coverage:-lgcov}\
%{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
%{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"
static const char *lib_spec = LIB_SPEC;
static const char *mfwrap_spec = MFWRAP_SPEC;
static const char *mflib_spec = MFLIB_SPEC;
+static const char *link_gomp_spec = "";
static const char *libgcc_spec = LIBGCC_SPEC;
static const char *endfile_spec = ENDFILE_SPEC;
static const char *startfile_spec = STARTFILE_SPEC;
#define DRIVER_SELF_SPECS ""
#endif
-static const char *const driver_self_specs[] = { DRIVER_SELF_SPECS };
+/* Adding -fopenmp should imply pthreads. This is particularly important
+ for targets that use different start files and suchlike. */
+#ifndef GOMP_SELF_SPECS
+#define GOMP_SELF_SPECS "%{fopenmp: -pthread}"
+#endif
+
+static const char *const driver_self_specs[] = {
+ DRIVER_SELF_SPECS, GOMP_SELF_SPECS
+};
#ifndef OPTION_DEFAULT_SPECS
#define OPTION_DEFAULT_SPECS { "", "" }
INIT_STATIC_SPEC ("lib", &lib_spec),
INIT_STATIC_SPEC ("mfwrap", &mfwrap_spec),
INIT_STATIC_SPEC ("mflib", &mflib_spec),
+ INIT_STATIC_SPEC ("link_gomp", &link_gomp_spec),
INIT_STATIC_SPEC ("libgcc", &libgcc_spec),
INIT_STATIC_SPEC ("startfile", &startfile_spec),
INIT_STATIC_SPEC ("switches_need_spaces", &switches_need_spaces),
{ "if-exists-else", if_exists_else_spec_function },
{ "replace-outfile", replace_outfile_spec_function },
{ "version-compare", version_compare_spec_function },
+ { "include", include_spec_function },
{ 0, 0 }
};
}
/* If there is a -V or -b option (or both), process it now, before
- trying to interpret the rest of the command line.
+ trying to interpret the rest of the command line.
Use heuristic that all configuration names must have at least
one dash '-'. This allows us to pass options starting with -b. */
if (argc > 1 && argv[1][0] == '-'
- && (argv[1][1] == 'V' ||
+ && (argv[1][1] == 'V' ||
((argv[1][1] == 'b') && (NULL != strchr(argv[1] + 2,'-')))))
{
const char *new_version = DEFAULT_TARGET_VERSION;
&& input_suffix[end_atom - atom] == '\0');
}
-/* Inline subroutine of handle_braces. Returns true if a switch
+/* Subroutine of handle_braces. Returns true if a switch
matching the atom bracketed by ATOM and END_ATOM appeared on the
command line. */
-static inline bool
+static bool
switch_matches (const char *atom, const char *end_atom, int starred)
{
int i;
if (combine_flag)
combine_inputs = true;
else
- combine_inputs = false;
+ combine_inputs = false;
for (i = 0; (int) i < n_infiles; i++)
{
infiles[i].compiled = false;
infiles[i].preprocessed = false;
}
-
+
if (!combine_inputs && have_c && have_o && lang_n_infiles > 1)
fatal ("cannot specify -o with -c or -S with multiple files");
return argv[nargs + 2];
}
+
+/* %:include builtin spec function. This differs from %include in that it
+ can be nested inside a spec, and thus be conditionalized. It takes
+ one argument, the filename, and looks for it in the startfile path.
+ The result is always NULL, i.e. an empty expansion. */
+
+static const char *
+include_spec_function (int argc, const char **argv)
+{
+ char *file;
+
+ if (argc != 1)
+ abort ();
+
+ file = find_a_file (&startfile_prefixes, argv[0], R_OK, 0);
+ read_specs (file ? file : argv[0], FALSE);
+
+ return NULL;
+}
gcc_assert (TREE_CODE (bind) == BIND_EXPR);
+ memset (&data, 0, sizeof (data));
data.block = DECL_INITIAL (current_function_decl);
BLOCK_SUBBLOCKS (data.block) = NULL_TREE;
BLOCK_CHAIN (data.block) = NULL_TREE;
TREE_ASM_WRITTEN (data.block) = 1;
- data.return_statements = NULL_TREE;
-
*body_p = alloc_stmt_list ();
i = tsi_start (*body_p);
tsi_link_after (&i, bind, TSI_NEW_STMT);
break;
default:
-#ifdef ENABLE_CHECKING
- print_node_brief (stderr, "", stmt, 0);
- internal_error ("unexpected node");
-#endif
- case COMPOUND_EXPR:
gcc_unreachable ();
}
#include "ggc.h"
#include "toplev.h"
#include "target.h"
+#include "optabs.h"
+#include "pointer-set.h"
-static struct gimplify_ctx
+
+enum gimplify_omp_var_data
+{
+ GOVD_SEEN = 1,
+ GOVD_EXPLICIT = 2,
+ GOVD_SHARED = 4,
+ GOVD_PRIVATE = 8,
+ GOVD_FIRSTPRIVATE = 16,
+ GOVD_LASTPRIVATE = 32,
+ GOVD_REDUCTION = 64,
+ GOVD_LOCAL = 128,
+ GOVD_DEBUG_PRIVATE = 256,
+ GOVD_DATA_SHARE_CLASS = (GOVD_SHARED | GOVD_PRIVATE | GOVD_FIRSTPRIVATE
+ | GOVD_LASTPRIVATE | GOVD_REDUCTION | GOVD_LOCAL)
+};
+
+struct gimplify_omp_ctx
{
+ struct gimplify_omp_ctx *outer_context;
+ splay_tree variables;
+ struct pointer_set_t *privatized_types;
+ location_t location;
+ enum omp_clause_default_kind default_kind;
+ bool is_parallel;
+};
+
+struct gimplify_ctx
+{
+ struct gimplify_ctx *prev_context;
+
tree current_bind_expr;
tree temps;
tree conditional_cleanups;
tree exit_label;
tree return_temp;
+
VEC(tree,heap) *case_labels;
/* The formal temporary table. Should this be persistent? */
htab_t temp_htab;
+
int conditions;
bool save_stack;
bool into_ssa;
-} *gimplify_ctxp;
+
+ /* When gimplifying combined omp parallel directives (omp parallel
+ loop and omp parallel sections), any prefix code needed to setup
+ the associated worksharing construct needs to be emitted in the
+ pre-queue of its parent parallel, otherwise the lowering process
+ will move that code to the child function. Similarly, we need to
+ move up to the gimplification context of the parent parallel
+ directive so temporaries are declared in the right context. */
+ tree *combined_pre_p;
+ struct gimplify_ctx *combined_ctxp;
+};
+
+static struct gimplify_ctx *gimplify_ctxp;
+static struct gimplify_omp_ctx *gimplify_omp_ctxp;
+
/* Formal (expression) temporary table handling: Multiple occurrences of
void
push_gimplify_context (void)
{
- gcc_assert (!gimplify_ctxp);
- gimplify_ctxp
- = (struct gimplify_ctx *) xcalloc (1, sizeof (struct gimplify_ctx));
+ struct gimplify_ctx *c;
+
+ c = (struct gimplify_ctx *) xcalloc (1, sizeof (struct gimplify_ctx));
+ c->prev_context = gimplify_ctxp;
if (optimize)
- gimplify_ctxp->temp_htab
- = htab_create (1000, gimple_tree_hash, gimple_tree_eq, free);
- else
- gimplify_ctxp->temp_htab = NULL;
+ c->temp_htab = htab_create (1000, gimple_tree_hash, gimple_tree_eq, free);
+
+ gimplify_ctxp = c;
}
/* Tear down a context for the gimplifier. If BODY is non-null, then
void
pop_gimplify_context (tree body)
{
+ struct gimplify_ctx *c = gimplify_ctxp;
tree t;
- gcc_assert (gimplify_ctxp && !gimplify_ctxp->current_bind_expr);
+ gcc_assert (c && !c->current_bind_expr);
+ gimplify_ctxp = c->prev_context;
- for (t = gimplify_ctxp->temps; t ; t = TREE_CHAIN (t))
+ for (t = c->temps; t ; t = TREE_CHAIN (t))
DECL_GIMPLE_FORMAL_TEMP_P (t) = 0;
if (body)
- declare_tmp_vars (gimplify_ctxp->temps, body);
+ declare_tmp_vars (c->temps, body);
else
- record_vars (gimplify_ctxp->temps);
-
-#if 0
- if (!quiet_flag && optimize)
- fprintf (stderr, " collisions: %f ",
- htab_collisions (gimplify_ctxp->temp_htab));
-#endif
+ record_vars (c->temps);
if (optimize)
- htab_delete (gimplify_ctxp->temp_htab);
- free (gimplify_ctxp);
- gimplify_ctxp = NULL;
+ htab_delete (c->temp_htab);
+ free (c);
}
static void
}
}
+/* A stable comparison routine for use with splay trees and DECLs. */
+
+static int
+splay_tree_compare_decl_uid (splay_tree_key xa, splay_tree_key xb)
+{
+ tree a = (tree) xa;
+ tree b = (tree) xb;
+
+ return DECL_UID (a) - DECL_UID (b);
+}
+
+/* Create a new omp construct that deals with variable remapping. */
+
+static struct gimplify_omp_ctx *
+new_omp_context (bool is_parallel)
+{
+ struct gimplify_omp_ctx *c;
+
+ c = XCNEW (struct gimplify_omp_ctx);
+ c->outer_context = gimplify_omp_ctxp;
+ c->variables = splay_tree_new (splay_tree_compare_decl_uid, 0, 0);
+ c->privatized_types = pointer_set_create ();
+ c->location = input_location;
+ c->is_parallel = is_parallel;
+ c->default_kind = OMP_CLAUSE_DEFAULT_SHARED;
+
+ return c;
+}
+
+/* Destroy an omp construct that deals with variable remapping. */
+
+static void
+delete_omp_context (struct gimplify_omp_ctx *c)
+{
+ splay_tree_delete (c->variables);
+ pointer_set_destroy (c->privatized_types);
+ XDELETE (c);
+}
+
+static void omp_add_variable (struct gimplify_omp_ctx *, tree, unsigned int);
+static bool omp_notice_variable (struct gimplify_omp_ctx *, tree, bool);
+
/* A subroutine of append_to_statement_list{,_force}. T is not NULL. */
static void
{
TREE_CHAIN (tmp) = gimplify_ctxp->temps;
gimplify_ctxp->temps = tmp;
+
+ /* Mark temporaries local within the nearest enclosing parallel. */
+ if (gimplify_omp_ctxp)
+ {
+ struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp;
+ while (ctx && !ctx->is_parallel)
+ ctx = ctx->outer_context;
+ if (ctx)
+ omp_add_variable (ctx, tmp, GOVD_LOCAL | GOVD_SEEN);
+ }
}
else if (cfun)
record_vars (tmp);
DECL_COMPLEX_GIMPLE_REG_P (t) = 1;
}
+ /* Mark variables seen in this bind expr as locals. */
+ if (gimplify_omp_ctxp)
+ {
+ struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp;
+
+ for (t = BIND_EXPR_VARS (bind_expr); t ; t = TREE_CHAIN (t))
+ if (TREE_CODE (t) == VAR_DECL && !is_global_var (t))
+ omp_add_variable (ctx, t, GOVD_LOCAL | GOVD_SEEN);
+ }
+
gimple_push_bind_expr (bind_expr);
gimplify_ctxp->save_stack = false;
gimplify_case_label_expr (tree *expr_p)
{
tree expr = *expr_p;
+ struct gimplify_ctx *ctxp;
+
+ /* Invalid OpenMP programs can play Duff's Device type games with
+ #pragma omp parallel. At least in the C front end, we don't
+ detect such invalid branches until after gimplification. */
+ for (ctxp = gimplify_ctxp; ; ctxp = ctxp->prev_context)
+ if (ctxp->case_labels)
+ break;
- gcc_assert (gimplify_ctxp->case_labels);
- VEC_safe_push (tree, heap, gimplify_ctxp->case_labels, expr);
+ VEC_safe_push (tree, heap, ctxp->case_labels, expr);
*expr_p = build1 (LABEL_EXPR, void_type_node, CASE_LABEL (expr));
return GS_ALL_DONE;
}
return GS_ERROR;
}
+ /* When within an OpenMP context, notice uses of variables. */
+ if (gimplify_omp_ctxp && omp_notice_variable (gimplify_omp_ctxp, decl, true))
+ return GS_ALL_DONE;
+
/* If the decl is an alias for another expression, substitute it now. */
if (DECL_HAS_VALUE_EXPR_P (decl))
{
}
}
+/* Gimplify *EXPR_P as if it had been used inside the gimplification
+ context CTX_P. The other arguments are as in gimplify_expr. */
+
+static enum gimplify_status
+gimplify_expr_in_ctx (tree *expr_p, tree *pre_p, tree *post_p,
+ bool (* gimple_test_f) (tree), fallback_t fallback,
+ struct gimplify_ctx *ctx_p,
+ struct gimplify_omp_ctx *omp_ctx_p)
+{
+ enum gimplify_status ret;
+ struct gimplify_ctx *prev_ctxp;
+ struct gimplify_omp_ctx *prev_omp_ctxp;
+
+ prev_ctxp = gimplify_ctxp;
+ gimplify_ctxp = ctx_p;
+ prev_omp_ctxp = gimplify_omp_ctxp;
+ gimplify_omp_ctxp = omp_ctx_p;
+ ret = gimplify_expr (expr_p, pre_p, post_p, gimple_test_f, fallback);
+ gimplify_ctxp = prev_ctxp;
+ gimplify_omp_ctxp = prev_omp_ctxp;
+
+ return ret;
+}
+
+/* Add FIRSTPRIVATE entries for DECL in the OpenMP the surrounding parallels
+ to CTX. If entries already exist, force them to be some flavor of private.
+ If there is no enclosing parallel, do nothing. */
+
+void
+omp_firstprivatize_variable (struct gimplify_omp_ctx *ctx, tree decl)
+{
+ splay_tree_node n;
+
+ if (decl == NULL || !DECL_P (decl))
+ return;
+
+ do
+ {
+ n = splay_tree_lookup (ctx->variables, (splay_tree_key)decl);
+ if (n != NULL)
+ {
+ if (n->value & GOVD_SHARED)
+ n->value = GOVD_FIRSTPRIVATE | (n->value & GOVD_SEEN);
+ else
+ return;
+ }
+ else if (ctx->is_parallel)
+ omp_add_variable (ctx, decl, GOVD_FIRSTPRIVATE);
+
+ ctx = ctx->outer_context;
+ }
+ while (ctx);
+}
+
+/* Similarly for each of the type sizes of TYPE. */
+
+static void
+omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *ctx, tree type)
+{
+ if (type == NULL || type == error_mark_node)
+ return;
+ type = TYPE_MAIN_VARIANT (type);
+
+ if (pointer_set_insert (ctx->privatized_types, type))
+ return;
+
+ switch (TREE_CODE (type))
+ {
+ case INTEGER_TYPE:
+ case ENUMERAL_TYPE:
+ case BOOLEAN_TYPE:
+ case CHAR_TYPE:
+ case REAL_TYPE:
+ omp_firstprivatize_variable (ctx, TYPE_MIN_VALUE (type));
+ omp_firstprivatize_variable (ctx, TYPE_MAX_VALUE (type));
+ break;
+
+ case ARRAY_TYPE:
+ omp_firstprivatize_type_sizes (ctx, TREE_TYPE (type));
+ omp_firstprivatize_type_sizes (ctx, TYPE_DOMAIN (type));
+ break;
+
+ case RECORD_TYPE:
+ case UNION_TYPE:
+ case QUAL_UNION_TYPE:
+ {
+ tree field;
+ for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
+ if (TREE_CODE (field) == FIELD_DECL)
+ {
+ omp_firstprivatize_variable (ctx, DECL_FIELD_OFFSET (field));
+ omp_firstprivatize_type_sizes (ctx, TREE_TYPE (field));
+ }
+ }
+ break;
+
+ case POINTER_TYPE:
+ case REFERENCE_TYPE:
+ omp_firstprivatize_type_sizes (ctx, TREE_TYPE (type));
+ break;
+
+ default:
+ break;
+ }
+
+ omp_firstprivatize_variable (ctx, TYPE_SIZE (type));
+ omp_firstprivatize_variable (ctx, TYPE_SIZE_UNIT (type));
+ lang_hooks.types.omp_firstprivatize_type_sizes (ctx, type);
+}
+
+/* Add an entry for DECL in the OpenMP context CTX with FLAGS. */
+
+static void
+omp_add_variable (struct gimplify_omp_ctx *ctx, tree decl, unsigned int flags)
+{
+ splay_tree_node n;
+ unsigned int nflags;
+ tree t;
+
+ if (decl == error_mark_node || TREE_TYPE (decl) == error_mark_node)
+ return;
+
+ /* Never elide decls whose type has TREE_ADDRESSABLE set. This means
+ there are constructors involved somewhere. */
+ if (TREE_ADDRESSABLE (TREE_TYPE (decl))
+ || TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl)))
+ flags |= GOVD_SEEN;
+
+ n = splay_tree_lookup (ctx->variables, (splay_tree_key)decl);
+ if (n != NULL)
+ {
+ /* We shouldn't be re-adding the decl with the same data
+ sharing class. */
+ gcc_assert ((n->value & GOVD_DATA_SHARE_CLASS & flags) == 0);
+ /* The only combination of data sharing classes we should see is
+ FIRSTPRIVATE and LASTPRIVATE. */
+ nflags = n->value | flags;
+ gcc_assert ((nflags & GOVD_DATA_SHARE_CLASS)
+ == (GOVD_FIRSTPRIVATE | GOVD_LASTPRIVATE));
+ n->value = nflags;
+ return;
+ }
+
+ /* When adding a variable-sized variable, we have to handle all sorts
+ of additional bits of data: the pointer replacement variable, and
+ the parameters of the type. */
+ if (!TREE_CONSTANT (DECL_SIZE (decl)))
+ {
+ /* Add the pointer replacement variable as PRIVATE if the variable
+ replacement is private, else FIRSTPRIVATE since we'll need the
+ address of the original variable either for SHARED, or for the
+ copy into or out of the context. */
+ if (!(flags & GOVD_LOCAL))
+ {
+ nflags = flags & GOVD_PRIVATE ? GOVD_PRIVATE : GOVD_FIRSTPRIVATE;
+ nflags |= flags & GOVD_SEEN;
+ t = DECL_VALUE_EXPR (decl);
+ gcc_assert (TREE_CODE (t) == INDIRECT_REF);
+ t = TREE_OPERAND (t, 0);
+ gcc_assert (DECL_P (t));
+ omp_add_variable (ctx, t, nflags);
+ }
+
+ /* Add all of the variable and type parameters (which should have
+ been gimplified to a formal temporary) as FIRSTPRIVATE. */
+ omp_firstprivatize_variable (ctx, DECL_SIZE_UNIT (decl));
+ omp_firstprivatize_variable (ctx, DECL_SIZE (decl));
+ omp_firstprivatize_type_sizes (ctx, TREE_TYPE (decl));
+
+ /* The variable-sized variable itself is never SHARED, only some form
+ of PRIVATE. The sharing would take place via the pointer variable
+ which we remapped above. */
+ if (flags & GOVD_SHARED)
+ flags = GOVD_PRIVATE | GOVD_DEBUG_PRIVATE
+ | (flags & (GOVD_SEEN | GOVD_EXPLICIT));
+
+ /* We're going to make use of the TYPE_SIZE_UNIT at least in the
+ alloca statement we generate for the variable, so make sure it
+ is available. This isn't automatically needed for the SHARED
+ case, since we won't be allocating local storage then. */
+ else
+ omp_notice_variable (ctx, TYPE_SIZE_UNIT (TREE_TYPE (decl)), true);
+ }
+ else if (lang_hooks.decls.omp_privatize_by_reference (decl))
+ {
+ gcc_assert ((flags & GOVD_LOCAL) == 0);
+ omp_firstprivatize_type_sizes (ctx, TREE_TYPE (decl));
+
+ /* Similar to the direct variable sized case above, we'll need the
+ size of references being privatized. */
+ if ((flags & GOVD_SHARED) == 0)
+ {
+ t = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (decl)));
+ if (!TREE_CONSTANT (t))
+ omp_notice_variable (ctx, t, true);
+ }
+ }
+
+ splay_tree_insert (ctx->variables, (splay_tree_key)decl, flags);
+}
+
+/* Record the fact that DECL was used within the OpenMP context CTX.
+ IN_CODE is true when real code uses DECL, and false when we should
+ merely emit default(none) errors. Return true if DECL is going to
+ be remapped and thus DECL shouldn't be gimplified into its
+ DECL_VALUE_EXPR (if any). */
+
+static bool
+omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code)
+{
+ splay_tree_node n;
+ unsigned flags = in_code ? GOVD_SEEN : 0;
+ bool ret = false, shared;
+
+ if (decl == error_mark_node || TREE_TYPE (decl) == error_mark_node)
+ return false;
+
+ /* Threadprivate variables are predetermined. */
+ if (is_global_var (decl))
+ {
+ if (DECL_THREAD_LOCAL_P (decl))
+ return false;
+
+ if (DECL_HAS_VALUE_EXPR_P (decl))
+ {
+ tree value = get_base_address (DECL_VALUE_EXPR (decl));
+
+ if (value && DECL_P (value) && DECL_THREAD_LOCAL_P (value))
+ return false;
+ }
+ }
+
+ n = splay_tree_lookup (ctx->variables, (splay_tree_key)decl);
+ if (n == NULL)
+ {
+ enum omp_clause_default_kind default_kind, kind;
+
+ if (!ctx->is_parallel)
+ goto do_outer;
+
+ /* ??? Some compiler-generated variables (like SAVE_EXPRs) could be
+ remapped firstprivate instead of shared. To some extent this is
+ addressed in omp_firstprivatize_type_sizes, but not effectively. */
+ default_kind = ctx->default_kind;
+ kind = lang_hooks.decls.omp_predetermined_sharing (decl);
+ if (kind != OMP_CLAUSE_DEFAULT_UNSPECIFIED)
+ default_kind = kind;
+
+ switch (default_kind)
+ {
+ case OMP_CLAUSE_DEFAULT_NONE:
+ error ("%qs not specified in enclosing parallel",
+ IDENTIFIER_POINTER (DECL_NAME (decl)));
+ error ("%Henclosing parallel", &ctx->location);
+ /* FALLTHRU */
+ case OMP_CLAUSE_DEFAULT_SHARED:
+ flags |= GOVD_SHARED;
+ break;
+ case OMP_CLAUSE_DEFAULT_PRIVATE:
+ flags |= GOVD_PRIVATE;
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
+ omp_add_variable (ctx, decl, flags);
+
+ shared = (flags & GOVD_SHARED) != 0;
+ ret = lang_hooks.decls.omp_disregard_value_expr (decl, shared);
+ goto do_outer;
+ }
+
+ shared = ((flags | n->value) & GOVD_SHARED) != 0;
+ ret = lang_hooks.decls.omp_disregard_value_expr (decl, shared);
+
+ /* If nothing changed, there's nothing left to do. */
+ if ((n->value & flags) == flags)
+ return ret;
+ flags |= n->value;
+ n->value = flags;
+
+ do_outer:
+ /* If the variable is private in the current context, then we don't
+ need to propagate anything to an outer context. */
+ if (flags & GOVD_PRIVATE)
+ return ret;
+ if (ctx->outer_context
+ && omp_notice_variable (ctx->outer_context, decl, in_code))
+ return true;
+ return ret;
+}
+
+/* Verify that DECL is private within CTX. If there's specific information
+ to the contrary in the innermost scope, generate an error. */
+
+static bool
+omp_is_private (struct gimplify_omp_ctx *ctx, tree decl)
+{
+ splay_tree_node n;
+
+ n = splay_tree_lookup (ctx->variables, (splay_tree_key)decl);
+ if (n != NULL)
+ {
+ if (n->value & GOVD_SHARED)
+ {
+ if (ctx == gimplify_omp_ctxp)
+ error ("iteration variable %qs should be private",
+ IDENTIFIER_POINTER (DECL_NAME (decl)));
+ n->value = GOVD_PRIVATE;
+ }
+ return true;
+ }
+
+ if (ctx->outer_context)
+ return omp_is_private (ctx->outer_context, decl);
+ else if (ctx->is_parallel)
+ return false;
+ else
+ return !is_global_var (decl);
+}
+
+/* Scan the OpenMP clauses in *LIST_P, installing mappings into a new
+ and previous omp contexts. */
+
+static void
+gimplify_scan_omp_clauses (tree *list_p, tree *pre_p, bool in_parallel)
+{
+ struct gimplify_omp_ctx *ctx, *outer_ctx;
+ tree c;
+
+ ctx = new_omp_context (in_parallel);
+ outer_ctx = ctx->outer_context;
+
+ while ((c = *list_p) != NULL)
+ {
+ enum gimplify_status gs;
+ bool remove = false;
+ bool notice_outer = true;
+ unsigned int flags;
+ tree decl;
+
+ switch (TREE_CODE (c))
+ {
+ case OMP_CLAUSE_PRIVATE:
+ flags = GOVD_PRIVATE | GOVD_EXPLICIT;
+ notice_outer = false;
+ goto do_add;
+ case OMP_CLAUSE_SHARED:
+ flags = GOVD_SHARED | GOVD_EXPLICIT;
+ goto do_add;
+ case OMP_CLAUSE_FIRSTPRIVATE:
+ flags = GOVD_FIRSTPRIVATE | GOVD_EXPLICIT;
+ goto do_add;
+ case OMP_CLAUSE_LASTPRIVATE:
+ flags = GOVD_LASTPRIVATE | GOVD_SEEN | GOVD_EXPLICIT;
+ goto do_add;
+ case OMP_CLAUSE_REDUCTION:
+ flags = GOVD_REDUCTION | GOVD_SEEN | GOVD_EXPLICIT;
+ goto do_add;
+
+ do_add:
+ decl = OMP_CLAUSE_DECL (c);
+ if (decl == error_mark_node || TREE_TYPE (decl) == error_mark_node)
+ {
+ remove = true;
+ break;
+ }
+ omp_add_variable (ctx, decl, flags);
+ if (TREE_CODE (c) == OMP_CLAUSE_REDUCTION
+ && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
+ {
+ omp_add_variable (ctx, OMP_CLAUSE_REDUCTION_PLACEHOLDER (c),
+ GOVD_LOCAL);
+ gimplify_omp_ctxp = ctx;
+ push_gimplify_context ();
+ gimplify_stmt (&OMP_CLAUSE_REDUCTION_INIT (c));
+ pop_gimplify_context (OMP_CLAUSE_REDUCTION_INIT (c));
+ push_gimplify_context ();
+ gimplify_stmt (&OMP_CLAUSE_REDUCTION_MERGE (c));
+ pop_gimplify_context (OMP_CLAUSE_REDUCTION_MERGE (c));
+ gimplify_omp_ctxp = outer_ctx;
+ }
+ if (notice_outer)
+ goto do_notice;
+ break;
+
+ case OMP_CLAUSE_COPYIN:
+ case OMP_CLAUSE_COPYPRIVATE:
+ decl = OMP_CLAUSE_DECL (c);
+ if (decl == error_mark_node || TREE_TYPE (decl) == error_mark_node)
+ {
+ remove = true;
+ break;
+ }
+ do_notice:
+ if (outer_ctx)
+ omp_notice_variable (outer_ctx, decl, true);
+ break;
+
+ case OMP_CLAUSE_SCHEDULE:
+ if (gimplify_ctxp->combined_pre_p)
+ {
+ gcc_assert (gimplify_omp_ctxp == outer_ctx);
+ gs = gimplify_expr_in_ctx (&OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (c),
+ gimplify_ctxp->combined_pre_p, NULL,
+ is_gimple_val, fb_rvalue,
+ gimplify_ctxp->combined_ctxp,
+ outer_ctx->outer_context);
+ if (gs == GS_ERROR)
+ remove = true;
+ break;
+ }
+ /* FALLTHRU */
+ case OMP_CLAUSE_IF:
+ case OMP_CLAUSE_NUM_THREADS:
+ gs = gimplify_expr (&TREE_OPERAND (c, 0), pre_p, NULL,
+ is_gimple_val, fb_rvalue);
+ if (gs == GS_ERROR)
+ remove = true;
+ break;
+
+ case OMP_CLAUSE_NOWAIT:
+ case OMP_CLAUSE_ORDERED:
+ break;
+
+ case OMP_CLAUSE_DEFAULT:
+ ctx->default_kind = OMP_CLAUSE_DEFAULT_KIND (c);
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+
+ if (remove)
+ *list_p = OMP_CLAUSE_CHAIN (c);
+ else
+ list_p = &OMP_CLAUSE_CHAIN (c);
+ }
+
+ gimplify_omp_ctxp = ctx;
+}
+
+/* For all variables that were not actually used within the context,
+ remove PRIVATE, SHARED, and FIRSTPRIVATE clauses. */
+
+static int
+gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data)
+{
+ tree *list_p = (tree *) data;
+ tree decl = (tree) n->key;
+ unsigned flags = n->value;
+ enum tree_code code;
+ tree clause;
+ bool private_debug;
+
+ if (flags & (GOVD_EXPLICIT | GOVD_LOCAL))
+ return 0;
+ if ((flags & GOVD_SEEN) == 0)
+ return 0;
+ if (flags & GOVD_DEBUG_PRIVATE)
+ {
+ gcc_assert ((flags & GOVD_DATA_SHARE_CLASS) == GOVD_PRIVATE);
+ private_debug = true;
+ }
+ else
+ private_debug
+ = lang_hooks.decls.omp_private_debug_clause (decl,
+ !!(flags & GOVD_SHARED));
+ if (private_debug)
+ code = OMP_CLAUSE_PRIVATE;
+ else if (flags & GOVD_SHARED)
+ {
+ if (is_global_var (decl))
+ return 0;
+ code = OMP_CLAUSE_SHARED;
+ }
+ else if (flags & GOVD_PRIVATE)
+ code = OMP_CLAUSE_PRIVATE;
+ else if (flags & GOVD_FIRSTPRIVATE)
+ code = OMP_CLAUSE_FIRSTPRIVATE;
+ else
+ gcc_unreachable ();
+
+ clause = build1 (code, void_type_node, decl);
+ OMP_CLAUSE_CHAIN (clause) = *list_p;
+ if (private_debug)
+ OMP_CLAUSE_PRIVATE_DEBUG (clause) = 1;
+ *list_p = clause;
+
+ return 0;
+}
+
+static void
+gimplify_adjust_omp_clauses (tree *list_p)
+{
+ struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp;
+ tree c, decl;
+
+ while ((c = *list_p) != NULL)
+ {
+ splay_tree_node n;
+ bool remove = false;
+
+ switch (TREE_CODE (c))
+ {
+ case OMP_CLAUSE_PRIVATE:
+ case OMP_CLAUSE_SHARED:
+ case OMP_CLAUSE_FIRSTPRIVATE:
+ decl = OMP_CLAUSE_DECL (c);
+ n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl);
+ remove = !(n->value & GOVD_SEEN);
+ if (! remove)
+ {
+ bool shared = TREE_CODE (c) == OMP_CLAUSE_SHARED;
+ if ((n->value & GOVD_DEBUG_PRIVATE)
+ || lang_hooks.decls.omp_private_debug_clause (decl, shared))
+ {
+ gcc_assert ((n->value & GOVD_DEBUG_PRIVATE) == 0
+ || ((n->value & GOVD_DATA_SHARE_CLASS)
+ == GOVD_PRIVATE));
+ TREE_SET_CODE (c, OMP_CLAUSE_PRIVATE);
+ OMP_CLAUSE_PRIVATE_DEBUG (c) = 1;
+ }
+ }
+ break;
+
+ case OMP_CLAUSE_LASTPRIVATE:
+ /* Make sure OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE is set to
+ accurately reflect the presence of a FIRSTPRIVATE clause. */
+ decl = OMP_CLAUSE_DECL (c);
+ n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl);
+ OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE (c)
+ = (n->value & GOVD_FIRSTPRIVATE) != 0;
+ break;
+
+ case OMP_CLAUSE_REDUCTION:
+ case OMP_CLAUSE_COPYIN:
+ case OMP_CLAUSE_COPYPRIVATE:
+ case OMP_CLAUSE_IF:
+ case OMP_CLAUSE_NUM_THREADS:
+ case OMP_CLAUSE_SCHEDULE:
+ case OMP_CLAUSE_NOWAIT:
+ case OMP_CLAUSE_ORDERED:
+ case OMP_CLAUSE_DEFAULT:
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+
+ if (remove)
+ *list_p = OMP_CLAUSE_CHAIN (c);
+ else
+ list_p = &OMP_CLAUSE_CHAIN (c);
+ }
+
+ /* Add in any implicit data sharing. */
+ splay_tree_foreach (ctx->variables, gimplify_adjust_omp_clauses_1, list_p);
+
+ gimplify_omp_ctxp = ctx->outer_context;
+ delete_omp_context (ctx);
+}
+
+/* Gimplify the contents of an OMP_PARALLEL statement. This involves
+ gimplification of the body, as well as scanning the body for used
+ variables. We need to do this scan now, because variable-sized
+ decls will be decomposed during gimplification. */
+
+static enum gimplify_status
+gimplify_omp_parallel (tree *expr_p, tree *pre_p)
+{
+ tree expr = *expr_p;
+
+ gimplify_scan_omp_clauses (&OMP_PARALLEL_CLAUSES (expr), pre_p, true);
+
+ push_gimplify_context ();
+
+ if (determine_parallel_type (expr) == IS_COMBINED_PARALLEL)
+ {
+ gimplify_ctxp->combined_pre_p = pre_p;
+ gimplify_ctxp->combined_ctxp = gimplify_ctxp->prev_context;
+ }
+
+ gimplify_stmt (&OMP_PARALLEL_BODY (expr));
+ pop_gimplify_context (OMP_PARALLEL_BODY (expr));
+
+ gimplify_ctxp->combined_pre_p = NULL;
+ gimplify_ctxp->combined_ctxp = NULL;
+
+ gimplify_adjust_omp_clauses (&OMP_PARALLEL_CLAUSES (expr));
+
+ return GS_ALL_DONE;
+}
+
+/* Gimplify the gross structure of an OMP_FOR statement. */
+
+static enum gimplify_status
+gimplify_omp_for (tree *expr_p, tree *pre_p)
+{
+ tree for_stmt, decl, t;
+ enum gimplify_status ret = 0;
+ struct gimplify_omp_ctx *outer_combined_omp_ctxp = NULL;
+
+ for_stmt = *expr_p;
+
+ if (gimplify_ctxp->combined_pre_p)
+ outer_combined_omp_ctxp = gimplify_omp_ctxp->outer_context;
+
+ gimplify_scan_omp_clauses (&OMP_FOR_CLAUSES (for_stmt), pre_p, false);
+
+ t = OMP_FOR_INIT (for_stmt);
+ gcc_assert (TREE_CODE (t) == MODIFY_EXPR);
+ decl = TREE_OPERAND (t, 0);
+ gcc_assert (DECL_P (decl));
+ gcc_assert (INTEGRAL_TYPE_P (TREE_TYPE (decl)));
+ gcc_assert (!TYPE_UNSIGNED (TREE_TYPE (decl)));
+
+ /* Make sure the iteration variable is private. */
+ if (omp_is_private (gimplify_omp_ctxp, decl))
+ omp_notice_variable (gimplify_omp_ctxp, decl, true);
+ else
+ omp_add_variable (gimplify_omp_ctxp, decl, GOVD_PRIVATE | GOVD_SEEN);
+
+ /* Gimplify inside our parent's context if this is part of a combined
+ parallel+workshare directive. */
+ if (gimplify_ctxp->combined_pre_p)
+ ret |= gimplify_expr_in_ctx (&TREE_OPERAND (t, 1),
+ gimplify_ctxp->combined_pre_p, NULL,
+ is_gimple_val, fb_rvalue,
+ gimplify_ctxp->combined_ctxp,
+ outer_combined_omp_ctxp);
+ else
+ ret |= gimplify_expr (&TREE_OPERAND (t, 1), &OMP_FOR_PRE_BODY (for_stmt),
+ NULL, is_gimple_val, fb_rvalue);
+
+ t = OMP_FOR_COND (for_stmt);
+ gcc_assert (COMPARISON_CLASS_P (t));
+ gcc_assert (TREE_OPERAND (t, 0) == decl);
+
+ /* Gimplify inside our parent's context if this is part of a combined
+ parallel+workshare directive. */
+ if (gimplify_ctxp->combined_pre_p)
+ ret |= gimplify_expr_in_ctx (&TREE_OPERAND (t, 1),
+ gimplify_ctxp->combined_pre_p, NULL,
+ is_gimple_val, fb_rvalue,
+ gimplify_ctxp->combined_ctxp,
+ outer_combined_omp_ctxp);
+ else
+ ret |= gimplify_expr (&TREE_OPERAND (t, 1), &OMP_FOR_PRE_BODY (for_stmt),
+ NULL, is_gimple_val, fb_rvalue);
+
+ t = OMP_FOR_INCR (for_stmt);
+ switch (TREE_CODE (t))
+ {
+ case PREINCREMENT_EXPR:
+ case POSTINCREMENT_EXPR:
+ t = build_int_cst (TREE_TYPE (decl), 1);
+ goto build_modify;
+ case PREDECREMENT_EXPR:
+ case POSTDECREMENT_EXPR:
+ t = build_int_cst (TREE_TYPE (decl), -1);
+ goto build_modify;
+ build_modify:
+ t = build2 (PLUS_EXPR, TREE_TYPE (decl), decl, t);
+ t = build2 (MODIFY_EXPR, void_type_node, decl, t);
+ OMP_FOR_INCR (for_stmt) = t;
+ break;
+
+ case MODIFY_EXPR:
+ gcc_assert (TREE_OPERAND (t, 0) == decl);
+ t = TREE_OPERAND (t, 1);
+ switch (TREE_CODE (t))
+ {
+ case PLUS_EXPR:
+ if (TREE_OPERAND (t, 1) == decl)
+ {
+ TREE_OPERAND (t, 1) = TREE_OPERAND (t, 0);
+ TREE_OPERAND (t, 0) = decl;
+ break;
+ }
+ case MINUS_EXPR:
+ gcc_assert (TREE_OPERAND (t, 0) == decl);
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
+ /* Gimplify inside our parent's context if this is part of a
+ combined parallel+workshare directive. */
+ if (gimplify_ctxp->combined_pre_p)
+ ret |= gimplify_expr_in_ctx (&TREE_OPERAND (t, 1),
+ gimplify_ctxp->combined_pre_p, NULL,
+ is_gimple_val, fb_rvalue,
+ gimplify_ctxp->combined_ctxp,
+ outer_combined_omp_ctxp);
+ else
+ ret |= gimplify_expr (&TREE_OPERAND (t, 1),
+ &OMP_FOR_PRE_BODY (for_stmt), NULL,
+ is_gimple_val, fb_rvalue);
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+
+ gimplify_to_stmt_list (&OMP_FOR_BODY (for_stmt));
+ gimplify_adjust_omp_clauses (&OMP_FOR_CLAUSES (for_stmt));
+
+ return ret == GS_ALL_DONE ? GS_ALL_DONE : GS_ERROR;
+}
+
+/* Gimplify the gross structure of other OpenMP worksharing constructs.
+ In particular, OMP_SECTIONS and OMP_SINGLE. */
+
+static enum gimplify_status
+gimplify_omp_workshare (tree *expr_p, tree *pre_p)
+{
+ tree stmt = *expr_p;
+
+ gimplify_scan_omp_clauses (&OMP_CLAUSES (stmt), pre_p, false);
+ gimplify_to_stmt_list (&OMP_BODY (stmt));
+ gimplify_adjust_omp_clauses (&OMP_CLAUSES (stmt));
+
+ return GS_ALL_DONE;
+}
+
+/* A subroutine of gimplify_omp_atomic. The front end is supposed to have
+ stabilized the lhs of the atomic operation as *ADDR. Return true if
+ EXPR is this stabilized form. */
+
+static bool
+goa_lhs_expr_p (tree expr, tree addr)
+{
+ /* Also include casts to other type variants. The C front end is fond
+ of adding these for e.g. volatile variables. This is like
+ STRIP_TYPE_NOPS but includes the main variant lookup. */
+ while ((TREE_CODE (expr) == NOP_EXPR
+ || TREE_CODE (expr) == CONVERT_EXPR
+ || TREE_CODE (expr) == NON_LVALUE_EXPR)
+ && TREE_OPERAND (expr, 0) != error_mark_node
+ && (TYPE_MAIN_VARIANT (TREE_TYPE (expr))
+ == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (expr, 0)))))
+ expr = TREE_OPERAND (expr, 0);
+
+ if (TREE_CODE (expr) == INDIRECT_REF && TREE_OPERAND (expr, 0) == addr)
+ return true;
+ if (TREE_CODE (addr) == ADDR_EXPR && expr == TREE_OPERAND (addr, 0))
+ return true;
+ return false;
+}
+
+/* A subroutine of gimplify_omp_atomic. Attempt to implement the atomic
+ operation as a __sync_fetch_and_op builtin. INDEX is log2 of the
+ size of the data type, and thus usable to find the index of the builtin
+ decl. Returns GS_UNHANDLED if the expression is not of the proper form. */
+
+static enum gimplify_status
+gimplify_omp_atomic_fetch_op (tree *expr_p, tree addr, tree rhs, int index)
+{
+ enum built_in_function base;
+ tree decl, args, itype;
+ enum insn_code *optab;
+
+ /* Check for one of the supported fetch-op operations. */
+ switch (TREE_CODE (rhs))
+ {
+ case PLUS_EXPR:
+ base = BUILT_IN_FETCH_AND_ADD_N;
+ optab = sync_add_optab;
+ break;
+ case MINUS_EXPR:
+ base = BUILT_IN_FETCH_AND_SUB_N;
+ optab = sync_add_optab;
+ break;
+ case BIT_AND_EXPR:
+ base = BUILT_IN_FETCH_AND_AND_N;
+ optab = sync_and_optab;
+ break;
+ case BIT_IOR_EXPR:
+ base = BUILT_IN_FETCH_AND_OR_N;
+ optab = sync_ior_optab;
+ break;
+ case BIT_XOR_EXPR:
+ base = BUILT_IN_FETCH_AND_XOR_N;
+ optab = sync_xor_optab;
+ break;
+ default:
+ return GS_UNHANDLED;
+ }
+
+ /* Make sure the expression is of the proper form. */
+ if (goa_lhs_expr_p (TREE_OPERAND (rhs, 0), addr))
+ rhs = TREE_OPERAND (rhs, 1);
+ else if (commutative_tree_code (TREE_CODE (rhs))
+ && goa_lhs_expr_p (TREE_OPERAND (rhs, 1), addr))
+ rhs = TREE_OPERAND (rhs, 0);
+ else
+ return GS_UNHANDLED;
+
+ decl = built_in_decls[base + index + 1];
+ itype = TREE_TYPE (TREE_TYPE (decl));
+
+ if (optab[TYPE_MODE (itype)] == CODE_FOR_nothing)
+ return GS_UNHANDLED;
+
+ args = tree_cons (NULL, fold_convert (itype, rhs), NULL);
+ args = tree_cons (NULL, addr, args);
+ *expr_p = build_function_call_expr (decl, args);
+ return GS_OK;
+}
+
+/* A subroutine of gimplify_omp_atomic_pipeline. Walk *EXPR_P and replace
+ appearences of *LHS_ADDR with LHS_VAR. If an expression does not involve
+ the lhs, evaluate it into a temporary. Return 1 if the lhs appeared as
+ a subexpression, 0 if it did not, or -1 if an error was encountered. */
+
+static int
+goa_stabilize_expr (tree *expr_p, tree *pre_p, tree lhs_addr, tree lhs_var)
+{
+ tree expr = *expr_p;
+ int saw_lhs;
+
+ if (goa_lhs_expr_p (expr, lhs_addr))
+ {
+ *expr_p = lhs_var;
+ return 1;
+ }
+ if (is_gimple_val (expr))
+ return 0;
+
+ saw_lhs = 0;
+ switch (TREE_CODE_CLASS (TREE_CODE (expr)))
+ {
+ case tcc_binary:
+ saw_lhs |= goa_stabilize_expr (&TREE_OPERAND (expr, 1), pre_p,
+ lhs_addr, lhs_var);
+ case tcc_unary:
+ saw_lhs |= goa_stabilize_expr (&TREE_OPERAND (expr, 0), pre_p,
+ lhs_addr, lhs_var);
+ break;
+ default:
+ break;
+ }
+
+ if (saw_lhs == 0)
+ {
+ enum gimplify_status gs;
+ gs = gimplify_expr (expr_p, pre_p, NULL, is_gimple_val, fb_rvalue);
+ if (gs != GS_ALL_DONE)
+ saw_lhs = -1;
+ }
+
+ return saw_lhs;
+}
+
+/* A subroutine of gimplify_omp_atomic. Implement the atomic operation as:
+
+ oldval = *addr;
+ repeat:
+ newval = rhs; // with oldval replacing *addr in rhs
+ oldval = __sync_val_compare_and_swap (addr, oldval, newval);
+ if (oldval != newval)
+ goto repeat;
+
+ INDEX is log2 of the size of the data type, and thus usable to find the
+ index of the builtin decl. */
+
+static enum gimplify_status
+gimplify_omp_atomic_pipeline (tree *expr_p, tree *pre_p, tree addr,
+ tree rhs, int index)
+{
+ tree oldval, oldival, oldival2, newval, newival, label;
+ tree type, itype, cmpxchg, args, x, iaddr;
+
+ cmpxchg = built_in_decls[BUILT_IN_VAL_COMPARE_AND_SWAP_N + index + 1];
+ type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (addr)));
+ itype = TREE_TYPE (TREE_TYPE (cmpxchg));
+
+ if (sync_compare_and_swap[TYPE_MODE (itype)] == CODE_FOR_nothing)
+ return GS_UNHANDLED;
+
+ oldval = create_tmp_var (type, NULL);
+ newval = create_tmp_var (type, NULL);
+
+ /* Precompute as much of RHS as possible. In the same walk, replace
+ occurrences of the lhs value with our temporary. */
+ if (goa_stabilize_expr (&rhs, pre_p, addr, oldval) < 0)
+ return GS_ERROR;
+
+ x = build_fold_indirect_ref (addr);
+ x = build2 (MODIFY_EXPR, void_type_node, oldval, x);
+ gimplify_and_add (x, pre_p);
+
+ /* For floating-point values, we'll need to view-convert them to integers
+ so that we can perform the atomic compare and swap. Simplify the
+ following code by always setting up the "i"ntegral variables. */
+ if (INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type))
+ {
+ oldival = oldval;
+ newival = newval;
+ iaddr = addr;
+ }
+ else
+ {
+ oldival = create_tmp_var (itype, NULL);
+ newival = create_tmp_var (itype, NULL);
+
+ x = build1 (VIEW_CONVERT_EXPR, itype, oldval);
+ x = build2 (MODIFY_EXPR, void_type_node, oldival, x);
+ gimplify_and_add (x, pre_p);
+ iaddr = fold_convert (build_pointer_type (itype), addr);
+ }
+
+ oldival2 = create_tmp_var (itype, NULL);
+
+ label = create_artificial_label ();
+ x = build1 (LABEL_EXPR, void_type_node, label);
+ gimplify_and_add (x, pre_p);
+
+ x = build2 (MODIFY_EXPR, void_type_node, newval, rhs);
+ gimplify_and_add (x, pre_p);
+
+ if (newval != newival)
+ {
+ x = build1 (VIEW_CONVERT_EXPR, itype, newval);
+ x = build2 (MODIFY_EXPR, void_type_node, newival, x);
+ gimplify_and_add (x, pre_p);
+ }
+
+ x = build2 (MODIFY_EXPR, void_type_node, oldival2, oldival);
+ gimplify_and_add (x, pre_p);
+
+ args = tree_cons (NULL, fold_convert (itype, newival), NULL);
+ args = tree_cons (NULL, fold_convert (itype, oldival), args);
+ args = tree_cons (NULL, iaddr, args);
+ x = build_function_call_expr (cmpxchg, args);
+ if (oldval == oldival)
+ x = fold_convert (type, x);
+ x = build2 (MODIFY_EXPR, void_type_node, oldival, x);
+ gimplify_and_add (x, pre_p);
+
+ /* For floating point, be prepared for the loop backedge. */
+ if (oldval != oldival)
+ {
+ x = build1 (VIEW_CONVERT_EXPR, type, oldival);
+ x = build2 (MODIFY_EXPR, void_type_node, oldval, x);
+ gimplify_and_add (x, pre_p);
+ }
+
+ /* Note that we always perform the comparison as an integer, even for
+ floating point. This allows the atomic operation to properly
+ succeed even with NaNs and -0.0. */
+ x = build3 (COND_EXPR, void_type_node,
+ build2 (NE_EXPR, boolean_type_node, oldival, oldival2),
+ build1 (GOTO_EXPR, void_type_node, label), NULL);
+ gimplify_and_add (x, pre_p);
+
+ *expr_p = NULL;
+ return GS_ALL_DONE;
+}
+
+/* A subroutine of gimplify_omp_atomic. Implement the atomic operation as:
+
+ GOMP_atomic_start ();
+ *addr = rhs;
+ GOMP_atomic_end ();
+
+ The result is not globally atomic, but works so long as all parallel
+ references are within #pragma omp atomic directives. According to
+ responses received from omp@openmp.org, appears to be within spec.
+ Which makes sense, since that's how several other compilers handle
+ this situation as well. */
+
+static enum gimplify_status
+gimplify_omp_atomic_mutex (tree *expr_p, tree *pre_p, tree addr, tree rhs)
+{
+ tree t;
+
+ t = built_in_decls[BUILT_IN_GOMP_ATOMIC_START];
+ t = build_function_call_expr (t, NULL);
+ gimplify_and_add (t, pre_p);
+
+ t = build_fold_indirect_ref (addr);
+ t = build2 (MODIFY_EXPR, void_type_node, t, rhs);
+ gimplify_and_add (t, pre_p);
+
+ t = built_in_decls[BUILT_IN_GOMP_ATOMIC_END];
+ t = build_function_call_expr (t, NULL);
+ gimplify_and_add (t, pre_p);
+
+ *expr_p = NULL;
+ return GS_ALL_DONE;
+}
+
+/* Gimplify an OMP_ATOMIC statement. */
+
+static enum gimplify_status
+gimplify_omp_atomic (tree *expr_p, tree *pre_p)
+{
+ tree addr = TREE_OPERAND (*expr_p, 0);
+ tree rhs = TREE_OPERAND (*expr_p, 1);
+ tree type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (addr)));
+ HOST_WIDE_INT index;
+
+ /* Make sure the type is one of the supported sizes. */
+ index = tree_low_cst (TYPE_SIZE_UNIT (type), 1);
+ index = exact_log2 (index);
+ if (index >= 0 && index <= 4)
+ {
+ enum gimplify_status gs;
+ unsigned int align;
+
+ if (DECL_P (TREE_OPERAND (addr, 0)))
+ align = DECL_ALIGN_UNIT (TREE_OPERAND (addr, 0));
+ else if (TREE_CODE (TREE_OPERAND (addr, 0)) == COMPONENT_REF
+ && TREE_CODE (TREE_OPERAND (TREE_OPERAND (addr, 0), 1))
+ == FIELD_DECL)
+ align = DECL_ALIGN_UNIT (TREE_OPERAND (TREE_OPERAND (addr, 0), 1));
+ else
+ align = TYPE_ALIGN_UNIT (type);
+
+ /* __sync builtins require strict data alignment. */
+ if (exact_log2 (align) >= index)
+ {
+ /* When possible, use specialized atomic update functions. */
+ if (INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type))
+ {
+ gs = gimplify_omp_atomic_fetch_op (expr_p, addr, rhs, index);
+ if (gs != GS_UNHANDLED)
+ return gs;
+ }
+
+ /* If we don't have specialized __sync builtins, try and implement
+ as a compare and swap loop. */
+ gs = gimplify_omp_atomic_pipeline (expr_p, pre_p, addr, rhs, index);
+ if (gs != GS_UNHANDLED)
+ return gs;
+ }
+ }
+
+ /* The ultimate fallback is wrapping the operation in a mutex. */
+ return gimplify_omp_atomic_mutex (expr_p, pre_p, addr, rhs);
+}
/* Gimplifies the expression tree pointed to by EXPR_P. Return 0 if
gimplification failed.
ret = GS_ALL_DONE;
break;
+ case OMP_PARALLEL:
+ ret = gimplify_omp_parallel (expr_p, pre_p);
+ break;
+
+ case OMP_FOR:
+ ret = gimplify_omp_for (expr_p, pre_p);
+ break;
+
+ case OMP_SECTIONS:
+ case OMP_SINGLE:
+ ret = gimplify_omp_workshare (expr_p, pre_p);
+ break;
+
+ case OMP_SECTION:
+ case OMP_MASTER:
+ case OMP_ORDERED:
+ case OMP_CRITICAL:
+ gimplify_to_stmt_list (&OMP_BODY (*expr_p));
+ break;
+
+ case OMP_ATOMIC:
+ ret = gimplify_omp_atomic (expr_p, pre_p);
+ break;
+
default:
switch (TREE_CODE_CLASS (TREE_CODE (*expr_p)))
{
tree body, parm_stmts;
timevar_push (TV_TREE_GIMPLIFY);
+
+ gcc_assert (gimplify_ctxp == NULL);
push_gimplify_context ();
/* Unshare most shared trees in the body and in that of any nested functions.
*body_p = body;
pop_gimplify_context (body);
+ gcc_assert (gimplify_ctxp == NULL);
#ifdef ENABLE_CHECKING
walk_tree (body_p, check_pointer_types_r, NULL, NULL);
}
bool
+hook_bool_tree_bool_false (tree a ATTRIBUTE_UNUSED, bool b ATTRIBUTE_UNUSED)
+{
+ return false;
+}
+
+bool
hook_bool_rtx_false (rtx a ATTRIBUTE_UNUSED)
{
return false;
return NULL;
}
+tree
+hook_tree_tree_tree_null (tree t0 ATTRIBUTE_UNUSED, tree t1 ATTRIBUTE_UNUSED)
+{
+ return NULL;
+}
+
/* Generic hook that takes a rtx and returns a NULL string. */
const char *
hook_constcharptr_rtx_null (rtx r ATTRIBUTE_UNUSED)
extern bool hook_bool_rtx_int_int_intp_false (rtx, int, int, int *);
extern bool hook_bool_constcharptr_size_t_false (const char *, size_t);
extern bool hook_bool_size_t_constcharptr_int_true (size_t, const char *, int);
+extern bool hook_bool_tree_tree_false (tree, tree);
+extern bool hook_bool_tree_bool_false (tree, bool);
extern void hook_void_void (void);
extern void hook_void_constcharptr (const char *);
extern int hook_int_size_t_constcharptr_int_0 (size_t, const char *, int);
extern int hook_int_void_no_regs (void);
+extern tree hook_tree_tree_tree_null (tree, tree);
+extern tree hook_tree_tree_tree_tree_3rd_identity (tree, tree, tree);
+extern tree hook_tree_tree_tree_bool_null (tree, tree, bool);
+
extern unsigned hook_uint_uint_constcharptrptr_0 (unsigned, const char **);
extern bool default_can_output_mi_thunk_no_vcall (tree, HOST_WIDE_INT,
HOST_WIDE_INT, tree);
-extern bool hook_bool_tree_tree_false (tree, tree);
-
extern rtx hook_rtx_rtx_identity (rtx);
extern rtx hook_rtx_rtx_null (rtx);
extern rtx hook_rtx_tree_int_null (tree, int);
-extern tree hook_tree_tree_tree_tree_3rd_identity (tree, tree, tree);
+
extern const char *hook_constcharptr_tree_null (tree);
-extern tree hook_tree_tree_tree_bool_null (tree, tree, bool);
extern const char *hook_constcharptr_rtx_null (rtx);
extern const char *hook_constcharptr_tree_tree_null (tree, tree);
extern const char *hook_constcharptr_int_tree_null (int, tree);
/* Declarations for tree gimplification hooks. */
extern int lhd_gimplify_expr (tree *, tree *, tree *);
+extern enum omp_clause_default_kind lhd_omp_predetermined_sharing (tree);
+extern tree lhd_omp_assignment (tree, tree, tree);
+struct gimplify_omp_ctx;
+extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
+ tree);
#define LANG_HOOKS_NAME "GNU unknown"
#define LANG_HOOKS_IDENTIFIER_SIZE sizeof (struct lang_identifier)
#define LANG_HOOKS_TYPE_PROMOTES_TO lhd_type_promotes_to
#define LANG_HOOKS_REGISTER_BUILTIN_TYPE lhd_register_builtin_type
#define LANG_HOOKS_TYPE_MAX_SIZE lhd_return_null_tree
+#define LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES \
+ lhd_omp_firstprivatize_type_sizes
#define LANG_HOOKS_HASH_TYPES true
#define LANG_HOOKS_FOR_TYPES_INITIALIZER { \
LANG_HOOKS_REGISTER_BUILTIN_TYPE, \
LANG_HOOKS_INCOMPLETE_TYPE_ERROR, \
LANG_HOOKS_TYPE_MAX_SIZE, \
+ LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES, \
LANG_HOOKS_HASH_TYPES \
}
#define LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE NULL
#define LANG_HOOKS_DECL_OK_FOR_SIBCALL lhd_decl_ok_for_sibcall
#define LANG_HOOKS_COMDAT_GROUP lhd_comdat_group
+#define LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE hook_bool_tree_false
+#define LANG_HOOKS_OMP_PREDETERMINED_SHARING lhd_omp_predetermined_sharing
+#define LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR hook_bool_tree_bool_false
+#define LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE hook_bool_tree_bool_false
+#define LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR hook_tree_tree_tree_null
+#define LANG_HOOKS_OMP_CLAUSE_COPY_CTOR lhd_omp_assignment
+#define LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP lhd_omp_assignment
+#define LANG_HOOKS_OMP_CLAUSE_DTOR hook_tree_tree_tree_null
#define LANG_HOOKS_DECLS { \
LANG_HOOKS_GLOBAL_BINDINGS_P, \
LANG_HOOKS_WRITE_GLOBALS, \
LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE, \
LANG_HOOKS_DECL_OK_FOR_SIBCALL, \
- LANG_HOOKS_COMDAT_GROUP \
+ LANG_HOOKS_COMDAT_GROUP, \
+ LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE, \
+ LANG_HOOKS_OMP_PREDETERMINED_SHARING, \
+ LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR, \
+ LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE, \
+ LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR, \
+ LANG_HOOKS_OMP_CLAUSE_COPY_CTOR, \
+ LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP, \
+ LANG_HOOKS_OMP_CLAUSE_DTOR \
}
/* The whole thing. The structure is defined in langhooks.h. */
{
return expr;
}
+
+/* Return sharing kind if OpenMP sharing attribute of DECL is
+ predetermined, OMP_CLAUSE_DEFAULT_UNSPECIFIED otherwise. */
+
+enum omp_clause_default_kind
+lhd_omp_predetermined_sharing (tree decl ATTRIBUTE_UNUSED)
+{
+ if (DECL_ARTIFICIAL (decl))
+ return OMP_CLAUSE_DEFAULT_SHARED;
+ return OMP_CLAUSE_DEFAULT_UNSPECIFIED;
+}
+
+/* Generate code to copy SRC to DST. */
+
+tree
+lhd_omp_assignment (tree clause ATTRIBUTE_UNUSED, tree dst, tree src)
+{
+ return build2 (MODIFY_EXPR, void_type_node, dst, src);
+}
+
+/* Register language specific type size variables as potentially OpenMP
+ firstprivate variables. */
+
+void
+lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *c ATTRIBUTE_UNUSED,
+ tree t ATTRIBUTE_UNUSED)
+{
+}
struct diagnostic_context;
+struct gimplify_omp_ctx;
+
/* A print hook for print_tree (). */
typedef void (*lang_print_tree_hook) (FILE *, tree, int indent);
for a type. */
tree (*max_size) (tree);
+ /* Register language specific type size variables as potentially OpenMP
+ firstprivate variables. */
+ void (*omp_firstprivatize_type_sizes) (struct gimplify_omp_ctx *, tree);
+
/* Nonzero if types that are identical are to be hashed so that only
one copy is kept. If a language requires unique types for each
user-specified type, such as Ada, this should be set to TRUE. */
value will be the string already stored in an
IDENTIFIER_NODE.) */
const char * (*comdat_group) (tree);
+
+ /* True if OpenMP should privatize what this DECL points to rather
+ than the DECL itself. */
+ bool (*omp_privatize_by_reference) (tree);
+
+ /* Return sharing kind if OpenMP sharing attribute of DECL is
+ predetermined, OMP_CLAUSE_DEFAULT_UNSPECIFIED otherwise. */
+ enum omp_clause_default_kind (*omp_predetermined_sharing) (tree);
+
+ /* Return true if DECL's DECL_VALUE_EXPR (if any) should be
+ disregarded in OpenMP construct, because it is going to be
+ remapped during OpenMP lowering. SHARED is true if DECL
+ is going to be shared, false if it is going to be privatized. */
+ bool (*omp_disregard_value_expr) (tree, bool);
+
+ /* Return true if DECL that is shared iff SHARED is true should
+ be put into OMP_CLAUSE_PRIVATE_DEBUG. */
+ bool (*omp_private_debug_clause) (tree, bool);
+
+ /* Build and return code for a default constructor for DECL in
+ response to CLAUSE. Return NULL if nothing to be done. */
+ tree (*omp_clause_default_ctor) (tree clause, tree decl);
+
+ /* Build and return code for a copy constructor from SRC to DST. */
+ tree (*omp_clause_copy_ctor) (tree clause, tree dst, tree src);
+
+ /* Similarly, except use an assignment operator instead. */
+ tree (*omp_clause_assign_op) (tree clause, tree dst, tree src);
+
+ /* Build and return code destructing DECL. Return NULL if nothing
+ to be done. */
+ tree (*omp_clause_dtor) (tree clause, tree decl);
};
/* Language-specific hooks. See langhooks-def.h for defaults. */
--- /dev/null
+/* This file contains the definitions and documentation for the
+ OpenMP builtins used in the GNU compiler.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC 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 2, or (at your option) any later
+version.
+
+GCC 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 COPYING. If not, write to the Free
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA. */
+
+/* Before including this file, you should define a macro:
+
+ DEF_GOMP_BUILTIN (ENUM, NAME, TYPE, ATTRS)
+
+ See builtins.def for details. */
+
+DEF_GOMP_BUILTIN (BUILT_IN_OMP_GET_THREAD_NUM, "omp_get_thread_num",
+ BT_FN_INT, ATTR_CONST_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_OMP_GET_NUM_THREADS, "omp_get_num_threads",
+ BT_FN_INT, ATTR_CONST_NOTHROW_LIST)
+
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_ATOMIC_START, "GOMP_atomic_start",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_ATOMIC_END, "GOMP_atomic_end",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_BARRIER, "GOMP_barrier",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_CRITICAL_START, "GOMP_critical_start",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_CRITICAL_END, "GOMP_critical_end",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_CRITICAL_NAME_START,
+ "GOMP_critical_name_start",
+ BT_FN_VOID_PTRPTR, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_CRITICAL_NAME_END,
+ "GOMP_critical_name_end",
+ BT_FN_VOID_PTRPTR, ATTR_NOTHROW_LIST)
+/* NOTE: Do not change the order of BUILT_IN_GOMP_LOOP_*_START. They
+ are used in index arithmetic with enum omp_clause_schedule_kind
+ in omp-low.c. */
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_STATIC_START,
+ "GOMP_loop_static_start",
+ BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_DYNAMIC_START,
+ "GOMP_loop_dynamic_start",
+ BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_GUIDED_START,
+ "GOMP_loop_guided_start",
+ BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_RUNTIME_START,
+ "GOMP_loop_runtime_start",
+ BT_FN_BOOL_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_STATIC_START,
+ "GOMP_loop_ordered_static_start",
+ BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_DYNAMIC_START,
+ "GOMP_loop_ordered_dynamic_start",
+ BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_GUIDED_START,
+ "GOMP_loop_ordered_guided_start",
+ BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_RUNTIME_START,
+ "GOMP_loop_ordered_runtime_start",
+ BT_FN_BOOL_LONG_LONG_LONG_LONGPTR_LONGPTR,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_STATIC_NEXT, "GOMP_loop_static_next",
+ BT_FN_BOOL_LONGPTR_LONGPTR, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_DYNAMIC_NEXT, "GOMP_loop_dynamic_next",
+ BT_FN_BOOL_LONGPTR_LONGPTR, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_GUIDED_NEXT, "GOMP_loop_guided_next",
+ BT_FN_BOOL_LONGPTR_LONGPTR, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_RUNTIME_NEXT, "GOMP_loop_runtime_next",
+ BT_FN_BOOL_LONGPTR_LONGPTR, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_STATIC_NEXT,
+ "GOMP_loop_ordered_static_next",
+ BT_FN_BOOL_LONGPTR_LONGPTR, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_DYNAMIC_NEXT,
+ "GOMP_loop_ordered_dynamic_next",
+ BT_FN_BOOL_LONGPTR_LONGPTR, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_GUIDED_NEXT,
+ "GOMP_loop_ordered_guided_next",
+ BT_FN_BOOL_LONGPTR_LONGPTR, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_RUNTIME_NEXT,
+ "GOMP_loop_ordered_runtime_next",
+ BT_FN_BOOL_LONGPTR_LONGPTR, ATTR_NOTHROW_LIST)
+/* NOTE: Do not change the order of BUILT_IN_GOMP_PARALLEL_LOOP_*_START.
+ They are used in index arithmetic with enum omp_clause_schedule_kind
+ in omp-low.c. */
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START,
+ "GOMP_parallel_loop_static_start",
+ BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC_START,
+ "GOMP_parallel_loop_dynamic_start",
+ BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED_START,
+ "GOMP_parallel_loop_guided_start",
+ BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME_START,
+ "GOMP_parallel_loop_runtime_start",
+ BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG,
+ ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_END, "GOMP_loop_end",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_END_NOWAIT, "GOMP_loop_end_nowait",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_ORDERED_START, "GOMP_ordered_start",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_ORDERED_END, "GOMP_ordered_end",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_START, "GOMP_parallel_start",
+ BT_FN_VOID_OMPFN_PTR_UINT, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_END, "GOMP_parallel_end",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_SECTIONS_START, "GOMP_sections_start",
+ BT_FN_UINT_UINT, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_SECTIONS_NEXT, "GOMP_sections_next",
+ BT_FN_UINT, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_SECTIONS_START,
+ "GOMP_parallel_sections_start",
+ BT_FN_VOID_OMPFN_PTR_UINT_UINT, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_SECTIONS_END, "GOMP_sections_end",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_SECTIONS_END_NOWAIT,
+ "GOMP_sections_end_nowait",
+ BT_FN_VOID, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_SINGLE_START, "GOMP_single_start",
+ BT_FN_BOOL, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_SINGLE_COPY_START, "GOMP_single_copy_start",
+ BT_FN_PTR, ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_SINGLE_COPY_END, "GOMP_single_copy_end",
+ BT_FN_VOID_PTR, ATTR_NOTHROW_LIST)
--- /dev/null
+/* Lowering pass for OpenMP directives. Converts OpenMP directives
+ into explicit calls to the runtime library (libgomp) and data
+ marshalling to implement data sharing and copying clauses.
+ Contributed by Diego Novillo <dnovillo@redhat.com>
+
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC 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 2, or (at your option) any later
+version.
+
+GCC 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 COPYING. If not, write to the Free
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "rtl.h"
+#include "tree-gimple.h"
+#include "tree-inline.h"
+#include "langhooks.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "timevar.h"
+#include "flags.h"
+#include "function.h"
+#include "expr.h"
+#include "toplev.h"
+#include "tree-pass.h"
+#include "ggc.h"
+#include "except.h"
+
+
+/* Lowering of OpenMP parallel and workshare constructs proceeds in two
+ phases. The first phase scans the function looking for OMP statements
+ and then for variables that must be replaced to satisfy data sharing
+ clauses. The second phase expands code for the constructs, as well as
+ re-gimplifing things when variables have been replaced with complex
+ expressions.
+
+ Lowering of a parallel statement results in the contents of the
+ parallel being moved to a new function, to be invoked by the thread
+ library. The variable remapping process is complex enough that only
+ one level of parallel statement is handled at one time. If there are
+ nested parallel statements, those nested statements are handled when
+ the new function is lowered and optimized. The result is not 100%
+ optimal, but lexically nested parallels effectively only happens in
+ test suites. */
+
+/* Context structure. Used to store information about each parallel
+ directive in the code. */
+
+typedef struct omp_context
+{
+ /* This field must be at the beginning, as we do "inheritance": Some
+ callback functions for tree-inline.c (e.g., omp_copy_decl)
+ receive a copy_body_data pointer that is up-casted to an
+ omp_context pointer. */
+ copy_body_data cb;
+
+ /* The tree of contexts corresponding to the encountered constructs. */
+ struct omp_context *outer;
+ tree stmt;
+
+ /* Map variables to fields in a structure that allows communication
+ between sending and receiving threads. */
+ splay_tree field_map;
+ tree record_type;
+ tree sender_decl;
+ tree receiver_decl;
+
+ /* A chain of variables to add to the top-level block surrounding the
+ construct. In the case of a parallel, this is in the child function. */
+ tree block_vars;
+
+ /* What to do with variables with implicitly determined sharing
+ attributes. */
+ enum omp_clause_default_kind default_kind;
+
+ /* Nesting depth of this context. Used to beautify error messages re
+ invalid gotos. The outermost ctx is depth 1, with depth 0 being
+ reserved for the main body of the function. */
+ int depth;
+
+ /* Type of parallel construct. Used to distinguish regular parallel
+ regions from combined parallel+workshare directives (parallel,
+ parallel loop and parallel sections). */
+ enum omp_parallel_type parallel_type;
+
+ /* True if this parallel directive is nested within another. */
+ bool is_nested;
+
+ /* For combined parallel constructs, the built-in index for the
+ library call used to launch the children threads. */
+ int parallel_start_ix;
+
+ /* If the combined parallel directive needs additional arguments for
+ the call to GOMP_parallel_start_foo, they are added here. */
+ tree parallel_start_additional_args;
+} omp_context;
+
+
+/* A structure describing the main elements of a parallel loop.
+ Mostly used to communicate between the various subroutines of
+ expand_omp_for_1. */
+
+struct expand_omp_for_data
+{
+ tree v, n1, n2, step, chunk_size, for_stmt;
+ enum tree_code cond_code;
+ tree pre;
+ omp_context *ctx;
+ bool have_nowait, have_ordered;
+ enum omp_clause_schedule_kind sched_kind;
+};
+
+static splay_tree all_contexts;
+static int parallel_nesting_level;
+
+static void scan_omp (tree *, omp_context *);
+static void expand_omp (tree *, omp_context *);
+
+
+/* Find an OpenMP clause of type KIND within CLAUSES. */
+
+tree
+find_omp_clause (tree clauses, enum tree_code kind)
+{
+ for (; clauses ; clauses = OMP_CLAUSE_CHAIN (clauses))
+ if (TREE_CODE (clauses) == kind)
+ return clauses;
+
+ return NULL_TREE;
+}
+
+/* Return true if CTX is for an omp parallel. */
+
+static inline bool
+is_parallel_ctx (omp_context *ctx)
+{
+ return ctx->parallel_type != IS_NOT_PARALLEL;
+}
+
+/* Return true if CTX is inside a combined omp parallel + workshare. */
+
+static inline bool
+is_in_combined_parallel_ctx (omp_context *ctx)
+{
+ return ctx->outer && ctx->outer->parallel_type == IS_COMBINED_PARALLEL;
+}
+
+/* Return true if EXPR is variable sized. */
+
+static inline bool
+is_variable_sized (tree expr)
+{
+ return !TREE_CONSTANT (TYPE_SIZE_UNIT (TREE_TYPE (expr)));
+}
+
+/* Return true if DECL is a reference type. */
+
+static inline bool
+is_reference (tree decl)
+{
+ return lang_hooks.decls.omp_privatize_by_reference (decl);
+}
+
+/* Lookup variables in the decl or field splay trees. The "maybe" form
+ allows for the variable form to not have been entered, otherwise we
+ assert that the variable must have been entered. */
+
+static inline tree
+lookup_decl (tree var, omp_context *ctx)
+{
+ splay_tree_node n;
+ n = splay_tree_lookup (ctx->cb.decl_map, (splay_tree_key) var);
+ return (tree) n->value;
+}
+
+static inline tree
+maybe_lookup_decl (tree var, omp_context *ctx)
+{
+ splay_tree_node n;
+ n = splay_tree_lookup (ctx->cb.decl_map, (splay_tree_key) var);
+ return n ? (tree) n->value : NULL_TREE;
+}
+
+static inline tree
+lookup_field (tree var, omp_context *ctx)
+{
+ splay_tree_node n;
+ n = splay_tree_lookup (ctx->field_map, (splay_tree_key) var);
+ return (tree) n->value;
+}
+
+static inline tree
+maybe_lookup_field (tree var, omp_context *ctx)
+{
+ splay_tree_node n;
+ n = splay_tree_lookup (ctx->field_map, (splay_tree_key) var);
+ return n ? (tree) n->value : NULL_TREE;
+}
+
+/* Return true if DECL should be copied by pointer. SHARED_P is true
+ if DECL is to be shared. */
+
+static bool
+use_pointer_for_field (tree decl, bool shared_p)
+{
+ if (AGGREGATE_TYPE_P (TREE_TYPE (decl)))
+ return true;
+
+ /* We can only use copy-in/copy-out semantics for shared varibles
+ when we know the value is not accessible from an outer scope. */
+ if (shared_p)
+ {
+ /* ??? Trivially accessible from anywhere. But why would we even
+ be passing an address in this case? Should we simply assert
+ this to be false, or should we have a cleanup pass that removes
+ these from the list of mappings? */
+ if (TREE_STATIC (decl) || DECL_EXTERNAL (decl))
+ return true;
+
+ /* For variables with DECL_HAS_VALUE_EXPR_P set, we cannot tell
+ without analyzing the expression whether or not its location
+ is accessible to anyone else. In the case of nested parallel
+ regions it certainly may be. */
+ if (DECL_HAS_VALUE_EXPR_P (decl))
+ return true;
+
+ /* Do not use copy-in/copy-out for variables that have their
+ address taken. */
+ if (TREE_ADDRESSABLE (decl))
+ return true;
+ }
+
+ return false;
+}
+
+/* Construct a new automatic decl similar to VAR. */
+
+static tree
+omp_copy_decl_2 (tree var, tree name, tree type, omp_context *ctx)
+{
+ tree copy = build_decl (VAR_DECL, name, type);
+
+ TREE_ADDRESSABLE (copy) = TREE_ADDRESSABLE (var);
+ DECL_COMPLEX_GIMPLE_REG_P (copy) = DECL_COMPLEX_GIMPLE_REG_P (var);
+ DECL_ARTIFICIAL (copy) = DECL_ARTIFICIAL (var);
+ DECL_IGNORED_P (copy) = DECL_IGNORED_P (var);
+ TREE_USED (copy) = 1;
+ DECL_CONTEXT (copy) = ctx->cb.dst_fn;
+ DECL_SEEN_IN_BIND_EXPR_P (copy) = 1;
+
+ TREE_CHAIN (copy) = ctx->block_vars;
+ ctx->block_vars = copy;
+
+ return copy;
+}
+
+static tree
+omp_copy_decl_1 (tree var, omp_context *ctx)
+{
+ return omp_copy_decl_2 (var, DECL_NAME (var), TREE_TYPE (var), ctx);
+}
+
+/* Build tree nodes to access the field for VAR on the receiver side. */
+
+static tree
+build_receiver_ref (tree var, bool by_ref, omp_context *ctx)
+{
+ tree x, field = lookup_field (var, ctx);
+
+ /* If the receiver record type was remapped in the child function,
+ remap the field into the new record type. */
+ x = maybe_lookup_field (field, ctx);
+ if (x != NULL)
+ field = x;
+
+ x = build_fold_indirect_ref (ctx->receiver_decl);
+ x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL);
+ if (by_ref)
+ x = build_fold_indirect_ref (x);
+
+ return x;
+}
+
+/* Build tree nodes to access VAR in the scope outer to CTX. In the case
+ of a parallel, this is a component reference; for workshare constructs
+ this is some variable. */
+
+static tree
+build_outer_var_ref (tree var, omp_context *ctx)
+{
+ tree x;
+
+ if (is_global_var (var))
+ x = var;
+ else if (is_variable_sized (var))
+ {
+ x = TREE_OPERAND (DECL_VALUE_EXPR (var), 0);
+ x = build_outer_var_ref (x, ctx);
+ x = build_fold_indirect_ref (x);
+ }
+ else if (is_parallel_ctx (ctx))
+ {
+ bool by_ref = use_pointer_for_field (var, false);
+ x = build_receiver_ref (var, by_ref, ctx);
+ }
+ else if (ctx->outer)
+ x = lookup_decl (var, ctx->outer);
+ else
+ gcc_unreachable ();
+
+ if (is_reference (var))
+ x = build_fold_indirect_ref (x);
+
+ return x;
+}
+
+/* Build tree nodes to access the field for VAR on the sender side. */
+
+static tree
+build_sender_ref (tree var, omp_context *ctx)
+{
+ tree field = lookup_field (var, ctx);
+ return build3 (COMPONENT_REF, TREE_TYPE (field),
+ ctx->sender_decl, field, NULL);
+}
+
+/* Add a new field for VAR inside the structure CTX->SENDER_DECL. */
+
+static void
+install_var_field (tree var, bool by_ref, omp_context *ctx)
+{
+ tree field, type;
+
+ gcc_assert (!splay_tree_lookup (ctx->field_map, (splay_tree_key) var));
+
+ type = TREE_TYPE (var);
+ if (by_ref)
+ type = build_pointer_type (type);
+
+ field = build_decl (FIELD_DECL, DECL_NAME (var), type);
+
+ /* Remember what variable this field was created for. This does have a
+ side effect of making dwarf2out ignore this member, so for helpful
+ debugging we clear it later in delete_omp_context. */
+ DECL_ABSTRACT_ORIGIN (field) = var;
+
+ insert_field_into_struct (ctx->record_type, field);
+
+ splay_tree_insert (ctx->field_map, (splay_tree_key) var,
+ (splay_tree_value) field);
+}
+
+static tree
+install_var_local (tree var, omp_context *ctx)
+{
+ tree new_var = omp_copy_decl_1 (var, ctx);
+ insert_decl_map (&ctx->cb, var, new_var);
+ return new_var;
+}
+
+/* Adjust the replacement for DECL in CTX for the new context. This means
+ copying the DECL_VALUE_EXPR, and fixing up the type. */
+
+static void
+fixup_remapped_decl (tree decl, omp_context *ctx, bool private_debug)
+{
+ tree new_decl, size;
+
+ new_decl = lookup_decl (decl, ctx);
+
+ TREE_TYPE (new_decl) = remap_type (TREE_TYPE (decl), &ctx->cb);
+
+ if ((!TREE_CONSTANT (DECL_SIZE (new_decl)) || private_debug)
+ && DECL_HAS_VALUE_EXPR_P (decl))
+ {
+ tree ve = DECL_VALUE_EXPR (decl);
+ walk_tree (&ve, copy_body_r, &ctx->cb, NULL);
+ SET_DECL_VALUE_EXPR (new_decl, ve);
+ DECL_HAS_VALUE_EXPR_P (new_decl) = 1;
+ }
+
+ if (!TREE_CONSTANT (DECL_SIZE (new_decl)))
+ {
+ size = remap_decl (DECL_SIZE (decl), &ctx->cb);
+ if (size == error_mark_node)
+ size = TYPE_SIZE (TREE_TYPE (new_decl));
+ DECL_SIZE (new_decl) = size;
+
+ size = remap_decl (DECL_SIZE_UNIT (decl), &ctx->cb);
+ if (size == error_mark_node)
+ size = TYPE_SIZE_UNIT (TREE_TYPE (new_decl));
+ DECL_SIZE_UNIT (new_decl) = size;
+ }
+}
+
+/* The callback for remap_decl. Search all containing contexts for a
+ mapping of the variable; this avoids having to duplicate the splay
+ tree ahead of time. We know a mapping doesn't already exist in the
+ given context. Create new mappings to implement default semantics. */
+
+static tree
+omp_copy_decl (tree var, copy_body_data *cb)
+{
+ omp_context *ctx = (omp_context *) cb;
+ tree new_var;
+
+ if (is_global_var (var) || decl_function_context (var) != ctx->cb.src_fn)
+ return var;
+
+ if (TREE_CODE (var) == LABEL_DECL)
+ {
+ new_var = create_artificial_label ();
+ DECL_CONTEXT (new_var) = ctx->cb.dst_fn;
+ insert_decl_map (&ctx->cb, var, new_var);
+ return new_var;
+ }
+
+ while (!is_parallel_ctx (ctx))
+ {
+ ctx = ctx->outer;
+ if (ctx == NULL)
+ return var;
+ new_var = maybe_lookup_decl (var, ctx);
+ if (new_var)
+ return new_var;
+ }
+
+ return error_mark_node;
+}
+
+/* Create a new context, with OUTER_CTX being the surrounding context. */
+
+static omp_context *
+new_omp_context (tree stmt, omp_context *outer_ctx)
+{
+ omp_context *ctx = XCNEW (omp_context);
+
+ splay_tree_insert (all_contexts, (splay_tree_key) stmt,
+ (splay_tree_value) ctx);
+ ctx->stmt = stmt;
+
+ if (outer_ctx)
+ {
+ ctx->outer = outer_ctx;
+ ctx->cb = outer_ctx->cb;
+ ctx->cb.block = NULL;
+ ctx->depth = outer_ctx->depth + 1;
+ }
+ else
+ {
+ ctx->cb.src_fn = current_function_decl;
+ ctx->cb.dst_fn = current_function_decl;
+ ctx->cb.src_node = cgraph_node (current_function_decl);
+ ctx->cb.dst_node = ctx->cb.src_node;
+ ctx->cb.src_cfun = cfun;
+ ctx->cb.copy_decl = omp_copy_decl;
+ ctx->cb.eh_region = -1;
+ ctx->cb.transform_call_graph_edges = CB_CGE_MOVE;
+ ctx->depth = 1;
+ }
+
+ ctx->cb.decl_map = splay_tree_new (splay_tree_compare_pointers, 0, 0);
+
+ return ctx;
+}
+
+/* Destroy a omp_context data structures. Called through the splay tree
+ value delete callback. */
+
+static void
+delete_omp_context (splay_tree_value value)
+{
+ omp_context *ctx = (omp_context *) value;
+
+ splay_tree_delete (ctx->cb.decl_map);
+
+ if (ctx->field_map)
+ splay_tree_delete (ctx->field_map);
+
+ /* We hijacked DECL_ABSTRACT_ORIGIN earlier. We need to clear it before
+ it produces corrupt debug information. */
+ if (ctx->record_type)
+ {
+ tree t;
+ for (t = TYPE_FIELDS (ctx->record_type); t ; t = TREE_CHAIN (t))
+ DECL_ABSTRACT_ORIGIN (t) = NULL;
+ }
+
+ XDELETE (ctx);
+}
+
+/* Fix up RECEIVER_DECL with a type that has been remapped to the child
+ context. */
+
+static void
+fixup_child_record_type (omp_context *ctx)
+{
+ tree f, type = ctx->record_type;
+
+ /* ??? It isn't sufficient to just call remap_type here, because
+ variably_modified_type_p doesn't work the way we expect for
+ record types. Testing each field for whether it needs remapping
+ and creating a new record by hand works, however. */
+ for (f = TYPE_FIELDS (type); f ; f = TREE_CHAIN (f))
+ if (variably_modified_type_p (TREE_TYPE (f), ctx->cb.src_fn))
+ break;
+ if (f)
+ {
+ tree name, new_fields = NULL;
+
+ type = lang_hooks.types.make_type (RECORD_TYPE);
+ name = DECL_NAME (TYPE_NAME (ctx->record_type));
+ name = build_decl (TYPE_DECL, name, type);
+ TYPE_NAME (type) = name;
+
+ for (f = TYPE_FIELDS (ctx->record_type); f ; f = TREE_CHAIN (f))
+ {
+ tree new_f = copy_node (f);
+ DECL_CONTEXT (new_f) = type;
+ TREE_TYPE (new_f) = remap_type (TREE_TYPE (f), &ctx->cb);
+ TREE_CHAIN (new_f) = new_fields;
+ new_fields = new_f;
+
+ /* Arrange to be able to look up the receiver field
+ given the sender field. */
+ splay_tree_insert (ctx->field_map, (splay_tree_key) f,
+ (splay_tree_value) new_f);
+ }
+ TYPE_FIELDS (type) = nreverse (new_fields);
+ layout_type (type);
+ }
+
+ TREE_TYPE (ctx->receiver_decl) = build_pointer_type (type);
+}
+
+/* Instantiate decls as necessary in CTX to satisfy the data sharing
+ specified by CLAUSES. */
+
+static void
+scan_sharing_clauses (tree clauses, omp_context *ctx)
+{
+ tree c, decl;
+ bool scan_array_reductions = false;
+
+ for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c))
+ {
+ bool by_ref;
+
+ switch (TREE_CODE (c))
+ {
+ case OMP_CLAUSE_PRIVATE:
+ decl = OMP_CLAUSE_DECL (c);
+ if (!is_variable_sized (decl))
+ install_var_local (decl, ctx);
+ break;
+
+ case OMP_CLAUSE_SHARED:
+ gcc_assert (is_parallel_ctx (ctx));
+ decl = OMP_CLAUSE_DECL (c);
+ gcc_assert (!is_variable_sized (decl));
+ by_ref = use_pointer_for_field (decl, true);
+ if (! TREE_READONLY (decl)
+ || TREE_ADDRESSABLE (decl)
+ || by_ref
+ || is_reference (decl))
+ {
+ install_var_field (decl, by_ref, ctx);
+ install_var_local (decl, ctx);
+ break;
+ }
+ /* We don't need to copy const scalar vars back. */
+ TREE_SET_CODE (c, OMP_CLAUSE_FIRSTPRIVATE);
+ goto do_private;
+
+ case OMP_CLAUSE_LASTPRIVATE:
+ /* Let the corresponding firstprivate clause create
+ the variable. */
+ if (OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE (c))
+ break;
+ /* FALLTHRU */
+
+ case OMP_CLAUSE_FIRSTPRIVATE:
+ case OMP_CLAUSE_REDUCTION:
+ decl = OMP_CLAUSE_DECL (c);
+ do_private:
+ if (is_variable_sized (decl))
+ break;
+ else if (is_parallel_ctx (ctx))
+ {
+ by_ref = use_pointer_for_field (decl, false);
+ install_var_field (decl, by_ref, ctx);
+ }
+ install_var_local (decl, ctx);
+ break;
+
+ case OMP_CLAUSE_COPYPRIVATE:
+ if (ctx->outer)
+ scan_omp (&OMP_CLAUSE_DECL (c), ctx->outer);
+ /* FALLTHRU */
+
+ case OMP_CLAUSE_COPYIN:
+ decl = OMP_CLAUSE_DECL (c);
+ by_ref = use_pointer_for_field (decl, false);
+ install_var_field (decl, by_ref, ctx);
+ break;
+
+ case OMP_CLAUSE_DEFAULT:
+ ctx->default_kind = OMP_CLAUSE_DEFAULT_KIND (c);
+ break;
+
+ case OMP_CLAUSE_IF:
+ case OMP_CLAUSE_NUM_THREADS:
+ case OMP_CLAUSE_SCHEDULE:
+ if (ctx->outer)
+ scan_omp (&TREE_OPERAND (c, 0), ctx->outer);
+ break;
+
+ case OMP_CLAUSE_NOWAIT:
+ case OMP_CLAUSE_ORDERED:
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+ }
+
+ for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c))
+ {
+ switch (TREE_CODE (c))
+ {
+ case OMP_CLAUSE_LASTPRIVATE:
+ /* Let the corresponding firstprivate clause create
+ the variable. */
+ if (OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE (c))
+ break;
+ /* FALLTHRU */
+
+ case OMP_CLAUSE_PRIVATE:
+ case OMP_CLAUSE_FIRSTPRIVATE:
+ case OMP_CLAUSE_REDUCTION:
+ decl = OMP_CLAUSE_DECL (c);
+ if (is_variable_sized (decl))
+ install_var_local (decl, ctx);
+ fixup_remapped_decl (decl, ctx,
+ TREE_CODE (c) == OMP_CLAUSE_PRIVATE
+ && OMP_CLAUSE_PRIVATE_DEBUG (c));
+ if (TREE_CODE (c) == OMP_CLAUSE_REDUCTION
+ && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
+ scan_array_reductions = true;
+ break;
+
+ case OMP_CLAUSE_SHARED:
+ decl = OMP_CLAUSE_DECL (c);
+ fixup_remapped_decl (decl, ctx, false);
+ break;
+
+ case OMP_CLAUSE_COPYPRIVATE:
+ case OMP_CLAUSE_COPYIN:
+ case OMP_CLAUSE_DEFAULT:
+ case OMP_CLAUSE_IF:
+ case OMP_CLAUSE_NUM_THREADS:
+ case OMP_CLAUSE_SCHEDULE:
+ case OMP_CLAUSE_NOWAIT:
+ case OMP_CLAUSE_ORDERED:
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+ }
+
+ if (scan_array_reductions)
+ for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c))
+ if (TREE_CODE (c) == OMP_CLAUSE_REDUCTION
+ && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
+ {
+ scan_omp (&OMP_CLAUSE_REDUCTION_INIT (c), ctx);
+ scan_omp (&OMP_CLAUSE_REDUCTION_MERGE (c), ctx);
+ }
+}
+
+/* Create a new name for omp child function. Returns an identifier. */
+
+static GTY(()) unsigned int tmp_ompfn_id_num;
+
+static tree
+create_omp_child_function_name (void)
+{
+ tree name = DECL_ASSEMBLER_NAME (current_function_decl);
+ size_t len = IDENTIFIER_LENGTH (name);
+ char *tmp_name, *prefix;
+
+ prefix = alloca (len + sizeof ("_omp_fn"));
+ memcpy (prefix, IDENTIFIER_POINTER (name), len);
+ strcpy (prefix + len, "_omp_fn");
+#ifndef NO_DOT_IN_LABEL
+ prefix[len] = '.';
+#elif !defined NO_DOLLAR_IN_LABEL
+ prefix[len] = '$';
+#endif
+ ASM_FORMAT_PRIVATE_NAME (tmp_name, prefix, tmp_ompfn_id_num++);
+ return get_identifier (tmp_name);
+}
+
+/* Build a decl for the omp child function. It'll not contain a body
+ yet, just the bare decl. */
+
+static void
+create_omp_child_function (omp_context *ctx)
+{
+ tree decl, type, name, t;
+
+ name = create_omp_child_function_name ();
+ type = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
+
+ decl = build_decl (FUNCTION_DECL, name, type);
+ decl = lang_hooks.decls.pushdecl (decl);
+
+ ctx->cb.dst_fn = decl;
+
+ TREE_STATIC (decl) = 1;
+ TREE_USED (decl) = 1;
+ DECL_ARTIFICIAL (decl) = 1;
+ DECL_IGNORED_P (decl) = 0;
+ TREE_PUBLIC (decl) = 0;
+ DECL_UNINLINABLE (decl) = 1;
+ DECL_EXTERNAL (decl) = 0;
+ DECL_CONTEXT (decl) = NULL_TREE;
+
+ t = build_decl (RESULT_DECL, NULL_TREE, void_type_node);
+ DECL_ARTIFICIAL (t) = 1;
+ DECL_IGNORED_P (t) = 1;
+ DECL_RESULT (decl) = t;
+
+ t = build_decl (PARM_DECL, get_identifier (".omp_data_i"), ptr_type_node);
+ DECL_ARTIFICIAL (t) = 1;
+ DECL_ARG_TYPE (t) = ptr_type_node;
+ DECL_CONTEXT (t) = decl;
+ TREE_USED (t) = 1;
+ DECL_ARGUMENTS (decl) = t;
+ ctx->receiver_decl = t;
+
+ /* Allocate memory for the function structure. The call to
+ allocate_struct_function clobbers cfun, so we need to restore
+ it afterward. */
+ allocate_struct_function (decl);
+ DECL_SOURCE_LOCATION (decl) = EXPR_LOCATION (ctx->stmt);
+ cfun->function_end_locus = EXPR_LOCATION (ctx->stmt);
+ cfun = ctx->cb.src_cfun;
+}
+
+/* Given an OMP_PARALLEL statement, determine whether it is a combined
+ parallel+worksharing directive. This is simply done by examining
+ the body of the directive. If the body contains a single OMP_FOR
+ or a single OMP_SECTIONS then this is a combined directive.
+ Otherwise, it is a regular parallel directive. */
+
+enum omp_parallel_type
+determine_parallel_type (tree stmt)
+{
+ enum omp_parallel_type par_type;
+ tree body = BIND_EXPR_BODY (OMP_PARALLEL_BODY (stmt));
+ tree t;
+
+ par_type = IS_PARALLEL;
+
+ t = expr_only (body);
+ if (t && TREE_CODE (t) == OMP_SECTIONS)
+ par_type = IS_COMBINED_PARALLEL;
+ else
+ par_type = IS_PARALLEL;
+
+ return par_type;
+}
+
+
+/* Scan an OpenMP parallel directive. */
+
+static void
+scan_omp_parallel (tree *stmt_p, omp_context *outer_ctx)
+{
+ omp_context *ctx;
+ tree name;
+
+ /* Ignore parallel directives with empty bodies, unless there
+ are copyin clauses. */
+ if (optimize > 0
+ && empty_body_p (OMP_PARALLEL_BODY (*stmt_p))
+ && find_omp_clause (OMP_CLAUSES (*stmt_p), OMP_CLAUSE_COPYIN) == NULL)
+ {
+ *stmt_p = build_empty_stmt ();
+ return;
+ }
+
+ ctx = new_omp_context (*stmt_p, outer_ctx);
+ ctx->field_map = splay_tree_new (splay_tree_compare_pointers, 0, 0);
+ ctx->parallel_type = determine_parallel_type (*stmt_p);
+ ctx->default_kind = OMP_CLAUSE_DEFAULT_SHARED;
+ ctx->record_type = lang_hooks.types.make_type (RECORD_TYPE);
+ ctx->parallel_start_ix = BUILT_IN_GOMP_PARALLEL_START;
+ ctx->parallel_start_additional_args = NULL_TREE;
+ name = create_tmp_var_name (".omp_data_s");
+ name = build_decl (TYPE_DECL, name, ctx->record_type);
+ TYPE_NAME (ctx->record_type) = name;
+ create_omp_child_function (ctx);
+
+ scan_sharing_clauses (OMP_PARALLEL_CLAUSES (*stmt_p), ctx);
+ scan_omp (&OMP_PARALLEL_BODY (*stmt_p), ctx);
+
+ if (TYPE_FIELDS (ctx->record_type) == NULL)
+ ctx->record_type = ctx->receiver_decl = NULL;
+ else
+ {
+ layout_type (ctx->record_type);
+ fixup_child_record_type (ctx);
+ }
+}
+
+
+/* Extract the header elements of parallel loop FOR_STMT and store
+ them into *FD. */
+
+static void
+extract_omp_for_data (tree for_stmt, omp_context *ctx,
+ struct expand_omp_for_data *fd)
+{
+ tree t;
+
+ fd->for_stmt = for_stmt;
+ fd->pre = NULL;
+ fd->ctx = ctx;
+
+ t = OMP_FOR_INIT (for_stmt);
+ gcc_assert (TREE_CODE (t) == MODIFY_EXPR);
+ fd->v = TREE_OPERAND (t, 0);
+ gcc_assert (DECL_P (fd->v));
+ gcc_assert (TREE_CODE (TREE_TYPE (fd->v)) == INTEGER_TYPE);
+ fd->n1 = TREE_OPERAND (t, 1);
+
+ t = OMP_FOR_COND (for_stmt);
+ fd->cond_code = TREE_CODE (t);
+ gcc_assert (TREE_OPERAND (t, 0) == fd->v);
+ fd->n2 = TREE_OPERAND (t, 1);
+ switch (fd->cond_code)
+ {
+ case LT_EXPR:
+ case GT_EXPR:
+ break;
+ case LE_EXPR:
+ fd->n2 = fold_build2 (PLUS_EXPR, TREE_TYPE (fd->n2), fd->n2,
+ build_int_cst (TREE_TYPE (fd->n2), 1));
+ fd->cond_code = LT_EXPR;
+ break;
+ case GE_EXPR:
+ fd->n2 = fold_build2 (MINUS_EXPR, TREE_TYPE (fd->n2), fd->n2,
+ build_int_cst (TREE_TYPE (fd->n2), 1));
+ fd->cond_code = GT_EXPR;
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
+ t = OMP_FOR_INCR (fd->for_stmt);
+ gcc_assert (TREE_CODE (t) == MODIFY_EXPR);
+ gcc_assert (TREE_OPERAND (t, 0) == fd->v);
+ t = TREE_OPERAND (t, 1);
+ gcc_assert (TREE_OPERAND (t, 0) == fd->v);
+ switch (TREE_CODE (t))
+ {
+ case PLUS_EXPR:
+ fd->step = TREE_OPERAND (t, 1);
+ break;
+ case MINUS_EXPR:
+ fd->step = TREE_OPERAND (t, 1);
+ fd->step = fold_build1 (NEGATE_EXPR, TREE_TYPE (fd->step), fd->step);
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
+ fd->have_nowait = fd->have_ordered = false;
+ fd->sched_kind = OMP_CLAUSE_SCHEDULE_STATIC;
+ fd->chunk_size = NULL_TREE;
+
+ for (t = OMP_FOR_CLAUSES (for_stmt); t ; t = OMP_CLAUSE_CHAIN (t))
+ switch (TREE_CODE (t))
+ {
+ case OMP_CLAUSE_NOWAIT:
+ fd->have_nowait = true;
+ break;
+ case OMP_CLAUSE_ORDERED:
+ fd->have_ordered = true;
+ break;
+ case OMP_CLAUSE_SCHEDULE:
+ fd->sched_kind = OMP_CLAUSE_SCHEDULE_KIND (t);
+ fd->chunk_size = OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (t);
+ break;
+ default:
+ break;
+ }
+
+ if (fd->sched_kind == OMP_CLAUSE_SCHEDULE_RUNTIME)
+ gcc_assert (fd->chunk_size == NULL);
+ else if (fd->chunk_size == NULL)
+ {
+ /* We only need to compute a default chunk size for ordered
+ static loops and dynamic loops. */
+ if (fd->sched_kind != OMP_CLAUSE_SCHEDULE_STATIC || fd->have_ordered)
+ fd->chunk_size = (fd->sched_kind == OMP_CLAUSE_SCHEDULE_STATIC)
+ ? integer_zero_node : integer_one_node;
+ }
+}
+
+
+/* Scan an OpenMP loop directive. */
+
+static void
+scan_omp_for (tree *stmt_p, omp_context *outer_ctx)
+{
+ omp_context *ctx;
+ tree stmt = *stmt_p;
+
+ ctx = new_omp_context (stmt, outer_ctx);
+
+ /* If this is a combined parallel loop directive, we need to extract
+ the bounds, step and chunk size for the loop so that we can build
+ the call to GOMP_parallel_loop_foo_start. Do this before
+ scanning the loop header to avoid getting the mapped variables
+ from the child context. */
+ if (is_in_combined_parallel_ctx (ctx))
+ {
+ struct expand_omp_for_data fd;
+ tree t, additional_args;
+
+ extract_omp_for_data (stmt, ctx, &fd);
+
+ additional_args = NULL_TREE;
+ if (fd.chunk_size)
+ {
+ t = fold_convert (long_integer_type_node, fd.chunk_size);
+ additional_args = tree_cons (NULL, t, additional_args);
+ }
+ t = fold_convert (long_integer_type_node, fd.step);
+ additional_args = tree_cons (NULL, t, additional_args);
+ t = fold_convert (long_integer_type_node, fd.n2);
+ additional_args = tree_cons (NULL, t, additional_args);
+ t = fold_convert (long_integer_type_node, fd.n1);
+ additional_args = tree_cons (NULL, t, additional_args);
+ outer_ctx->parallel_start_additional_args = additional_args;
+ }
+
+ scan_sharing_clauses (OMP_FOR_CLAUSES (stmt), ctx);
+
+ /* FIXME. When expanding into a combined parallel loop, we may not
+ need to map some of the variables in the loop header (in
+ particular, FD.N1 and FD.N2 for dynamic loops). */
+ scan_omp (&OMP_FOR_PRE_BODY (stmt), ctx);
+ scan_omp (&OMP_FOR_INIT (stmt), ctx);
+ scan_omp (&OMP_FOR_COND (stmt), ctx);
+ scan_omp (&OMP_FOR_INCR (stmt), ctx);
+ scan_omp (&OMP_FOR_BODY (stmt), ctx);
+}
+
+/* Scan an OpenMP sections directive. */
+
+static void
+scan_omp_sections (tree *stmt_p, omp_context *outer_ctx)
+{
+ tree stmt = *stmt_p;
+ omp_context *ctx;
+
+ ctx = new_omp_context (stmt, outer_ctx);
+ scan_sharing_clauses (OMP_SECTIONS_CLAUSES (stmt), ctx);
+ scan_omp (&OMP_SECTIONS_BODY (stmt), ctx);
+}
+
+/* Scan an OpenMP single directive. */
+
+static void
+scan_omp_single (tree *stmt_p, omp_context *outer_ctx)
+{
+ tree stmt = *stmt_p;
+ omp_context *ctx;
+ tree name;
+
+ ctx = new_omp_context (stmt, outer_ctx);
+ ctx->field_map = splay_tree_new (splay_tree_compare_pointers, 0, 0);
+ ctx->record_type = lang_hooks.types.make_type (RECORD_TYPE);
+ name = create_tmp_var_name (".omp_copy_s");
+ name = build_decl (TYPE_DECL, name, ctx->record_type);
+ TYPE_NAME (ctx->record_type) = name;
+
+ scan_sharing_clauses (OMP_SINGLE_CLAUSES (stmt), ctx);
+ scan_omp (&OMP_SINGLE_BODY (stmt), ctx);
+
+ if (TYPE_FIELDS (ctx->record_type) == NULL)
+ ctx->record_type = NULL;
+ else
+ layout_type (ctx->record_type);
+}
+
+/* Similar, except this is either a parallel nested within another
+ parallel, or a workshare construct nested within a nested parallel.
+ In this case we want to do minimal processing, as the real work
+ will be done during lowering of the function generated by the
+ outermost parallel.
+
+ The minimal amount of work is processing private clauses, and simply
+ scanning the rest. Private clauses are the only ones that don't
+ also imply a reference in the outer parallel. We must set up a
+ translation lest the default behaviour in omp_copy_decl substitute
+ error_mark_node. */
+
+static void
+scan_omp_nested (tree *stmt_p, omp_context *outer_ctx)
+{
+ omp_context *ctx;
+ tree var_sized_list = NULL;
+ tree c, decl, stmt = *stmt_p;
+
+ ctx = new_omp_context (stmt, outer_ctx);
+ ctx->is_nested = true;
+
+ for (c = OMP_CLAUSES (stmt); c ; c = OMP_CLAUSE_CHAIN (c))
+ {
+ switch (TREE_CODE (c))
+ {
+ case OMP_CLAUSE_PRIVATE:
+ decl = OMP_CLAUSE_DECL (c);
+ if (is_variable_sized (decl))
+ var_sized_list = tree_cons (NULL, c, var_sized_list);
+ OMP_CLAUSE_DECL (c) = install_var_local (decl, ctx);
+ break;
+
+ case OMP_CLAUSE_FIRSTPRIVATE:
+ case OMP_CLAUSE_LASTPRIVATE:
+ case OMP_CLAUSE_REDUCTION:
+ case OMP_CLAUSE_SHARED:
+ case OMP_CLAUSE_COPYPRIVATE:
+ case OMP_CLAUSE_IF:
+ case OMP_CLAUSE_NUM_THREADS:
+ case OMP_CLAUSE_SCHEDULE:
+ scan_omp (&TREE_OPERAND (c, 0), ctx->outer);
+ break;
+
+ case OMP_CLAUSE_COPYIN:
+ case OMP_CLAUSE_NOWAIT:
+ case OMP_CLAUSE_ORDERED:
+ case OMP_CLAUSE_DEFAULT:
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+ }
+
+ /* Instantiate the VALUE_EXPR for variable sized variables. We have
+ to do this as a separate pass, since we need the pointer and size
+ decls installed first. */
+ for (c = var_sized_list; c ; c = TREE_CHAIN (c))
+ fixup_remapped_decl (OMP_CLAUSE_DECL (TREE_VALUE (c)), ctx,
+ OMP_CLAUSE_PRIVATE_DEBUG (TREE_VALUE (c)));
+
+ scan_omp (&OMP_BODY (stmt), ctx);
+
+ if (TREE_CODE (stmt) == OMP_FOR)
+ {
+ scan_omp (&OMP_FOR_PRE_BODY (stmt), ctx);
+ scan_omp (&OMP_FOR_INIT (stmt), ctx);
+ scan_omp (&OMP_FOR_COND (stmt), ctx);
+ scan_omp (&OMP_FOR_INCR (stmt), ctx);
+ }
+}
+
+
+/* Callback for walk_stmts used to scan for OpenMP directives at TP. */
+
+static tree
+scan_omp_1 (tree *tp, int *walk_subtrees, void *data)
+{
+ struct walk_stmt_info *wi = data;
+ omp_context *ctx = wi->info;
+ tree t = *tp;
+
+ if (EXPR_HAS_LOCATION (t))
+ input_location = EXPR_LOCATION (t);
+
+ *walk_subtrees = 0;
+ switch (TREE_CODE (t))
+ {
+ case OMP_PARALLEL:
+ if (++parallel_nesting_level == 1)
+ scan_omp_parallel (tp, ctx);
+ else
+ scan_omp_nested (tp, ctx);
+ parallel_nesting_level--;
+ break;
+
+ case OMP_FOR:
+ if (parallel_nesting_level <= 1)
+ scan_omp_for (tp, ctx);
+ else
+ scan_omp_nested (tp, ctx);
+ break;
+
+ case OMP_SECTIONS:
+ if (parallel_nesting_level <= 1)
+ scan_omp_sections (tp, ctx);
+ else
+ scan_omp_nested (tp, ctx);
+ break;
+
+ case OMP_SINGLE:
+ if (parallel_nesting_level <= 1)
+ scan_omp_single (tp, ctx);
+ else
+ scan_omp_nested (tp, ctx);
+ break;
+
+ case OMP_SECTION:
+ case OMP_MASTER:
+ case OMP_ORDERED:
+ case OMP_CRITICAL:
+ ctx = new_omp_context (*tp, ctx);
+ scan_omp (&OMP_BODY (*tp), ctx);
+ break;
+
+ case BIND_EXPR:
+ {
+ tree var;
+ *walk_subtrees = 1;
+
+ for (var = BIND_EXPR_VARS (t); var ; var = TREE_CHAIN (var))
+ {
+ if (DECL_CONTEXT (var) == ctx->cb.src_fn)
+ DECL_CONTEXT (var) = ctx->cb.dst_fn;
+ insert_decl_map (&ctx->cb, var, var);
+ }
+ }
+ break;
+
+ case VAR_DECL:
+ case PARM_DECL:
+ case LABEL_DECL:
+ if (ctx)
+ *tp = remap_decl (t, &ctx->cb);
+ break;
+
+ default:
+ if (ctx && TYPE_P (t))
+ *tp = remap_type (t, &ctx->cb);
+ else if (!DECL_P (t))
+ *walk_subtrees = 1;
+ break;
+ }
+
+ return NULL_TREE;
+}
+
+
+/* Scan all the statements starting at STMT_P. CTX contains context
+ information about the OpenMP directives and clauses found during
+ the scan. */
+
+static void
+scan_omp (tree *stmt_p, omp_context *ctx)
+{
+ location_t saved_location;
+ struct walk_stmt_info wi;
+
+ memset (&wi, 0, sizeof (wi));
+ wi.callback = scan_omp_1;
+ wi.info = ctx;
+ wi.want_bind_expr = (ctx != NULL);
+ wi.want_locations = true;
+
+ saved_location = input_location;
+ walk_stmts (&wi, stmt_p);
+ input_location = saved_location;
+}
+\f
+/* Re-gimplification and code generation routines. */
+
+/* Build a call to GOMP_barrier. */
+
+static void
+build_omp_barrier (tree *stmt_list)
+{
+ tree t;
+
+ t = built_in_decls[BUILT_IN_GOMP_BARRIER];
+ t = build_function_call_expr (t, NULL);
+ gimplify_and_add (t, stmt_list);
+}
+
+/* If a context was created for STMT when it was scanned, return it. */
+
+static omp_context *
+maybe_lookup_ctx (tree stmt)
+{
+ splay_tree_node n;
+ n = splay_tree_lookup (all_contexts, (splay_tree_key) stmt);
+ return n ? (omp_context *) n->value : NULL;
+}
+
+/* Construct the initialization value for reduction CLAUSE. */
+
+tree
+omp_reduction_init (tree clause, tree type)
+{
+ switch (OMP_CLAUSE_REDUCTION_CODE (clause))
+ {
+ case PLUS_EXPR:
+ case MINUS_EXPR:
+ case BIT_IOR_EXPR:
+ case BIT_XOR_EXPR:
+ case TRUTH_OR_EXPR:
+ case TRUTH_ORIF_EXPR:
+ case TRUTH_XOR_EXPR:
+ case NE_EXPR:
+ return fold_convert (type, integer_zero_node);
+
+ case MULT_EXPR:
+ case TRUTH_AND_EXPR:
+ case TRUTH_ANDIF_EXPR:
+ case EQ_EXPR:
+ return fold_convert (type, integer_one_node);
+
+ case BIT_AND_EXPR:
+ return fold_convert (type, integer_minus_one_node);
+
+ case MAX_EXPR:
+ if (SCALAR_FLOAT_TYPE_P (type))
+ {
+ REAL_VALUE_TYPE max, min;
+ if (HONOR_INFINITIES (TYPE_MODE (type)))
+ {
+ real_inf (&max);
+ real_arithmetic (&min, NEGATE_EXPR, &max, NULL);
+ }
+ else
+ real_maxval (&min, 1, TYPE_MODE (type));
+ return build_real (type, min);
+ }
+ else
+ {
+ gcc_assert (INTEGRAL_TYPE_P (type));
+ return TYPE_MIN_VALUE (type);
+ }
+
+ case MIN_EXPR:
+ if (SCALAR_FLOAT_TYPE_P (type))
+ {
+ REAL_VALUE_TYPE max;
+ if (HONOR_INFINITIES (TYPE_MODE (type)))
+ real_inf (&max);
+ else
+ real_maxval (&max, 0, TYPE_MODE (type));
+ return build_real (type, max);
+ }
+ else
+ {
+ gcc_assert (INTEGRAL_TYPE_P (type));
+ return TYPE_MAX_VALUE (type);
+ }
+
+ default:
+ gcc_unreachable ();
+ }
+}
+
+/* Generate code to implement the input clauses, FIRSTPRIVATE and COPYIN,
+ from the receiver (aka child) side and initializers for REFERENCE_TYPE
+ private variables. Initialization statements go in ILIST, while calls
+ to destructors go in DLIST. */
+
+static void
+expand_rec_input_clauses (tree clauses, tree *ilist, tree *dlist,
+ omp_context *ctx)
+{
+ tree_stmt_iterator diter;
+ tree c, dtor, copyin_seq, x, args, ptr;
+ bool copyin_by_ref = false;
+ int pass;
+
+ *dlist = alloc_stmt_list ();
+ diter = tsi_start (*dlist);
+ copyin_seq = NULL;
+
+ /* Do all the fixed sized types in the first pass, and the variable sized
+ types in the second pass. This makes sure that the scalar arguments to
+ the variable sized types are processed before we use them in the
+ variable sized operations. */
+ for (pass = 0; pass < 2; ++pass)
+ {
+ for (c = clauses; c ; c = OMP_CLAUSE_CHAIN (c))
+ {
+ enum tree_code c_kind = TREE_CODE (c);
+ tree var, new_var;
+ bool by_ref;
+
+ switch (c_kind)
+ {
+ case OMP_CLAUSE_PRIVATE:
+ if (OMP_CLAUSE_PRIVATE_DEBUG (c))
+ continue;
+ break;
+ case OMP_CLAUSE_SHARED:
+ case OMP_CLAUSE_FIRSTPRIVATE:
+ case OMP_CLAUSE_LASTPRIVATE:
+ case OMP_CLAUSE_COPYIN:
+ case OMP_CLAUSE_REDUCTION:
+ break;
+ default:
+ continue;
+ }
+
+ new_var = var = OMP_CLAUSE_DECL (c);
+ if (c_kind != OMP_CLAUSE_COPYIN)
+ new_var = lookup_decl (var, ctx);
+
+ if (c_kind == OMP_CLAUSE_SHARED || c_kind == OMP_CLAUSE_COPYIN)
+ {
+ if (pass != 0)
+ continue;
+ }
+ /* For variable sized types, we need to allocate the actual
+ storage here. Call alloca and store the result in the pointer
+ decl that we created elsewhere. */
+ else if (is_variable_sized (var))
+ {
+ if (pass == 0)
+ continue;
+
+ ptr = DECL_VALUE_EXPR (new_var);
+ gcc_assert (TREE_CODE (ptr) == INDIRECT_REF);
+ ptr = TREE_OPERAND (ptr, 0);
+ gcc_assert (DECL_P (ptr));
+
+ x = TYPE_SIZE_UNIT (TREE_TYPE (new_var));
+ args = tree_cons (NULL, x, NULL);
+ x = built_in_decls[BUILT_IN_ALLOCA];
+ x = build_function_call_expr (x, args);
+ x = fold_convert (TREE_TYPE (ptr), x);
+ x = build2 (MODIFY_EXPR, void_type_node, ptr, x);
+ gimplify_and_add (x, ilist);
+ }
+ /* For references that are being privatized for Fortran, allocate
+ new backing storage for the new pointer variable. This allows
+ us to avoid changing all the code that expects a pointer to
+ something that expects a direct variable. Note that this
+ doesn't apply to C++, since reference types are disallowed in
+ data sharing clauses there. */
+ else if (is_reference (var))
+ {
+ if (pass == 0)
+ continue;
+
+ x = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (new_var)));
+ if (TREE_CONSTANT (x))
+ {
+ const char *name = NULL;
+ if (DECL_NAME (var))
+ name = IDENTIFIER_POINTER (DECL_NAME (new_var));
+
+ x = create_tmp_var (TREE_TYPE (TREE_TYPE (new_var)), name);
+ x = build_fold_addr_expr_with_type (x, TREE_TYPE (new_var));
+ }
+ else
+ {
+ args = tree_cons (NULL, x, NULL);
+ x = built_in_decls[BUILT_IN_ALLOCA];
+ x = build_function_call_expr (x, args);
+ x = fold_convert (TREE_TYPE (new_var), x);
+ }
+
+ x = build2 (MODIFY_EXPR, void_type_node, new_var, x);
+ gimplify_and_add (x, ilist);
+
+ new_var = build_fold_indirect_ref (new_var);
+ }
+ else if (c_kind == OMP_CLAUSE_REDUCTION
+ && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
+ {
+ if (pass == 0)
+ continue;
+ }
+ else if (pass != 0)
+ continue;
+
+ switch (TREE_CODE (c))
+ {
+ case OMP_CLAUSE_SHARED:
+ /* Set up the DECL_VALUE_EXPR for shared variables now. This
+ needs to be delayed until after fixup_child_record_type so
+ that we get the correct type during the dereference. */
+ by_ref = use_pointer_for_field (var, true);
+ x = build_receiver_ref (var, by_ref, ctx);
+ SET_DECL_VALUE_EXPR (new_var, x);
+ DECL_HAS_VALUE_EXPR_P (new_var) = 1;
+
+ /* ??? If VAR is not passed by reference, and the variable
+ hasn't been initialized yet, then we'll get a warning for
+ the store into the omp_data_s structure. Ideally, we'd be
+ able to notice this and not store anything at all, but
+ we're generating code too early. Suppress the warning. */
+ if (!by_ref)
+ TREE_NO_WARNING (var) = 1;
+ break;
+
+ case OMP_CLAUSE_LASTPRIVATE:
+ if (OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE (c))
+ break;
+ /* FALLTHRU */
+
+ case OMP_CLAUSE_PRIVATE:
+ x = lang_hooks.decls.omp_clause_default_ctor (c, new_var);
+ if (x)
+ gimplify_and_add (x, ilist);
+ /* FALLTHRU */
+
+ do_dtor:
+ x = lang_hooks.decls.omp_clause_dtor (c, new_var);
+ if (x)
+ {
+ dtor = x;
+ gimplify_stmt (&dtor);
+ tsi_link_before (&diter, dtor, TSI_SAME_STMT);
+ }
+ break;
+
+ case OMP_CLAUSE_FIRSTPRIVATE:
+ x = build_outer_var_ref (var, ctx);
+ x = lang_hooks.decls.omp_clause_copy_ctor (c, new_var, x);
+ gimplify_and_add (x, ilist);
+ goto do_dtor;
+ break;
+
+ case OMP_CLAUSE_COPYIN:
+ by_ref = use_pointer_for_field (var, false);
+ x = build_receiver_ref (var, by_ref, ctx);
+ x = lang_hooks.decls.omp_clause_assign_op (c, new_var, x);
+ append_to_statement_list (x, ©in_seq);
+ copyin_by_ref |= by_ref;
+ break;
+
+ case OMP_CLAUSE_REDUCTION:
+ if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
+ {
+ gimplify_and_add (OMP_CLAUSE_REDUCTION_INIT (c), ilist);
+ OMP_CLAUSE_REDUCTION_INIT (c) = NULL;
+ }
+ else
+ {
+ x = omp_reduction_init (c, TREE_TYPE (new_var));
+ gcc_assert (TREE_CODE (TREE_TYPE (new_var)) != ARRAY_TYPE);
+ x = build2 (MODIFY_EXPR, void_type_node, new_var, x);
+ gimplify_and_add (x, ilist);
+ }
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+ }
+ }
+
+ /* The copyin sequence is not to be executed by the main thread, since
+ that would result in self-copies. Perhaps not visible to scalars,
+ but it certainly is to C++ operator=. */
+ if (copyin_seq)
+ {
+ x = built_in_decls[BUILT_IN_OMP_GET_THREAD_NUM];
+ x = build_function_call_expr (x, NULL);
+ x = build2 (NE_EXPR, boolean_type_node, x,
+ build_int_cst (TREE_TYPE (x), 0));
+ x = build3 (COND_EXPR, void_type_node, x, copyin_seq, NULL);
+ gimplify_and_add (x, ilist);
+ }
+
+ /* If any copyin variable is passed by reference, we must ensure the
+ master thread doesn't modify it before it is copied over in all
+ threads. */
+ if (copyin_by_ref)
+ build_omp_barrier (ilist);
+}
+
+/* Generate code to implement the LASTPRIVATE clauses. This is used for
+ both parallel and workshare constructs. PREDICATE may be NULL if it's
+ always true. */
+
+static void
+expand_lastprivate_clauses (tree clauses, tree predicate, tree *stmt_list,
+ omp_context *ctx)
+{
+ tree sub_list, x, c;
+
+ /* Early exit if there are no lastprivate clauses. */
+ clauses = find_omp_clause (clauses, OMP_CLAUSE_LASTPRIVATE);
+ if (clauses == NULL)
+ {
+ /* If this was a workshare clause, see if it had been combined
+ with its parallel. In that case, look for the clauses on the
+ parallel statement itself. */
+ if (is_parallel_ctx (ctx))
+ return;
+
+ ctx = ctx->outer;
+ if (ctx == NULL || !is_parallel_ctx (ctx))
+ return;
+
+ clauses = find_omp_clause (OMP_PARALLEL_CLAUSES (ctx->stmt),
+ OMP_CLAUSE_LASTPRIVATE);
+ if (clauses == NULL)
+ return;
+ }
+
+ sub_list = alloc_stmt_list ();
+
+ for (c = clauses; c ; c = OMP_CLAUSE_CHAIN (c))
+ {
+ tree var, new_var;
+
+ if (TREE_CODE (c) != OMP_CLAUSE_LASTPRIVATE)
+ continue;
+
+ var = OMP_CLAUSE_DECL (c);
+ new_var = lookup_decl (var, ctx);
+
+ x = build_outer_var_ref (var, ctx);
+ if (is_reference (var))
+ new_var = build_fold_indirect_ref (new_var);
+ x = lang_hooks.decls.omp_clause_assign_op (c, x, new_var);
+ append_to_statement_list (x, &sub_list);
+ }
+
+ if (predicate)
+ x = build3 (COND_EXPR, void_type_node, predicate, sub_list, NULL);
+ else
+ x = sub_list;
+ gimplify_and_add (x, stmt_list);
+}
+
+/* Generate code to implement the REDUCTION clauses. */
+
+static void
+expand_reduction_clauses (tree clauses, tree *stmt_list, omp_context *ctx)
+{
+ tree sub_list = NULL, x, c;
+ int count = 0;
+
+ /* First see if there is exactly one reduction clause. Use OMP_ATOMIC
+ update in that case, otherwise use a lock. */
+ for (c = clauses; c && count < 2; c = OMP_CLAUSE_CHAIN (c))
+ if (TREE_CODE (c) == OMP_CLAUSE_REDUCTION)
+ {
+ if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
+ {
+ /* Never use OMP_ATOMIC for array reductions. */
+ count = -1;
+ break;
+ }
+ count++;
+ }
+
+ if (count == 0)
+ return;
+
+ for (c = clauses; c ; c = OMP_CLAUSE_CHAIN (c))
+ {
+ tree var, ref, new_var;
+ enum tree_code code;
+
+ if (TREE_CODE (c) != OMP_CLAUSE_REDUCTION)
+ continue;
+
+ var = OMP_CLAUSE_DECL (c);
+ new_var = lookup_decl (var, ctx);
+ if (is_reference (var))
+ new_var = build_fold_indirect_ref (new_var);
+ ref = build_outer_var_ref (var, ctx);
+ code = OMP_CLAUSE_REDUCTION_CODE (c);
+ /* reduction(-:var) sums up the partial results, so it acts identically
+ to reduction(+:var). */
+ if (code == MINUS_EXPR)
+ code = PLUS_EXPR;
+
+ if (count == 1)
+ {
+ tree addr = build_fold_addr_expr (ref);
+
+ addr = save_expr (addr);
+ ref = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (addr)), addr);
+ x = fold_build2 (code, TREE_TYPE (ref), ref, new_var);
+ x = build2 (OMP_ATOMIC, void_type_node, addr, x);
+ gimplify_and_add (x, stmt_list);
+ return;
+ }
+
+ if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
+ {
+ tree placeholder = OMP_CLAUSE_REDUCTION_PLACEHOLDER (c);
+
+ if (is_reference (var))
+ ref = build_fold_addr_expr (ref);
+ SET_DECL_VALUE_EXPR (placeholder, ref);
+ DECL_HAS_VALUE_EXPR_P (placeholder) = 1;
+ gimplify_and_add (OMP_CLAUSE_REDUCTION_MERGE (c), &sub_list);
+ OMP_CLAUSE_REDUCTION_MERGE (c) = NULL;
+ OMP_CLAUSE_REDUCTION_PLACEHOLDER (c) = NULL;
+ }
+ else
+ {
+ x = build2 (code, TREE_TYPE (ref), ref, new_var);
+ ref = build_outer_var_ref (var, ctx);
+ x = build2 (MODIFY_EXPR, void_type_node, ref, x);
+ append_to_statement_list (x, &sub_list);
+ }
+ }
+
+ x = built_in_decls[BUILT_IN_GOMP_ATOMIC_START];
+ x = build_function_call_expr (x, NULL);
+ gimplify_and_add (x, stmt_list);
+
+ gimplify_and_add (sub_list, stmt_list);
+
+ x = built_in_decls[BUILT_IN_GOMP_ATOMIC_END];
+ x = build_function_call_expr (x, NULL);
+ gimplify_and_add (x, stmt_list);
+}
+
+/* Generate code to implement the COPYPRIVATE clauses. */
+
+static void
+expand_copyprivate_clauses (tree clauses, tree *slist, tree *rlist,
+ omp_context *ctx)
+{
+ tree c;
+
+ for (c = clauses; c ; c = OMP_CLAUSE_CHAIN (c))
+ {
+ tree var, ref, x;
+ bool by_ref;
+
+ if (TREE_CODE (c) != OMP_CLAUSE_COPYPRIVATE)
+ continue;
+
+ var = OMP_CLAUSE_DECL (c);
+ by_ref = use_pointer_for_field (var, false);
+
+ ref = build_sender_ref (var, ctx);
+ x = by_ref ? build_fold_addr_expr (var) : var;
+ x = build2 (MODIFY_EXPR, void_type_node, ref, x);
+ gimplify_and_add (x, slist);
+
+ ref = build_receiver_ref (var, by_ref, ctx);
+ if (is_reference (var))
+ {
+ ref = build_fold_indirect_ref (ref);
+ var = build_fold_indirect_ref (var);
+ }
+ x = lang_hooks.decls.omp_clause_assign_op (c, var, ref);
+ gimplify_and_add (x, rlist);
+ }
+}
+
+/* Generate code to implement the clauses, FIRSTPRIVATE, COPYIN, LASTPRIVATE,
+ and REDUCTION from the sender (aka parent) side. */
+
+static void
+expand_send_clauses (tree clauses, tree *ilist, tree *olist, omp_context *ctx)
+{
+ tree c;
+
+ for (c = clauses; c ; c = OMP_CLAUSE_CHAIN (c))
+ {
+ tree val, ref, x;
+ bool by_ref, do_in = false, do_out = false;
+
+ switch (TREE_CODE (c))
+ {
+ case OMP_CLAUSE_FIRSTPRIVATE:
+ case OMP_CLAUSE_COPYIN:
+ case OMP_CLAUSE_LASTPRIVATE:
+ case OMP_CLAUSE_REDUCTION:
+ break;
+ default:
+ continue;
+ }
+
+ val = OMP_CLAUSE_DECL (c);
+ if (is_variable_sized (val))
+ continue;
+ by_ref = use_pointer_for_field (val, false);
+
+ switch (TREE_CODE (c))
+ {
+ case OMP_CLAUSE_FIRSTPRIVATE:
+ case OMP_CLAUSE_COPYIN:
+ do_in = true;
+ break;
+
+ case OMP_CLAUSE_LASTPRIVATE:
+ if (by_ref || is_reference (val))
+ {
+ if (OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE (c))
+ continue;
+ do_in = true;
+ }
+ else
+ do_out = true;
+ break;
+
+ case OMP_CLAUSE_REDUCTION:
+ do_in = true;
+ do_out = !(by_ref || is_reference (val));
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+
+ if (do_in)
+ {
+ ref = build_sender_ref (val, ctx);
+ x = by_ref ? build_fold_addr_expr (val) : val;
+ x = build2 (MODIFY_EXPR, void_type_node, ref, x);
+ gimplify_and_add (x, ilist);
+ }
+ if (do_out)
+ {
+ ref = build_sender_ref (val, ctx);
+ x = build2 (MODIFY_EXPR, void_type_node, val, ref);
+ gimplify_and_add (x, olist);
+ }
+ }
+}
+
+/* Generate code to implement SHARED from the sender (aka parent) side.
+ This is trickier, since OMP_PARALLEL_CLAUSES doesn't list things that
+ got automatically shared. */
+
+static void
+expand_send_shared_vars (tree *ilist, tree *olist, omp_context *ctx)
+{
+ tree ovar, nvar, f, x;
+
+ if (ctx->record_type == NULL)
+ return;
+
+ for (f = TYPE_FIELDS (ctx->record_type); f ; f = TREE_CHAIN (f))
+ {
+ ovar = DECL_ABSTRACT_ORIGIN (f);
+ nvar = maybe_lookup_decl (ovar, ctx);
+ if (!nvar || !DECL_HAS_VALUE_EXPR_P (nvar))
+ continue;
+
+ if (use_pointer_for_field (ovar, true))
+ {
+ x = build_sender_ref (ovar, ctx);
+ ovar = build_fold_addr_expr (ovar);
+ x = build2 (MODIFY_EXPR, void_type_node, x, ovar);
+ gimplify_and_add (x, ilist);
+ }
+ else
+ {
+ x = build_sender_ref (ovar, ctx);
+ x = build2 (MODIFY_EXPR, void_type_node, x, ovar);
+ gimplify_and_add (x, ilist);
+
+ x = build_sender_ref (ovar, ctx);
+ x = build2 (MODIFY_EXPR, void_type_node, ovar, x);
+ gimplify_and_add (x, olist);
+ }
+ }
+}
+
+/* Build the function calls to GOMP_parallel_start etc to actually
+ generate the parallel operation. */
+
+static void
+build_parallel_call (tree clauses, tree *stmt_list, omp_context *ctx)
+{
+ tree t, args, val, cond, c;
+
+ /* By default, the value of NUM_THREADS is zero (selected at run time)
+ and there is no conditional. */
+ cond = NULL_TREE;
+ val = build_int_cst (unsigned_type_node, 0);
+
+ c = find_omp_clause (clauses, OMP_CLAUSE_IF);
+ if (c)
+ cond = OMP_CLAUSE_IF_EXPR (c);
+
+ c = find_omp_clause (clauses, OMP_CLAUSE_NUM_THREADS);
+ if (c)
+ val = OMP_CLAUSE_NUM_THREADS_EXPR (c);
+
+ /* Ensure 'val' is of the correct type. */
+ val = fold_convert (unsigned_type_node, val);
+
+ /* If we found the clause 'if (cond)', build either
+ (cond != 0) or (cond ? val : 1u). */
+ if (cond)
+ {
+ if (integer_zerop (val))
+ val = build2 (EQ_EXPR, unsigned_type_node, cond,
+ build_int_cst (TREE_TYPE (cond), 0));
+ else
+ val = build3 (COND_EXPR, unsigned_type_node, cond, val,
+ build_int_cst (unsigned_type_node, 1));
+ }
+
+ args = tree_cons (NULL, val, NULL);
+ t = ctx->sender_decl;
+ if (t == NULL)
+ t = null_pointer_node;
+ else
+ t = build_fold_addr_expr (t);
+ args = tree_cons (NULL, t, args);
+ t = build_fold_addr_expr (ctx->cb.dst_fn);
+ args = tree_cons (NULL, t, args);
+ if (ctx->parallel_start_additional_args)
+ args = chainon (args, ctx->parallel_start_additional_args);
+ t = built_in_decls[ctx->parallel_start_ix];
+ t = build_function_call_expr (t, args);
+ gimplify_and_add (t, stmt_list);
+
+ t = ctx->sender_decl;
+ if (t == NULL)
+ t = null_pointer_node;
+ else
+ t = build_fold_addr_expr (t);
+ args = tree_cons (NULL, t, NULL);
+ t = build_function_call_expr (ctx->cb.dst_fn, args);
+ gimplify_and_add (t, stmt_list);
+
+ t = built_in_decls[BUILT_IN_GOMP_PARALLEL_END];
+ t = build_function_call_expr (t, NULL);
+ gimplify_and_add (t, stmt_list);
+}
+
+/* If exceptions are enabled, wrap *STMT_P in a MUST_NOT_THROW catch
+ handler. This prevents programs from violating the structured
+ block semantics with throws. */
+
+static void
+maybe_catch_exception (tree *stmt_p)
+{
+ tree f, t;
+
+ if (!flag_exceptions)
+ return;
+
+ if (lang_protect_cleanup_actions)
+ t = lang_protect_cleanup_actions ();
+ else
+ {
+ t = built_in_decls[BUILT_IN_TRAP];
+ t = build_function_call_expr (t, NULL);
+ }
+ f = build2 (EH_FILTER_EXPR, void_type_node, NULL, NULL);
+ EH_FILTER_MUST_NOT_THROW (f) = 1;
+ gimplify_and_add (t, &EH_FILTER_FAILURE (f));
+
+ t = build2 (TRY_CATCH_EXPR, void_type_node, *stmt_p, NULL);
+ append_to_statement_list (f, &TREE_OPERAND (t, 1));
+
+ *stmt_p = NULL;
+ append_to_statement_list (t, stmt_p);
+}
+
+
+/* Expand the OpenMP parallel directive pointed to by STMT_P. CTX
+ holds context information for *STMT_P. Expansion proceeds in
+ two main phases:
+
+ (1) The body of the parallel is expanded in-situ.
+ All the input and reduction clauses are expanded (from the
+ child's perspective). The body of the parallel is then
+ inserted as the body of CTX->CB.DST_FUN (the function spawned
+ to execute each child thread).
+
+ (2) Back in the original function, the original body of the
+ directive is replaced with the expansion of clauses (from the
+ parent's perspective), and the thread library call to launch
+ all the children threads. */
+
+static void
+expand_omp_parallel (tree *stmt_p, omp_context *ctx)
+{
+ tree clauses, block, bind, body, olist;
+
+ current_function_decl = ctx->cb.dst_fn;
+ cfun = DECL_STRUCT_FUNCTION (current_function_decl);
+
+ push_gimplify_context ();
+
+ /* First phase. Expand the body of the children threads, emit
+ receiving code for data copying clauses. */
+ clauses = OMP_PARALLEL_CLAUSES (*stmt_p);
+ bind = OMP_PARALLEL_BODY (*stmt_p);
+ block = BIND_EXPR_BLOCK (bind);
+ body = BIND_EXPR_BODY (bind);
+ BIND_EXPR_BODY (bind) = alloc_stmt_list ();
+
+ expand_rec_input_clauses (clauses, &BIND_EXPR_BODY (bind), &olist, ctx);
+
+ expand_omp (&body, ctx);
+ append_to_statement_list (body, &BIND_EXPR_BODY (bind));
+
+ expand_reduction_clauses (clauses, &BIND_EXPR_BODY (bind), ctx);
+ append_to_statement_list (olist, &BIND_EXPR_BODY (bind));
+ maybe_catch_exception (&BIND_EXPR_BODY (bind));
+
+ pop_gimplify_context (bind);
+ BIND_EXPR_VARS (bind) = chainon (BIND_EXPR_VARS (bind), ctx->block_vars);
+ BLOCK_VARS (block) = BIND_EXPR_VARS (bind);
+
+ DECL_INITIAL (ctx->cb.dst_fn) = block;
+ DECL_SAVED_TREE (ctx->cb.dst_fn) = bind;
+ cgraph_add_new_function (ctx->cb.dst_fn);
+
+ current_function_decl = ctx->cb.src_fn;
+ cfun = DECL_STRUCT_FUNCTION (current_function_decl);
+
+ block = make_node (BLOCK);
+ bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, block);
+ *stmt_p = bind;
+
+ push_gimplify_context ();
+
+ /* Second phase. Build the sender decl now that we're in the
+ correct context. Replace the original body of the directive with
+ sending code for data copying clauses and the parallel call to
+ launch children threads. */
+ if (ctx->record_type)
+ ctx->sender_decl = create_tmp_var (ctx->record_type, ".omp_data_o");
+
+ olist = NULL;
+ expand_send_clauses (clauses, &BIND_EXPR_BODY (bind), &olist, ctx);
+ expand_send_shared_vars (&BIND_EXPR_BODY (bind), &olist, ctx);
+ build_parallel_call (clauses, &BIND_EXPR_BODY (bind), ctx);
+ append_to_statement_list (olist, &BIND_EXPR_BODY (bind));
+
+ pop_gimplify_context (bind);
+ BLOCK_VARS (block) = BIND_EXPR_VARS (bind);
+}
+
+/* A subroutine of expand_omp_for_1. Generate code to emit the
+ for for a lastprivate clause. Given a loop control predicate
+ of (V cond N2), we gate the clause on (!(V cond N2)). */
+
+static void
+expand_omp_for_lastprivate (struct expand_omp_for_data *fd)
+{
+ tree clauses, cond;
+ enum tree_code cond_code;
+
+ cond_code = fd->cond_code;
+ cond_code = cond_code == LT_EXPR ? GE_EXPR : LE_EXPR;
+
+ /* When possible, use a strict equality expression. This can let VRP
+ type optimizations deduce the value and remove a copy. */
+ if (host_integerp (fd->step, 0))
+ {
+ HOST_WIDE_INT step = TREE_INT_CST_LOW (fd->step);
+ if (step == 1 || step == -1)
+ cond_code = EQ_EXPR;
+ }
+
+ cond = build2 (cond_code, boolean_type_node, fd->v, fd->n2);
+
+ clauses = OMP_FOR_CLAUSES (fd->for_stmt);
+ expand_lastprivate_clauses (clauses, cond, &fd->pre, fd->ctx);
+}
+
+/* A subroutine of expand_omp_for_1. Generate code for a parallel
+ loop with any schedule. Given parameters:
+
+ for (V = N1; V cond N2; V += STEP) BODY;
+
+ where COND is "<" or ">", we generate pseudocode
+
+ more = GOMP_loop_foo_start (N1, N2, STEP, CHUNK, &istart0, &iend0);
+ if (more) goto L0; else goto L2;
+ L0:
+ V = istart0;
+ iend = iend0;
+ L1:
+ BODY;
+ V += STEP;
+ if (V cond iend) goto L1;
+ more = GOMP_loop_foo_next (&istart0, &iend0);
+ if (more) goto L0;
+ lastprivate;
+ L2:
+
+ If this is a combined omp parallel loop, we can skip the call
+ to GOMP_loop_foo_start and generate
+
+ L0:
+ if (!GOMP_loop_foo_next (&istart0, &iend0)) goto L2;
+ V = istart0;
+ iend = iend0;
+ L1:
+ BODY;
+ V += STEP;
+ if (V cond iend) goto L1;
+ goto L0;
+ L2:
+ lastprivate;
+*/
+
+static void
+expand_omp_for_generic (struct expand_omp_for_data *fd,
+ enum built_in_function start_fn,
+ enum built_in_function next_fn)
+{
+ tree l0, l1, l2;
+ tree type, istart0, iend0, iend;
+ tree t, args;
+ bool in_combined_parallel = is_in_combined_parallel_ctx (fd->ctx);
+
+ type = TREE_TYPE (fd->v);
+
+ istart0 = create_tmp_var (long_integer_type_node, ".istart0");
+ iend0 = create_tmp_var (long_integer_type_node, ".iend0");
+
+ l0 = create_artificial_label ();
+ l1 = create_artificial_label ();
+ l2 = create_artificial_label ();
+ iend = create_tmp_var (type, NULL);
+
+ /* If this is a combined parallel loop, skip the call to
+ GOMP_loop_foo_start and call GOMP_loop_foo_next directly. */
+ if (in_combined_parallel)
+ {
+ t = build1 (LABEL_EXPR, void_type_node, l0);
+ gimplify_and_add (t, &fd->pre);
+ t = build_fold_addr_expr (iend0);
+ args = tree_cons (NULL, t, NULL);
+ t = build_fold_addr_expr (istart0);
+ args = tree_cons (NULL, t, args);
+ t = build_function_call_expr (built_in_decls[next_fn], args);
+ t = build1 (TRUTH_NOT_EXPR, TREE_TYPE (t), t);
+ t = build3 (COND_EXPR, void_type_node, t, build_and_jump (&l2), NULL);
+ gimplify_and_add (t, &fd->pre);
+ }
+ else
+ {
+ t = build_fold_addr_expr (iend0);
+ args = tree_cons (NULL, t, NULL);
+ t = build_fold_addr_expr (istart0);
+ args = tree_cons (NULL, t, args);
+ if (fd->chunk_size)
+ {
+ t = fold_convert (long_integer_type_node, fd->chunk_size);
+ args = tree_cons (NULL, t, args);
+ }
+ t = fold_convert (long_integer_type_node, fd->step);
+ args = tree_cons (NULL, t, args);
+ t = fold_convert (long_integer_type_node, fd->n2);
+ args = tree_cons (NULL, t, args);
+ t = fold_convert (long_integer_type_node, fd->n1);
+ args = tree_cons (NULL, t, args);
+ t = build_function_call_expr (built_in_decls[start_fn], args);
+ t = build3 (COND_EXPR, void_type_node, t,
+ build_and_jump (&l0), build_and_jump (&l2));
+ gimplify_and_add (t, &fd->pre);
+ t = build1 (LABEL_EXPR, void_type_node, l0);
+ gimplify_and_add (t, &fd->pre);
+ }
+
+ t = fold_convert (type, istart0);
+ t = build2 (MODIFY_EXPR, void_type_node, fd->v, t);
+ gimplify_and_add (t, &fd->pre);
+
+ t = fold_convert (type, iend0);
+ t = build2 (MODIFY_EXPR, void_type_node, iend, t);
+ gimplify_and_add (t, &fd->pre);
+
+ t = build1 (LABEL_EXPR, void_type_node, l1);
+ gimplify_and_add (t, &fd->pre);
+
+ append_to_statement_list (OMP_FOR_BODY (fd->for_stmt), &fd->pre);
+
+ t = build2 (PLUS_EXPR, type, fd->v, fd->step);
+ t = build2 (MODIFY_EXPR, void_type_node, fd->v, t);
+ gimplify_and_add (t, &fd->pre);
+
+ t = build2 (fd->cond_code, boolean_type_node, fd->v, iend);
+ t = build3 (COND_EXPR, void_type_node, t, build_and_jump (&l1), NULL);
+ gimplify_and_add (t, &fd->pre);
+
+ /* If emitting a combined parallel loop, we only need to emit a jump
+ back to L0 to call GOMP_loop_foo_next again. */
+ if (in_combined_parallel)
+ {
+ t = build_and_jump (&l0);
+ gimplify_and_add (t, &fd->pre);
+ }
+ else
+ {
+ t = build_fold_addr_expr (iend0);
+ args = tree_cons (NULL, t, NULL);
+ t = build_fold_addr_expr (istart0);
+ args = tree_cons (NULL, t, args);
+ t = build_function_call_expr (built_in_decls[next_fn], args);
+ t = build3 (COND_EXPR, void_type_node, t, build_and_jump (&l0), NULL);
+ gimplify_and_add (t, &fd->pre);
+ }
+
+ expand_omp_for_lastprivate (fd);
+
+ t = build1 (LABEL_EXPR, void_type_node, l2);
+ gimplify_and_add (t, &fd->pre);
+}
+
+
+/* A subroutine of expand_omp_for_1. Generate code for a parallel
+ loop with static schedule and no specified chunk size. Given parameters:
+
+ for (V = N1; V cond N2; V += STEP) BODY;
+
+ where COND is "<" or ">", we generate pseudocode
+
+ if (cond is <)
+ adj = STEP - 1;
+ else
+ adj = STEP + 1;
+ n = (adj + N2 - N1) / STEP;
+ q = n / nthreads;
+ q += (q * nthreads != n);
+ s0 = q * threadid;
+ e0 = min(s0 + q, n);
+ if (s0 >= e0) goto L2; else goto L0;
+ L0:
+ V = s0 * STEP + N1;
+ e = e0 * STEP + N1;
+ L1:
+ BODY;
+ V += STEP;
+ if (V cond e) goto L1;
+ lastprivate;
+ L2:
+*/
+
+static void
+expand_omp_for_static_nochunk (struct expand_omp_for_data *fd)
+{
+ tree l0, l1, l2, n, q, s0, e0, e, t, nthreads, threadid;
+ tree type, utype;
+
+ l0 = create_artificial_label ();
+ l1 = create_artificial_label ();
+ l2 = create_artificial_label ();
+
+ type = TREE_TYPE (fd->v);
+ utype = lang_hooks.types.unsigned_type (type);
+
+ t = built_in_decls[BUILT_IN_OMP_GET_NUM_THREADS];
+ t = build_function_call_expr (t, NULL);
+ t = fold_convert (utype, t);
+ nthreads = get_formal_tmp_var (t, &fd->pre);
+
+ t = built_in_decls[BUILT_IN_OMP_GET_THREAD_NUM];
+ t = build_function_call_expr (t, NULL);
+ t = fold_convert (utype, t);
+ threadid = get_formal_tmp_var (t, &fd->pre);
+
+ fd->n1 = fold_convert (type, fd->n1);
+ if (!is_gimple_val (fd->n1))
+ fd->n1 = get_formal_tmp_var (fd->n1, &fd->pre);
+
+ fd->n2 = fold_convert (type, fd->n2);
+ if (!is_gimple_val (fd->n2))
+ fd->n2 = get_formal_tmp_var (fd->n2, &fd->pre);
+
+ fd->step = fold_convert (type, fd->step);
+ if (!is_gimple_val (fd->step))
+ fd->step = get_formal_tmp_var (fd->step, &fd->pre);
+
+ t = build_int_cst (type, (fd->cond_code == LT_EXPR ? -1 : 1));
+ t = fold_build2 (PLUS_EXPR, type, fd->step, t);
+ t = fold_build2 (PLUS_EXPR, type, t, fd->n2);
+ t = fold_build2 (MINUS_EXPR, type, t, fd->n1);
+ t = fold_build2 (TRUNC_DIV_EXPR, type, t, fd->step);
+ t = fold_convert (utype, t);
+ if (is_gimple_val (t))
+ n = t;
+ else
+ n = get_formal_tmp_var (t, &fd->pre);
+
+ t = build2 (TRUNC_DIV_EXPR, utype, n, nthreads);
+ q = get_formal_tmp_var (t, &fd->pre);
+
+ t = build2 (MULT_EXPR, utype, q, nthreads);
+ t = build2 (NE_EXPR, utype, t, n);
+ t = build2 (PLUS_EXPR, utype, q, t);
+ q = get_formal_tmp_var (t, &fd->pre);
+
+ t = build2 (MULT_EXPR, utype, q, threadid);
+ s0 = get_formal_tmp_var (t, &fd->pre);
+
+ t = build2 (PLUS_EXPR, utype, s0, q);
+ t = build2 (MIN_EXPR, utype, t, n);
+ e0 = get_formal_tmp_var (t, &fd->pre);
+
+ t = build2 (GE_EXPR, boolean_type_node, s0, e0);
+ t = build3 (COND_EXPR, void_type_node, t,
+ build_and_jump (&l2), build_and_jump (&l0));
+ gimplify_and_add (t, &fd->pre);
+
+ t = build1 (LABEL_EXPR, void_type_node, l0);
+ gimplify_and_add (t, &fd->pre);
+
+ t = fold_convert (type, s0);
+ t = build2 (MULT_EXPR, type, t, fd->step);
+ t = build2 (PLUS_EXPR, type, t, fd->n1);
+ t = build2 (MODIFY_EXPR, void_type_node, fd->v, t);
+ gimplify_and_add (t, &fd->pre);
+
+ t = fold_convert (type, e0);
+ t = build2 (MULT_EXPR, type, t, fd->step);
+ t = build2 (PLUS_EXPR, type, t, fd->n1);
+ e = get_formal_tmp_var (t, &fd->pre);
+
+ t = build1 (LABEL_EXPR, void_type_node, l1);
+ gimplify_and_add (t, &fd->pre);
+
+ append_to_statement_list (OMP_FOR_BODY (fd->for_stmt), &fd->pre);
+
+ t = build2 (PLUS_EXPR, type, fd->v, fd->step);
+ t = build2 (MODIFY_EXPR, void_type_node, fd->v, t);
+ gimplify_and_add (t, &fd->pre);
+
+ t = build2 (fd->cond_code, boolean_type_node, fd->v, e);
+ t = build3 (COND_EXPR, void_type_node, t, build_and_jump (&l1), NULL);
+ gimplify_and_add (t, &fd->pre);
+
+ expand_omp_for_lastprivate (fd);
+
+ t = build1 (LABEL_EXPR, void_type_node, l2);
+ gimplify_and_add (t, &fd->pre);
+}
+
+/* A subroutine of expand_omp_for_1. Generate code for a parallel
+ loop with static schedule and a specified chunk size. Given parameters:
+
+ for (V = N1; V cond N2; V += STEP) BODY;
+
+ where COND is "<" or ">", we generate pseudocode
+
+ if (cond is <)
+ adj = STEP - 1;
+ else
+ adj = STEP + 1;
+ n = (adj + N2 - N1) / STEP;
+ trip = 0;
+ L0:
+ s0 = (trip * nthreads + threadid) * CHUNK;
+ e0 = min(s0 + CHUNK, n);
+ if (s0 < n) goto L1; else goto L4;
+ L1:
+ V = s0 * STEP + N1;
+ e = e0 * STEP + N1;
+ L2:
+ BODY;
+ V += STEP;
+ if (V cond e) goto L2; else goto L3;
+ L3:
+ trip += 1;
+ goto L0;
+ L4:
+ if (trip == 0) goto L5;
+ lastprivate;
+ L5:
+*/
+
+static void
+expand_omp_for_static_chunk (struct expand_omp_for_data *fd)
+{
+ tree l0, l1, l2, l3, l4, l5, n, s0, e0, e, t;
+ tree trip, nthreads, threadid;
+ tree type, utype;
+
+ l0 = create_artificial_label ();
+ l1 = create_artificial_label ();
+ l2 = create_artificial_label ();
+ l3 = create_artificial_label ();
+ l4 = create_artificial_label ();
+ l5 = create_artificial_label ();
+
+ type = TREE_TYPE (fd->v);
+ utype = lang_hooks.types.unsigned_type (type);
+
+ t = built_in_decls[BUILT_IN_OMP_GET_NUM_THREADS];
+ t = build_function_call_expr (t, NULL);
+ t = fold_convert (utype, t);
+ nthreads = get_formal_tmp_var (t, &fd->pre);
+
+ t = built_in_decls[BUILT_IN_OMP_GET_THREAD_NUM];
+ t = build_function_call_expr (t, NULL);
+ t = fold_convert (utype, t);
+ threadid = get_formal_tmp_var (t, &fd->pre);
+
+ fd->n1 = fold_convert (type, fd->n1);
+ if (!is_gimple_val (fd->n1))
+ fd->n1 = get_formal_tmp_var (fd->n1, &fd->pre);
+
+ fd->n2 = fold_convert (type, fd->n2);
+ if (!is_gimple_val (fd->n2))
+ fd->n2 = get_formal_tmp_var (fd->n2, &fd->pre);
+
+ fd->step = fold_convert (type, fd->step);
+ if (!is_gimple_val (fd->step))
+ fd->step = get_formal_tmp_var (fd->step, &fd->pre);
+
+ fd->chunk_size = fold_convert (utype, fd->chunk_size);
+ if (!is_gimple_val (fd->chunk_size))
+ fd->chunk_size = get_formal_tmp_var (fd->chunk_size, &fd->pre);
+
+ t = build_int_cst (type, (fd->cond_code == LT_EXPR ? -1 : 1));
+ t = fold_build2 (PLUS_EXPR, type, fd->step, t);
+ t = fold_build2 (PLUS_EXPR, type, t, fd->n2);
+ t = fold_build2 (MINUS_EXPR, type, t, fd->n1);
+ t = fold_build2 (TRUNC_DIV_EXPR, type, t, fd->step);
+ t = fold_convert (utype, t);
+ if (is_gimple_val (t))
+ n = t;
+ else
+ n = get_formal_tmp_var (t, &fd->pre);
+
+ t = build_int_cst (utype, 0);
+ trip = get_initialized_tmp_var (t, &fd->pre, NULL);
+
+ t = build1 (LABEL_EXPR, void_type_node, l0);
+ gimplify_and_add (t, &fd->pre);
+
+ t = build2 (MULT_EXPR, utype, trip, nthreads);
+ t = build2 (PLUS_EXPR, utype, t, threadid);
+ t = build2 (MULT_EXPR, utype, t, fd->chunk_size);
+ s0 = get_formal_tmp_var (t, &fd->pre);
+
+ t = build2 (PLUS_EXPR, utype, s0, fd->chunk_size);
+ t = build2 (MIN_EXPR, utype, t, n);
+ e0 = get_formal_tmp_var (t, &fd->pre);
+
+ t = build2 (LT_EXPR, boolean_type_node, s0, n);
+ t = build3 (COND_EXPR, void_type_node, t,
+ build_and_jump (&l1), build_and_jump (&l4));
+ gimplify_and_add (t, &fd->pre);
+
+ t = build1 (LABEL_EXPR, void_type_node, l1);
+ gimplify_and_add (t, &fd->pre);
+
+ t = fold_convert (type, s0);
+ t = build2 (MULT_EXPR, type, t, fd->step);
+ t = build2 (PLUS_EXPR, type, t, fd->n1);
+ t = build2 (MODIFY_EXPR, void_type_node, fd->v, t);
+ gimplify_and_add (t, &fd->pre);
+
+ t = fold_convert (type, e0);
+ t = build2 (MULT_EXPR, type, t, fd->step);
+ t = build2 (PLUS_EXPR, type, t, fd->n1);
+ e = get_formal_tmp_var (t, &fd->pre);
+
+ t = build1 (LABEL_EXPR, void_type_node, l2);
+ gimplify_and_add (t, &fd->pre);
+
+ append_to_statement_list (OMP_FOR_BODY (fd->for_stmt), &fd->pre);
+
+ t = build2 (PLUS_EXPR, type, fd->v, fd->step);
+ t = build2 (MODIFY_EXPR, void_type_node, fd->v, t);
+ gimplify_and_add (t, &fd->pre);
+
+ t = build2 (fd->cond_code, boolean_type_node, fd->v, e);
+ t = build3 (COND_EXPR, void_type_node, t,
+ build_and_jump (&l2), build_and_jump (&l3));
+ gimplify_and_add (t, &fd->pre);
+
+ t = build1 (LABEL_EXPR, void_type_node, l3);
+ gimplify_and_add (t, &fd->pre);
+
+ t = build_int_cst (utype, 1);
+ t = build2 (PLUS_EXPR, utype, trip, t);
+ t = build2 (MODIFY_EXPR, void_type_node, trip, t);
+ gimplify_and_add (t, &fd->pre);
+
+ t = build1 (GOTO_EXPR, void_type_node, l0);
+ gimplify_and_add (t, &fd->pre);
+
+ t = build1 (LABEL_EXPR, void_type_node, l4);
+ gimplify_and_add (t, &fd->pre);
+
+ t = build_int_cst (utype, 0);
+ t = build2 (EQ_EXPR, boolean_type_node, trip, t);
+ t = build3 (COND_EXPR, void_type_node, t, build_and_jump (&l5), NULL);
+
+ expand_omp_for_lastprivate (fd);
+
+ t = build1 (LABEL_EXPR, void_type_node, l5);
+ gimplify_and_add (t, &fd->pre);
+}
+
+/* A subroutine of expand_omp_for. Expand the logic of the loop itself. */
+
+static tree
+expand_omp_for_1 (tree *stmt_p, omp_context *ctx)
+{
+ struct expand_omp_for_data fd;
+ tree dlist;
+
+ extract_omp_for_data (*stmt_p, ctx, &fd);
+
+ expand_rec_input_clauses (OMP_FOR_CLAUSES (fd.for_stmt),
+ &fd.pre, &dlist, ctx);
+
+ expand_omp (&OMP_FOR_PRE_BODY (fd.for_stmt), ctx);
+ append_to_statement_list (OMP_FOR_PRE_BODY (fd.for_stmt), &fd.pre);
+
+ if (fd.sched_kind == OMP_CLAUSE_SCHEDULE_STATIC && !fd.have_ordered)
+ {
+ if (fd.chunk_size == NULL)
+ expand_omp_for_static_nochunk (&fd);
+ else
+ expand_omp_for_static_chunk (&fd);
+ }
+ else
+ {
+ int fn_index;
+
+ fn_index = fd.sched_kind + fd.have_ordered * 4;
+
+ expand_omp_for_generic (&fd, BUILT_IN_GOMP_LOOP_STATIC_START + fn_index,
+ BUILT_IN_GOMP_LOOP_STATIC_NEXT + fn_index);
+ }
+
+ expand_reduction_clauses (OMP_FOR_CLAUSES (fd.for_stmt), &fd.pre, ctx);
+ append_to_statement_list (dlist, &fd.pre);
+
+ /* If this parallel loop was part of a combined parallel loop
+ directive, inform the parent parallel what flavour of
+ GOMP_parallel_loop_XXX_start to use. */
+ if (is_in_combined_parallel_ctx (ctx))
+ {
+ int start_ix = BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START + fd.sched_kind;
+ ctx->outer->parallel_start_ix = start_ix;
+ }
+ else if (!fd.have_nowait)
+ build_omp_barrier (&fd.pre);
+
+ return fd.pre;
+}
+
+/* Expand code for an OpenMP loop directive. */
+
+static void
+expand_omp_for (tree *stmt_p, omp_context *ctx)
+{
+ tree bind, block, stmt_list;
+
+ push_gimplify_context ();
+
+ expand_omp (&OMP_FOR_BODY (*stmt_p), ctx);
+
+ stmt_list = expand_omp_for_1 (stmt_p, ctx);
+ block = make_node (BLOCK);
+ bind = build3 (BIND_EXPR, void_type_node, NULL, stmt_list, block);
+ maybe_catch_exception (&BIND_EXPR_BODY (bind));
+ *stmt_p = bind;
+
+ pop_gimplify_context (bind);
+ BIND_EXPR_VARS (bind) = chainon (BIND_EXPR_VARS (bind), ctx->block_vars);
+ BLOCK_VARS (block) = BIND_EXPR_VARS (bind);
+}
+
+/* Expand code for an OpenMP sections directive. In pseudo code, we generate
+
+ firstprivate;
+ v = GOMP_sections_start (n);
+ L0:
+ switch (v)
+ {
+ case 0:
+ goto L2;
+ case 1:
+ section 1;
+ goto L1;
+ case 2:
+ ...
+ case n:
+ ...
+ lastprivate;
+ default:
+ abort ();
+ }
+ L1:
+ v = GOMP_sections_next ();
+ goto L0;
+ L2:
+ reduction;
+
+ If this is a combined parallel sections skip the call to
+ GOMP_sections_start and emit the call to GOMP_sections_next right
+ before the switch(). */
+
+static void
+expand_omp_sections (tree *stmt_p, omp_context *ctx)
+{
+ tree sec_stmt, label_vec, bind, block, stmt_list, l0, l1, l2, t, u, v;
+ tree_stmt_iterator tsi;
+ tree dlist;
+ unsigned i, len;
+ bool in_combined_parallel = is_in_combined_parallel_ctx (ctx);
+
+ sec_stmt = *stmt_p;
+ stmt_list = NULL;
+
+ push_gimplify_context ();
+
+ expand_rec_input_clauses (OMP_SECTIONS_CLAUSES (sec_stmt),
+ &stmt_list, &dlist, ctx);
+
+ tsi = tsi_start (OMP_SECTIONS_BODY (sec_stmt));
+ for (len = 0; !tsi_end_p (tsi); len++, tsi_next (&tsi))
+ continue;
+
+ l0 = create_artificial_label ();
+ l1 = create_artificial_label ();
+ l2 = create_artificial_label ();
+ v = create_tmp_var (unsigned_type_node, ".section");
+ label_vec = make_tree_vec (len + 2);
+
+ t = build_int_cst (unsigned_type_node, len);
+ t = tree_cons (NULL, t, NULL);
+
+ if (in_combined_parallel)
+ {
+ /* Nothing to do. Just inform our parent of the additional
+ arguments to invoke GOMP_parallel_sections_start. */
+ ctx->outer->parallel_start_ix = BUILT_IN_GOMP_PARALLEL_SECTIONS_START;
+ ctx->outer->parallel_start_additional_args = t;
+ }
+ else
+ {
+ u = built_in_decls[BUILT_IN_GOMP_SECTIONS_START];
+ t = build_function_call_expr (u, t);
+ t = build2 (MODIFY_EXPR, void_type_node, v, t);
+ gimplify_and_add (t, &stmt_list);
+ }
+
+ t = build1 (LABEL_EXPR, void_type_node, l0);
+ gimplify_and_add (t, &stmt_list);
+
+ if (in_combined_parallel)
+ {
+ /* Combined parallel sections need the call to GOMP_sections_next
+ before the switch(). */
+ t = built_in_decls[BUILT_IN_GOMP_SECTIONS_NEXT];
+ t = build_function_call_expr (t, NULL);
+ t = build2 (MODIFY_EXPR, void_type_node, v, t);
+ gimplify_and_add (t, &stmt_list);
+ }
+
+ t = build3 (SWITCH_EXPR, void_type_node, v, NULL, label_vec);
+ gimplify_and_add (t, &stmt_list);
+
+ t = build3 (CASE_LABEL_EXPR, void_type_node,
+ build_int_cst (unsigned_type_node, 0), NULL, l2);
+ TREE_VEC_ELT (label_vec, 0) = t;
+
+ tsi = tsi_start (OMP_SECTIONS_BODY (sec_stmt));
+ for (i = 0; i < len; i++, tsi_next (&tsi))
+ {
+ omp_context *sctx;
+
+ t = create_artificial_label ();
+ u = build_int_cst (unsigned_type_node, i + 1);
+ u = build3 (CASE_LABEL_EXPR, void_type_node, u, NULL, t);
+ TREE_VEC_ELT (label_vec, i + 1) = u;
+ t = build1 (LABEL_EXPR, void_type_node, t);
+ gimplify_and_add (t, &stmt_list);
+
+ t = tsi_stmt (tsi);
+ sctx = maybe_lookup_ctx (t);
+ gcc_assert (sctx);
+ expand_omp (&OMP_SECTION_BODY (t), sctx);
+ append_to_statement_list (OMP_SECTION_BODY (t), &stmt_list);
+
+ if (i == len - 1)
+ expand_lastprivate_clauses (OMP_SECTIONS_CLAUSES (sec_stmt),
+ NULL, &stmt_list, ctx);
+
+ t = build1 (GOTO_EXPR, void_type_node, l1);
+ gimplify_and_add (t, &stmt_list);
+ }
+
+ t = create_artificial_label ();
+ u = build3 (CASE_LABEL_EXPR, void_type_node, NULL, NULL, t);
+ TREE_VEC_ELT (label_vec, len + 1) = u;
+ t = build1 (LABEL_EXPR, void_type_node, t);
+ gimplify_and_add (t, &stmt_list);
+
+ t = built_in_decls[BUILT_IN_TRAP];
+ t = build_function_call_expr (t, NULL);
+ gimplify_and_add (t, &stmt_list);
+
+ t = build1 (LABEL_EXPR, void_type_node, l1);
+ gimplify_and_add (t, &stmt_list);
+
+ if (!in_combined_parallel)
+ {
+ t = built_in_decls[BUILT_IN_GOMP_SECTIONS_NEXT];
+ t = build_function_call_expr (t, NULL);
+ t = build2 (MODIFY_EXPR, void_type_node, v, t);
+ gimplify_and_add (t, &stmt_list);
+ }
+
+ t = build1 (GOTO_EXPR, void_type_node, l0);
+ gimplify_and_add (t, &stmt_list);
+
+ t = build1 (LABEL_EXPR, void_type_node, l2);
+ gimplify_and_add (t, &stmt_list);
+
+ expand_reduction_clauses (OMP_SECTIONS_CLAUSES (sec_stmt), &stmt_list, ctx);
+ append_to_statement_list (dlist, &stmt_list);
+
+ /* Unless there's a nowait clause, add a barrier afterward. */
+ if (!find_omp_clause (OMP_SECTIONS_CLAUSES (sec_stmt), OMP_CLAUSE_NOWAIT))
+ build_omp_barrier (&stmt_list);
+
+ block = make_node (BLOCK);
+ bind = build3 (BIND_EXPR, void_type_node, NULL, stmt_list, block);
+ maybe_catch_exception (&BIND_EXPR_BODY (bind));
+ *stmt_p = bind;
+
+ pop_gimplify_context (bind);
+ BIND_EXPR_VARS (bind) = chainon (BIND_EXPR_VARS (bind), ctx->block_vars);
+ BLOCK_VARS (block) = BIND_EXPR_VARS (bind);
+}
+
+
+/* A subroutine of expand_omp_single. Expand the simple form of
+ an OMP_SINGLE, without a copyprivate clause:
+
+ if (GOMP_single_start ())
+ BODY;
+ [ GOMP_barrier (); ] -> unless 'nowait' is present.
+*/
+
+static void
+expand_omp_single_simple (tree single_stmt, tree *pre_p)
+{
+ tree t;
+
+ t = built_in_decls[BUILT_IN_GOMP_SINGLE_START];
+ t = build_function_call_expr (t, NULL);
+ t = build3 (COND_EXPR, void_type_node, t,
+ OMP_SINGLE_BODY (single_stmt), NULL);
+ gimplify_and_add (t, pre_p);
+
+ if (!find_omp_clause (OMP_SINGLE_CLAUSES (single_stmt), OMP_CLAUSE_NOWAIT))
+ build_omp_barrier (pre_p);
+}
+
+/* A subroutine of expand_omp_single. Expand the simple form of
+ an OMP_SINGLE, with a copyprivate clause:
+
+ #pragma omp single copyprivate (a, b, c)
+
+ Create a new structure to hold copies of 'a', 'b' and 'c' and emit:
+
+ {
+ if ((copyout_p = GOMP_single_copy_start ()) == NULL)
+ {
+ BODY;
+ copyout.a = a;
+ copyout.b = b;
+ copyout.c = c;
+ GOMP_single_copy_end (©out);
+ }
+ else
+ {
+ a = copyout_p->a;
+ b = copyout_p->b;
+ c = copyout_p->c;
+ }
+ GOMP_barrier ();
+ }
+*/
+
+static void
+expand_omp_single_copy (tree single_stmt, tree *pre_p, omp_context *ctx)
+{
+ tree ptr_type, t, args, l0, l1, l2, copyin_seq;
+
+ ctx->sender_decl = create_tmp_var (ctx->record_type, ".omp_copy_o");
+
+ ptr_type = build_pointer_type (ctx->record_type);
+ ctx->receiver_decl = create_tmp_var (ptr_type, ".omp_copy_i");
+
+ l0 = create_artificial_label ();
+ l1 = create_artificial_label ();
+ l2 = create_artificial_label ();
+
+ t = built_in_decls[BUILT_IN_GOMP_SINGLE_COPY_START];
+ t = build_function_call_expr (t, NULL);
+ t = fold_convert (ptr_type, t);
+ t = build2 (MODIFY_EXPR, void_type_node, ctx->receiver_decl, t);
+ gimplify_and_add (t, pre_p);
+
+ t = build2 (EQ_EXPR, boolean_type_node, ctx->receiver_decl,
+ build_int_cst (ptr_type, 0));
+ t = build3 (COND_EXPR, void_type_node, t,
+ build_and_jump (&l0), build_and_jump (&l1));
+ gimplify_and_add (t, pre_p);
+
+ t = build1 (LABEL_EXPR, void_type_node, l0);
+ gimplify_and_add (t, pre_p);
+
+ append_to_statement_list (OMP_SINGLE_BODY (single_stmt), pre_p);
+
+ copyin_seq = NULL;
+ expand_copyprivate_clauses (OMP_SINGLE_CLAUSES (single_stmt), pre_p,
+ ©in_seq, ctx);
+
+ t = build_fold_addr_expr (ctx->sender_decl);
+ args = tree_cons (NULL, t, NULL);
+ t = built_in_decls[BUILT_IN_GOMP_SINGLE_COPY_END];
+ t = build_function_call_expr (t, args);
+ gimplify_and_add (t, pre_p);
+
+ t = build_and_jump (&l2);
+ gimplify_and_add (t, pre_p);
+
+ t = build1 (LABEL_EXPR, void_type_node, l1);
+ gimplify_and_add (t, pre_p);
+
+ append_to_statement_list (copyin_seq, pre_p);
+
+ t = build1 (LABEL_EXPR, void_type_node, l2);
+ gimplify_and_add (t, pre_p);
+
+ build_omp_barrier (pre_p);
+}
+
+/* Expand code for an OpenMP single directive. */
+
+static void
+expand_omp_single (tree *stmt_p, omp_context *ctx)
+{
+ tree bind, block, single_stmt = *stmt_p, dlist;
+
+ push_gimplify_context ();
+
+ block = make_node (BLOCK);
+ bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, block);
+ *stmt_p = bind;
+
+ expand_rec_input_clauses (OMP_SINGLE_CLAUSES (single_stmt),
+ &BIND_EXPR_BODY (bind), &dlist, ctx);
+
+ expand_omp (&OMP_SINGLE_BODY (single_stmt), ctx);
+
+ if (ctx->record_type)
+ expand_omp_single_copy (single_stmt, &BIND_EXPR_BODY (bind), ctx);
+ else
+ expand_omp_single_simple (single_stmt, &BIND_EXPR_BODY (bind));
+
+ append_to_statement_list (dlist, &BIND_EXPR_BODY (bind));
+
+ maybe_catch_exception (&BIND_EXPR_BODY (bind));
+ pop_gimplify_context (bind);
+ BIND_EXPR_VARS (bind) = chainon (BIND_EXPR_VARS (bind), ctx->block_vars);
+ BLOCK_VARS (block) = BIND_EXPR_VARS (bind);
+}
+
+/* Expand code for an OpenMP master directive. */
+
+static void
+expand_omp_master (tree *stmt_p, omp_context *ctx)
+{
+ tree bind, block, stmt = *stmt_p, lab = NULL, x;
+
+ push_gimplify_context ();
+
+ block = make_node (BLOCK);
+ bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, block);
+ *stmt_p = bind;
+
+ x = built_in_decls[BUILT_IN_OMP_GET_THREAD_NUM];
+ x = build_function_call_expr (x, NULL);
+ x = build2 (EQ_EXPR, boolean_type_node, x, integer_zero_node);
+ x = build3 (COND_EXPR, void_type_node, x, NULL, build_and_jump (&lab));
+ gimplify_and_add (x, &BIND_EXPR_BODY (bind));
+
+ expand_omp (&OMP_MASTER_BODY (stmt), ctx);
+ append_to_statement_list (OMP_MASTER_BODY (stmt), &BIND_EXPR_BODY (bind));
+
+ x = build1 (LABEL_EXPR, void_type_node, lab);
+ gimplify_and_add (x, &BIND_EXPR_BODY (bind));
+
+ maybe_catch_exception (&BIND_EXPR_BODY (bind));
+ pop_gimplify_context (bind);
+ BIND_EXPR_VARS (bind) = chainon (BIND_EXPR_VARS (bind), ctx->block_vars);
+ BLOCK_VARS (block) = BIND_EXPR_VARS (bind);
+}
+
+/* Expand code for an OpenMP ordered directive. */
+
+static void
+expand_omp_ordered (tree *stmt_p, omp_context *ctx)
+{
+ tree bind, block, stmt = *stmt_p, x;
+
+ push_gimplify_context ();
+
+ block = make_node (BLOCK);
+ bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, block);
+ *stmt_p = bind;
+
+ x = built_in_decls[BUILT_IN_GOMP_ORDERED_START];
+ x = build_function_call_expr (x, NULL);
+ gimplify_and_add (x, &BIND_EXPR_BODY (bind));
+
+ expand_omp (&OMP_ORDERED_BODY (stmt), ctx);
+ append_to_statement_list (OMP_ORDERED_BODY (stmt), &BIND_EXPR_BODY (bind));
+
+ x = built_in_decls[BUILT_IN_GOMP_ORDERED_END];
+ x = build_function_call_expr (x, NULL);
+ gimplify_and_add (x, &BIND_EXPR_BODY (bind));
+
+ maybe_catch_exception (&BIND_EXPR_BODY (bind));
+ pop_gimplify_context (bind);
+ BIND_EXPR_VARS (bind) = chainon (BIND_EXPR_VARS (bind), ctx->block_vars);
+ BLOCK_VARS (block) = BIND_EXPR_VARS (bind);
+}
+
+/* Expand code for an OpenMP critical directive. */
+
+/* Gimplify an OMP_CRITICAL statement. This is a relatively simple
+ substitution of a couple of function calls. But in the NAMED case,
+ requires that languages coordinate a symbol name. It is therefore
+ best put here in common code. */
+
+static GTY((param1_is (tree), param2_is (tree)))
+ splay_tree critical_name_mutexes;
+
+static void
+expand_omp_critical (tree *stmt_p, omp_context *ctx)
+{
+ tree bind, block, stmt = *stmt_p;
+ tree lock, unlock, name;
+
+ name = OMP_CRITICAL_NAME (stmt);
+ if (name)
+ {
+ tree decl, args;
+ splay_tree_node n;
+
+ if (!critical_name_mutexes)
+ critical_name_mutexes
+ = splay_tree_new_ggc (splay_tree_compare_pointers);
+
+ n = splay_tree_lookup (critical_name_mutexes, (splay_tree_key) name);
+ if (n == NULL)
+ {
+ char *new_str;
+
+ decl = create_tmp_var_raw (ptr_type_node, NULL);
+
+ new_str = ACONCAT ((".gomp_critical_user_",
+ IDENTIFIER_POINTER (name), NULL));
+ DECL_NAME (decl) = get_identifier (new_str);
+ TREE_PUBLIC (decl) = 1;
+ TREE_STATIC (decl) = 1;
+ DECL_COMMON (decl) = 1;
+ DECL_ARTIFICIAL (decl) = 1;
+ DECL_IGNORED_P (decl) = 1;
+ cgraph_varpool_finalize_decl (decl);
+
+ splay_tree_insert (critical_name_mutexes, (splay_tree_key) name,
+ (splay_tree_value) decl);
+ }
+ else
+ decl = (tree) n->value;
+
+ args = tree_cons (NULL, build_fold_addr_expr (decl), NULL);
+ lock = built_in_decls[BUILT_IN_GOMP_CRITICAL_NAME_START];
+ lock = build_function_call_expr (lock, args);
+
+ args = tree_cons (NULL, build_fold_addr_expr (decl), NULL);
+ unlock = built_in_decls[BUILT_IN_GOMP_CRITICAL_NAME_END];
+ unlock = build_function_call_expr (unlock, args);
+ }
+ else
+ {
+ lock = built_in_decls[BUILT_IN_GOMP_CRITICAL_START];
+ lock = build_function_call_expr (lock, NULL);
+
+ unlock = built_in_decls[BUILT_IN_GOMP_CRITICAL_END];
+ unlock = build_function_call_expr (unlock, NULL);
+ }
+
+ push_gimplify_context ();
+
+ block = make_node (BLOCK);
+ bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, block);
+ *stmt_p = bind;
+
+ gimplify_and_add (lock, &BIND_EXPR_BODY (bind));
+
+ expand_omp (&OMP_CRITICAL_BODY (stmt), ctx);
+ maybe_catch_exception (&OMP_CRITICAL_BODY (stmt));
+ append_to_statement_list (OMP_CRITICAL_BODY (stmt), &BIND_EXPR_BODY (bind));
+
+ gimplify_and_add (unlock, &BIND_EXPR_BODY (bind));
+
+ pop_gimplify_context (bind);
+ BIND_EXPR_VARS (bind) = chainon (BIND_EXPR_VARS (bind), ctx->block_vars);
+ BLOCK_VARS (block) = BIND_EXPR_VARS (bind);
+}
+
+/* Pass *TP back through the gimplifier within the context determined by WI.
+ This handles replacement of DECL_VALUE_EXPR, as well as adjusting the
+ flags on ADDR_EXPR. */
+
+static void
+expand_regimplify (tree *tp, struct walk_stmt_info *wi)
+{
+ enum gimplify_status gs;
+ tree pre = NULL;
+
+ if (wi->is_lhs)
+ gs = gimplify_expr (tp, &pre, NULL, is_gimple_lvalue, fb_lvalue);
+ else if (wi->val_only)
+ gs = gimplify_expr (tp, &pre, NULL, is_gimple_val, fb_rvalue);
+ else
+ gs = gimplify_expr (tp, &pre, NULL, is_gimple_formal_tmp_var, fb_rvalue);
+ gcc_assert (gs == GS_ALL_DONE);
+
+ if (pre)
+ tsi_link_before (&wi->tsi, pre, TSI_SAME_STMT);
+}
+
+static tree
+expand_omp_1 (tree *tp, int *walk_subtrees, void *data)
+{
+ struct walk_stmt_info *wi = data;
+ omp_context *ctx = wi->info;
+ tree t = *tp;
+
+ *walk_subtrees = 0;
+ switch (TREE_CODE (*tp))
+ {
+ case OMP_PARALLEL:
+ ctx = maybe_lookup_ctx (t);
+ if (!ctx->is_nested)
+ expand_omp_parallel (tp, ctx);
+ break;
+
+ case OMP_FOR:
+ ctx = maybe_lookup_ctx (t);
+ gcc_assert (ctx);
+ expand_omp_for (tp, ctx);
+ break;
+
+ case OMP_SECTIONS:
+ ctx = maybe_lookup_ctx (t);
+ gcc_assert (ctx);
+ expand_omp_sections (tp, ctx);
+ break;
+
+ case OMP_SINGLE:
+ ctx = maybe_lookup_ctx (t);
+ gcc_assert (ctx);
+ expand_omp_single (tp, ctx);
+ break;
+
+ case OMP_MASTER:
+ ctx = maybe_lookup_ctx (t);
+ gcc_assert (ctx);
+ expand_omp_master (tp, ctx);
+ break;
+
+ case OMP_ORDERED:
+ ctx = maybe_lookup_ctx (t);
+ gcc_assert (ctx);
+ expand_omp_ordered (tp, ctx);
+ break;
+
+ case OMP_CRITICAL:
+ ctx = maybe_lookup_ctx (t);
+ gcc_assert (ctx);
+ expand_omp_critical (tp, ctx);
+ break;
+
+ case VAR_DECL:
+ if (ctx && DECL_HAS_VALUE_EXPR_P (t))
+ expand_regimplify (tp, wi);
+ break;
+
+ case ADDR_EXPR:
+ if (ctx)
+ expand_regimplify (tp, wi);
+ break;
+
+ case ARRAY_REF:
+ case ARRAY_RANGE_REF:
+ case REALPART_EXPR:
+ case IMAGPART_EXPR:
+ case COMPONENT_REF:
+ case VIEW_CONVERT_EXPR:
+ if (ctx)
+ expand_regimplify (tp, wi);
+ break;
+
+ case INDIRECT_REF:
+ if (ctx)
+ {
+ wi->is_lhs = false;
+ wi->val_only = true;
+ expand_regimplify (&TREE_OPERAND (t, 0), wi);
+ }
+ break;
+
+ default:
+ if (!TYPE_P (t) && !DECL_P (t))
+ *walk_subtrees = 1;
+ break;
+ }
+
+ return NULL_TREE;
+}
+
+static void
+expand_omp (tree *stmt_p, omp_context *ctx)
+{
+ struct walk_stmt_info wi;
+
+ memset (&wi, 0, sizeof (wi));
+ wi.callback = expand_omp_1;
+ wi.info = ctx;
+ wi.val_only = true;
+ wi.want_locations = true;
+
+ walk_stmts (&wi, stmt_p);
+}
+\f
+/* Main entry point. */
+
+static void
+execute_lower_omp (void)
+{
+ all_contexts = splay_tree_new (splay_tree_compare_pointers, 0,
+ delete_omp_context);
+
+ scan_omp (&DECL_SAVED_TREE (current_function_decl), NULL);
+ gcc_assert (parallel_nesting_level == 0);
+
+ if (all_contexts->root)
+ expand_omp (&DECL_SAVED_TREE (current_function_decl), NULL);
+
+ splay_tree_delete (all_contexts);
+ all_contexts = NULL;
+}
+
+static bool
+gate_lower_omp (void)
+{
+ return flag_openmp != 0;
+}
+
+struct tree_opt_pass pass_lower_omp =
+{
+ "omplower", /* name */
+ gate_lower_omp, /* gate */
+ execute_lower_omp, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ 0, /* tv_id */
+ PROP_gimple_any, /* properties_required */
+ PROP_gimple_lomp, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_dump_func, /* todo_flags_finish */
+ 0 /* letter */
+};
+
+\f
+/* The following is a utility to diagnose OpenMP structured block violations.
+ It's part of the "omplower" pass, as that's invoked too late. It should
+ be invoked by the respective front ends after gimplification. */
+
+static splay_tree all_labels;
+
+/* Check for mismatched contexts and generate an error if needed. Return
+ true if an error is detected. */
+
+static bool
+diagnose_sb_0 (tree *stmt_p, tree branch_ctx, tree label_ctx)
+{
+ bool exit_p = true;
+
+ if ((label_ctx ? TREE_VALUE (label_ctx) : NULL) == branch_ctx)
+ return false;
+
+ /* Try to avoid confusing the user by producing and error message
+ with correct "exit" or "enter" verbage. We prefer "exit"
+ unless we can show that LABEL_CTX is nested within BRANCH_CTX. */
+ if (branch_ctx == NULL)
+ exit_p = false;
+ else
+ {
+ while (label_ctx)
+ {
+ if (TREE_VALUE (label_ctx) == branch_ctx)
+ {
+ exit_p = false;
+ break;
+ }
+ label_ctx = TREE_CHAIN (label_ctx);
+ }
+ }
+
+ if (exit_p)
+ error ("invalid exit from OpenMP structured block");
+ else
+ error ("invalid entry to OpenMP structured block");
+
+ *stmt_p = build_empty_stmt ();
+ return true;
+}
+
+/* Pass 1: Create a minimal tree of OpenMP structured blocks, and record
+ where in the tree each label is found. */
+
+static tree
+diagnose_sb_1 (tree *tp, int *walk_subtrees, void *data)
+{
+ struct walk_stmt_info *wi = data;
+ tree context = (tree) wi->info;
+ tree inner_context;
+ tree t = *tp;
+
+ *walk_subtrees = 0;
+ switch (TREE_CODE (t))
+ {
+ case OMP_PARALLEL:
+ case OMP_SECTIONS:
+ case OMP_SINGLE:
+ walk_tree (&OMP_CLAUSES (t), diagnose_sb_1, wi, NULL);
+ /* FALLTHRU */
+ case OMP_SECTION:
+ case OMP_MASTER:
+ case OMP_ORDERED:
+ case OMP_CRITICAL:
+ /* The minimal context here is just a tree of statements. */
+ inner_context = tree_cons (NULL, t, context);
+ wi->info = inner_context;
+ walk_stmts (wi, &OMP_BODY (t));
+ wi->info = context;
+ break;
+
+ case OMP_FOR:
+ walk_tree (&OMP_FOR_CLAUSES (t), diagnose_sb_1, wi, NULL);
+ inner_context = tree_cons (NULL, t, context);
+ wi->info = inner_context;
+ walk_tree (&OMP_FOR_INIT (t), diagnose_sb_1, wi, NULL);
+ walk_tree (&OMP_FOR_COND (t), diagnose_sb_1, wi, NULL);
+ walk_tree (&OMP_FOR_INCR (t), diagnose_sb_1, wi, NULL);
+ walk_stmts (wi, &OMP_FOR_PRE_BODY (t));
+ walk_stmts (wi, &OMP_FOR_BODY (t));
+ wi->info = context;
+ break;
+
+ case LABEL_EXPR:
+ splay_tree_insert (all_labels, (splay_tree_key) LABEL_EXPR_LABEL (t),
+ (splay_tree_value) context);
+ break;
+
+ default:
+ break;
+ }
+
+ return NULL_TREE;
+}
+
+/* Pass 2: Check each branch and see if its context differs from that of
+ the destination label's context. */
+
+static tree
+diagnose_sb_2 (tree *tp, int *walk_subtrees, void *data)
+{
+ struct walk_stmt_info *wi = data;
+ tree context = (tree) wi->info;
+ splay_tree_node n;
+ tree t = *tp;
+
+ *walk_subtrees = 0;
+ switch (TREE_CODE (t))
+ {
+ case OMP_PARALLEL:
+ case OMP_SECTIONS:
+ case OMP_SINGLE:
+ walk_tree (&OMP_CLAUSES (t), diagnose_sb_2, wi, NULL);
+ /* FALLTHRU */
+ case OMP_SECTION:
+ case OMP_MASTER:
+ case OMP_ORDERED:
+ case OMP_CRITICAL:
+ wi->info = t;
+ walk_stmts (wi, &OMP_BODY (t));
+ wi->info = context;
+ break;
+
+ case OMP_FOR:
+ walk_tree (&OMP_FOR_CLAUSES (t), diagnose_sb_2, wi, NULL);
+ wi->info = t;
+ walk_tree (&OMP_FOR_INIT (t), diagnose_sb_2, wi, NULL);
+ walk_tree (&OMP_FOR_COND (t), diagnose_sb_2, wi, NULL);
+ walk_tree (&OMP_FOR_INCR (t), diagnose_sb_2, wi, NULL);
+ walk_stmts (wi, &OMP_FOR_PRE_BODY (t));
+ walk_stmts (wi, &OMP_FOR_BODY (t));
+ wi->info = context;
+ break;
+
+ case GOTO_EXPR:
+ {
+ tree lab = GOTO_DESTINATION (t);
+ if (TREE_CODE (lab) != LABEL_DECL)
+ break;
+
+ n = splay_tree_lookup (all_labels, (splay_tree_key) lab);
+ diagnose_sb_0 (tp, context, n ? (tree) n->value : NULL_TREE);
+ }
+ break;
+
+ case SWITCH_EXPR:
+ {
+ tree vec = SWITCH_LABELS (t);
+ int i, len = TREE_VEC_LENGTH (vec);
+ for (i = 0; i < len; ++i)
+ {
+ tree lab = CASE_LABEL (TREE_VEC_ELT (vec, i));
+ n = splay_tree_lookup (all_labels, (splay_tree_key) lab);
+ if (diagnose_sb_0 (tp, context, (tree) n->value))
+ break;
+ }
+ }
+ break;
+
+ case RETURN_EXPR:
+ diagnose_sb_0 (tp, context, NULL_TREE);
+ break;
+
+ default:
+ break;
+ }
+
+ return NULL_TREE;
+}
+
+void
+diagnose_omp_structured_block_errors (tree fndecl)
+{
+ tree save_current = current_function_decl;
+ struct walk_stmt_info wi;
+
+ current_function_decl = fndecl;
+
+ all_labels = splay_tree_new (splay_tree_compare_pointers, 0, 0);
+
+ memset (&wi, 0, sizeof (wi));
+ wi.callback = diagnose_sb_1;
+ walk_stmts (&wi, &DECL_SAVED_TREE (fndecl));
+
+ memset (&wi, 0, sizeof (wi));
+ wi.callback = diagnose_sb_2;
+ wi.want_locations = true;
+ wi.want_return_expr = true;
+ walk_stmts (&wi, &DECL_SAVED_TREE (fndecl));
+
+ splay_tree_delete (all_labels);
+ all_labels = NULL;
+
+ current_function_decl = save_current;
+}
+
+#include "gt-omp-low.h"
p = &all_lowering_passes;
NEXT_PASS (pass_remove_useless_stmts);
NEXT_PASS (pass_mudflap_1);
+ NEXT_PASS (pass_lower_omp);
NEXT_PASS (pass_lower_cf);
NEXT_PASS (pass_lower_eh);
NEXT_PASS (pass_build_cfg);
(void *) DECL_STRUCT_FUNCTION (node));
}
+ if ((TREE_CODE (node) == VAR_DECL || TREE_CODE (node) == PARM_DECL)
+ && DECL_HAS_VALUE_EXPR_P (node))
+ print_node (file, "value-expr", DECL_VALUE_EXPR (node), indent + 4);
+
/* Print the decl chain only if decl is at second level. */
if (indent == 4)
print_node (file, "chain", TREE_CHAIN (node), indent + 4);
+2006-01-18 Richard Henderson <rth@redhat.com>
+ Aldy Hernandez <aldyh@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+ Diego Novillo <dnovillo@redhat.com>
+ Uros Bizjak <uros@kss-loka.si>
+
+ * testsuite/gcc.dg/gomp: New directory.
+
2006-01-18 Paul Thomas <pault@gcc.gnu.org>
Steven G. Kargl <kargls@comcast.net>
--- /dev/null
+/* { dg-do compile } */
+
+void
+a1 (int n, float *a, float *b)
+{
+ int i;
+#pragma omp parallel for
+ for (i = 1; i < n; i++) /* i is private by default */
+ b[i] = (a[i] + a[i - 1]) / 2.0;
+}
--- /dev/null
+/* { dg-do compile } */
+
+#include <stdio.h>
+void
+work1 ()
+{
+}
+
+void
+work2 ()
+{
+}
+void
+a10 ()
+{
+#pragma omp parallel
+ {
+#pragma omp single
+ printf ("Beginning work1.\n");
+ work1 ();
+#pragma omp single
+ printf ("Finishing work1.\n");
+#pragma omp single nowait
+ printf ("Finished work1 and beginning work2.\n");
+ work2 ();
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+#include <stdio.h>
+extern float average (float, float, float);
+void
+a12 (float *x, float *xold, int n, float tol)
+{
+ int c, i, toobig;
+ float error, y;
+ c = 0;
+#pragma omp parallel
+ {
+ do
+ {
+#pragma omp for private(i)
+ for (i = 1; i < n - 1; ++i)
+ {
+ xold[i] = x[i];
+ }
+#pragma omp single
+ {
+ toobig = 0;
+ }
+#pragma omp for private(i,y,error) reduction(+:toobig)
+ for (i = 1; i < n - 1; ++i)
+ {
+ y = x[i];
+ x[i] = average (xold[i - 1], x[i], xold[i + 1]);
+ error = y - x[i];
+ if (error > tol || error < -tol)
+ ++toobig;
+ }
+#pragma omp master
+ {
+ ++c;
+ printf ("iteration %d, toobig=%d\n", c, toobig);
+ }
+ }
+ while (toobig > 0);
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+int dequeue (float *a);
+void work (int i, float *a);
+void
+a13 (float *x, float *y)
+{
+ int ix_next, iy_next;
+#pragma omp parallel shared(x, y) private(ix_next, iy_next)
+ {
+#pragma omp critical (xaxis)
+ ix_next = dequeue (x);
+ work (ix_next, x);
+#pragma omp critical (yaxis)
+ iy_next = dequeue (y);
+ work (iy_next, y);
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+void
+a14 ()
+{
+ int i = 1;
+#pragma omp parallel sections
+ {
+#pragma omp section
+ {
+#pragma omp critical (name)
+ {
+#pragma omp parallel
+ {
+#pragma omp single
+ {
+ i++;
+ }
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+void
+a17_1_wrong ()
+{
+ union
+ {
+ int n;
+ float x;
+ } u;
+#pragma omp parallel
+ {
+#pragma omp atomic
+ u.n++;
+#pragma omp atomic
+ u.x += 1.0;
+/* Incorrect because the atomic constructs reference the same location
+ through incompatible types */
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+void
+a17_2_wrong ()
+{
+ int x;
+ int *i;
+ float *r;
+ i = &x;
+ r = (float *) &x;
+#pragma omp parallel
+ {
+#pragma omp atomic
+ *i += 1;
+#pragma omp atomic
+ *r += 1.0;
+/* Incorrect because the atomic constructs reference the same location
+ through incompatible types */
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+void
+a20_wrong ()
+{
+ int a = 1;
+#pragma omp parallel
+ {
+ if (a != 0)
+#pragma omp flush(a) /* { dg-error "'#pragma omp flush' may only" } */
+/* incorrect as flush cannot be immediate substatement
+ of if statement */
+ if (a != 0)
+#pragma omp barrier /* { dg-error "'#pragma omp barrier' may only" } */
+/* incorrect as barrier cannot be immediate substatement
+ of if statement */
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+void
+a20 ()
+{
+ int a = 1;
+#pragma omp parallel
+ {
+ if (a != 0)
+ {
+#pragma omp flush(a)
+ }
+ if (a != 0)
+ {
+#pragma omp barrier
+ }
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+void
+work (int i)
+{
+}
+
+void
+a21_wrong (int n)
+{
+ int i;
+#pragma omp for ordered
+ for (i = 0; i < n; i++)
+ {
+/* incorrect because an iteration may not execute more than one
+ ordered region */
+#pragma omp ordered
+ work (i);
+#pragma omp ordered
+ work (i + 1);
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+void work (int);
+
+void
+a21_good (int n)
+{
+ int i;
+#pragma omp for ordered
+ for (i = 0; i < n; i++)
+ {
+ if (i <= 10)
+ {
+#pragma omp ordered
+ work (i);
+ }
+ if (i > 10)
+ {
+#pragma omp ordered
+ work (i + 1);
+ }
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-require-effective-target tls } */
+
+int counter = 0;
+#pragma omp threadprivate(counter)
+int
+increment_counter ()
+{
+ counter++;
+ return (counter);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-require-effective-target tls } */
+
+int
+increment_counter_2 ()
+{
+ static int counter = 0;
+#pragma omp threadprivate(counter)
+ counter++;
+ return (counter);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-require-effective-target tls } */
+
+extern int omp_get_num_threads (void);
+int x, y, t, z[1000];
+#pragma omp threadprivate(x)
+void
+a24 (int a)
+{
+ const int c = 1;
+ int i = 0;
+ int l = 0;
+#pragma omp parallel default(none) private(a) shared(z)
+ {
+ int j = omp_get_num_threads ();
+ /* O.K. - j is declared within parallel region */
+ /* O.K. - a is listed in private clause */
+ /* - z is listed in shared clause */
+ x = c; /* O.K. - x is threadprivate */
+ /* - c has const-qualified type */
+ z[i] = y;
+ /* { dg-error "'i' not specified" "" { target *-*-* } 21 } */
+ /* { dg-error "enclosing parallel" "" { target *-*-* } 13 } */
+ /* { dg-error "'y' not specified" "" { target *-*-* } 21 } */
+#pragma omp for firstprivate(y)
+ for (i = 0; i < 10; i++)
+ {
+ z[i] = y; /* O.K. - i is the loop iteration variable */
+ /* - y is listed in firstprivate clause */
+ }
+ z[l] = t;
+ /* { dg-error "'l' not specified" "" { target *-*-* } 31 } */
+ /* { dg-error "'t' not specified" "" { target *-*-* } 31 } */
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -std=c99" } */
+
+int a;
+void
+g (int k)
+{
+ a = k; /* The global "a", not the private "a" in f */
+}
+
+void
+f (int n)
+{
+ int a = 0;
+#pragma omp parallel for private(a)
+ for (int i = 1; i < n; i++)
+ {
+ a = i;
+ g (a * 2); /* Private copy of "a" */
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+void
+a27 ()
+{
+ int i, a;
+#pragma omp parallel private(a)
+ {
+#pragma omp parallel for private(a)
+ for (i = 0; i < 10; i++)
+ {
+ /* do work here */
+ }
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+void
+a30 (int n, float *a, float *b)
+{
+ int i;
+#pragma omp parallel
+ {
+#pragma omp for lastprivate(i)
+ for (i = 0; i < n - 1; i++)
+ a[i] = b[i] + b[i + 1];
+ }
+ a[i] = b[i]; /* i == n-1 here */
+}
--- /dev/null
+/* { dg-do compile } */
+
+void
+a31_1 (float *x, int *y, int n)
+{
+ int i, b;
+ float a;
+ a = 0.0;
+ b = 0;
+#pragma omp parallel for private(i) shared(x, y, n) \
+ reduction(+:a) reduction(^:b)
+ for (i = 0; i < n; i++)
+ {
+ a += x[i];
+ b ^= y[i];
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+void
+a31_2 (float *x, int *y, int n)
+{
+ int i, b, b_p;
+ float a, a_p;
+ a = 0.0;
+ b = 0;
+#pragma omp parallel shared(a, b, x, y, n) \
+ private(a_p, b_p)
+ {
+ a_p = 0.0;
+ b_p = 0;
+#pragma omp for private(i)
+ for (i = 0; i < n; i++)
+ {
+ a_p += x[i];
+ b_p ^= y[i];
+ }
+#pragma omp critical
+ {
+ a += a_p;
+ b ^= b_p;
+ }
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-require-effective-target tls } */
+
+#include <stdlib.h>
+float *work;
+int size;
+float tol;
+void build (void);
+#pragma omp threadprivate(work,size,tol)
+void
+a32 (float t, int n)
+{
+ tol = t;
+ size = n;
+#pragma omp parallel copyin(tol,size)
+ {
+ build ();
+ }
+}
+void
+build ()
+{
+ int i;
+ work = (float *) malloc (sizeof (float) * size);
+ for (i = 0; i < size; ++i)
+ work[i] = tol;
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-require-effective-target tls } */
+
+#include <stdio.h>
+float x, y;
+#pragma omp threadprivate(x, y)
+void
+init (float a, float b)
+{
+#pragma omp single copyprivate(a,b,x,y)
+ {
+ scanf ("%f %f %f %f", &a, &b, &x, &y);
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+#include <stdio.h>
+#include <stdlib.h>
+float
+read_next ()
+{
+ float *tmp;
+ float return_val;
+#pragma omp single copyprivate(tmp)
+ {
+ tmp = (float *) malloc (sizeof (float));
+ } /* copies the pointer only */
+#pragma omp master
+ {
+ scanf ("%f", tmp);
+ }
+#pragma omp barrier
+ return_val = *tmp;
+#pragma omp barrier
+#pragma omp single nowait
+ {
+ free (tmp);
+ }
+ return return_val;
+}
--- /dev/null
+/* { dg-do compile } */
+
+void
+work (int i, int j)
+{
+}
+
+void
+good_nesting (int n)
+{
+ int i, j;
+#pragma omp parallel default(shared)
+ {
+#pragma omp for
+ for (i = 0; i < n; i++)
+ {
+#pragma omp parallel shared(i, n)
+ {
+#pragma omp for
+ for (j = 0; j < n; j++)
+ work (i, j);
+ }
+ }
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+void
+work (int i, int j)
+{
+}
+
+void
+work1 (int i, int n)
+{
+ int j;
+#pragma omp parallel default(shared)
+ {
+#pragma omp for
+ for (j = 0; j < n; j++)
+ work (i, j);
+ }
+}
+void
+good_nesting2 (int n)
+{
+ int i;
+#pragma omp parallel default(shared)
+ {
+#pragma omp for
+ for (i = 0; i < n; i++)
+ work1 (i, n);
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+void
+work (int i, int j)
+{
+}
+
+void
+wrong1 (int n)
+{
+#pragma omp parallel default(shared)
+ {
+ int i, j;
+#pragma omp for
+ for (i = 0; i < n; i++)
+ {
+ /* incorrect nesting of loop regions */
+#pragma omp for
+ for (j = 0; j < n; j++)
+ work (i, j);
+ }
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+void work (int, int);
+
+void
+work1 (int i, int n)
+{
+ int j;
+ /* incorrect nesting of loop regions */
+#pragma omp for
+ for (j = 0; j < n; j++)
+ work (i, j);
+}
+
+void
+wrong2 (int n)
+{
+#pragma omp parallel default(shared)
+ {
+ int i;
+#pragma omp for
+ for (i = 0; i < n; i++)
+ work1 (i, n);
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+void work (int, int);
+
+void
+wrong3 (int n)
+{
+#pragma omp parallel default(shared)
+ {
+ int i;
+#pragma omp for
+ for (i = 0; i < n; i++)
+ {
+/* incorrect nesting of regions */
+#pragma omp single
+ work (i, 0);
+ }
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+void
+wrong4 (int n)
+{
+#pragma omp parallel default(shared)
+ {
+ int i;
+#pragma omp for
+ for (i = 0; i < n; i++)
+ {
+ work (i, 0);
+ /* incorrect nesting of barrier region in a loop region */
+#pragma omp barrier
+ work (i, 1);
+ }
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+void
+wrong5 (int n)
+{
+#pragma omp parallel
+ {
+#pragma omp critical
+ {
+ work (n, 0);
+/* incorrect nesting of barrier region in a critical region */
+#pragma omp barrier
+ work (n, 1);
+ }
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+void
+wrong6 (int n)
+{
+#pragma omp parallel
+ {
+#pragma omp single
+ {
+ work (n, 0);
+/* incorrect nesting of barrier region in a single region */
+#pragma omp barrier
+ work (n, 1);
+ }
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+extern int omp_get_num_threads (void);
+void work (int i);
+void
+incorrect ()
+{
+ int np, i;
+ np = omp_get_num_threads (); /* misplaced */
+#pragma omp parallel for schedule(static)
+ for (i = 0; i < np; i++)
+ work (i);
+}
--- /dev/null
+/* { dg-do compile } */
+
+extern int omp_get_thread_num (void);
+void work (int i);
+void
+correct ()
+{
+ int i;
+#pragma omp parallel private(i)
+ {
+ i = omp_get_thread_num ();
+ work (i);
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+#include <math.h>
+void
+a8 (int n, int m, float *a, float *b, float *y, float *z)
+{
+ int i;
+#pragma omp parallel
+ {
+#pragma omp for nowait
+ for (i = 1; i < n; i++)
+ b[i] = (a[i] + a[i - 1]) / 2.0;
+#pragma omp for nowait
+ for (i = 0; i < m; i++)
+ y[i] = sqrt (z[i]);
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+void XAXIS ();
+void YAXIS ();
+void ZAXIS ();
+void
+a9 ()
+{
+#pragma omp parallel sections
+ {
+#pragma omp section
+ XAXIS ();
+#pragma omp section
+ YAXIS ();
+#pragma omp section
+ ZAXIS ();
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+int x;
+volatile int y;
+volatile unsigned char z;
+
+void f1(void)
+{
+ #pragma omp atomic
+ x++;
+ #pragma omp atomic
+ x--;
+ #pragma omp atomic
+ ++x;
+ #pragma omp atomic
+ --x;
+ #pragma omp atomic
+ x += 1;
+ #pragma omp atomic
+ x -= y;
+ #pragma omp atomic
+ x |= 1;
+ #pragma omp atomic
+ x &= 1;
+ #pragma omp atomic
+ x ^= 1;
+ #pragma omp atomic
+ x *= 3;
+ #pragma omp atomic
+ x /= 3;
+ #pragma omp atomic
+ x /= 3;
+ #pragma omp atomic
+ x <<= 3;
+ #pragma omp atomic
+ x >>= 3;
+}
+
+void f2(void)
+{
+ #pragma omp atomic
+ y++;
+ #pragma omp atomic
+ y--;
+ #pragma omp atomic
+ ++y;
+ #pragma omp atomic
+ --y;
+ #pragma omp atomic
+ y += 1;
+ #pragma omp atomic
+ y -= x;
+ #pragma omp atomic
+ y |= 1;
+ #pragma omp atomic
+ y &= 1;
+ #pragma omp atomic
+ y ^= 1;
+ #pragma omp atomic
+ y *= 3;
+ #pragma omp atomic
+ y /= 3;
+ #pragma omp atomic
+ y /= 3;
+ #pragma omp atomic
+ y <<= 3;
+ #pragma omp atomic
+ y >>= 3;
+}
+
+void f3(void)
+{
+ #pragma omp atomic
+ z++;
+ #pragma omp atomic
+ z--;
+ #pragma omp atomic
+ ++z;
+ #pragma omp atomic
+ --z;
+ #pragma omp atomic
+ z += 1;
+ #pragma omp atomic
+ z |= 1;
+ #pragma omp atomic
+ z &= 1;
+ #pragma omp atomic
+ z ^= 1;
+ #pragma omp atomic
+ z *= 3;
+ #pragma omp atomic
+ z /= 3;
+ #pragma omp atomic
+ z /= 3;
+ #pragma omp atomic
+ z <<= 3;
+ #pragma omp atomic
+ z >>= 3;
+}
--- /dev/null
+/* { dg-do compile } */
+
+float x, y;
+
+void f1(void)
+{
+ #pragma omp atomic
+ x++;
+ #pragma omp atomic
+ x--;
+ #pragma omp atomic
+ ++x;
+ #pragma omp atomic
+ --x;
+ #pragma omp atomic
+ x += 1;
+ #pragma omp atomic
+ x -= y;
+ #pragma omp atomic
+ x *= 3;
+ #pragma omp atomic
+ x /= 3;
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+int *xyzzy;
+
+void f1(void)
+{
+ #pragma omp atomic
+ xyzzy++;
+}
+
+/* { dg-final { scan-tree-dump-times "xyzzy, 4" 1 "gimple" { target i?86-*-* x86_64-*-* ia64-*-* powerpc*-*-* alpha*-*-* } } } */
+/* { dg-final { cleanup-tree-dump "gimple" } } */
--- /dev/null
+/* { dg-do compile } */
+
+int a[4];
+int *p;
+struct S { int x; int y[4]; } s;
+int *bar(void);
+
+void f1(void)
+{
+ #pragma omp atomic
+ a[4] += 1;
+ #pragma omp atomic
+ *p += 1;
+ #pragma omp atomic
+ s.x += 1;
+ #pragma omp atomic
+ s.y[*p] += 1;
+ #pragma omp atomic
+ s.y[*p] *= 42;
+ #pragma omp atomic
+ *bar() += 1;
+ #pragma omp atomic
+ *bar() *= 42;
+}
--- /dev/null
+/* { dg-do compile } */
+
+int x;
+const int y;
+int bar(void);
+
+void f1(void)
+{
+ register int z;
+
+ #pragma omp atomic
+ x %= 2; /* { dg-error "invalid operator" } */
+ #pragma omp atomic
+ x = x + 1; /* { dg-error "invalid operator" } */
+ #pragma omp atomic
+ x = 1; /* { dg-error "invalid operator" } */
+ #pragma omp atomic
+ ++y; /* { dg-error "read-only variable" } */
+ #pragma omp atomic
+ y--; /* { dg-error "read-only variable" } */
+ #pragma omp atomic
+ y += 1; /* { dg-error "read-only variable" } */
+ #pragma omp atomic
+ z += 1; /* { dg-error "register variable" } */
+ #pragma omp atomic
+ bar(); /* { dg-error "invalid operator" } */
+ #pragma omp atomic
+ bar() += 1; /* { dg-error "lvalue required" } */
+ #pragma omp atomic a /* { dg-error "expected end of line" } */
+ x++;
+ #pragma omp atomic
+ ; /* { dg-error "expected expression" } */
+ #pragma omp atomic
+ #pragma omp atomic /* { dg-error "expected expression" } */
+ ;
+ /* Check that we didn't get stuck on the pragma eol marker. */
+ undef; /* { dg-error "" } */
+}
--- /dev/null
+/* { dg-do compile } */
+
+int x[10], z;
+double y[10];
+
+void f1(void)
+{
+ #pragma omp atomic
+ x[z] /= y[z];
+}
--- /dev/null
+/* { dg-do compile } */
+
+double x, y;
+
+void f2(void)
+{
+ #pragma omp atomic
+ y++;
+ #pragma omp atomic
+ y--;
+ #pragma omp atomic
+ ++y;
+ #pragma omp atomic
+ --y;
+ #pragma omp atomic
+ y += 1;
+ #pragma omp atomic
+ y -= x;
+ #pragma omp atomic
+ y *= 3;
+ #pragma omp atomic
+ y /= 3;
+}
--- /dev/null
+/* { dg-do compile } */
+
+long double z;
+
+void f3(void)
+{
+ #pragma omp atomic
+ z++;
+ #pragma omp atomic
+ z--;
+ #pragma omp atomic
+ ++z;
+ #pragma omp atomic
+ --z;
+ #pragma omp atomic
+ z += 1;
+ #pragma omp atomic
+ z *= 3;
+ #pragma omp atomic
+ z /= 3;
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+volatile int *bar(void);
+
+void f1(void)
+{
+ #pragma omp atomic
+ *bar() += 1;
+}
+
+/* { dg-final { scan-tree-dump-times "__sync_fetch_and_add" 1 "gimple" { target i?86-*-* x86_64-*-* ia64-*-* powerpc*-*-* alpha*-*-* } } } */
+/* { dg-final { cleanup-tree-dump "gimple" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+void f1(void)
+{
+ #pragma omp barrier
+}
+
+void f2(_Bool p)
+{
+ if (p)
+ {
+ #pragma omp barrier
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "GOMP_barrier" 2 "gimple" } } */
+/* { dg-final { cleanup-tree-dump "gimple" } } */
--- /dev/null
+/* { dg-do compile } */
+
+void f1(void)
+{
+ #pragma omp barrier a /* { dg-error "expected end of line" } */
+}
+
+/* OpenMP 2.5, section 2.7.3:
+
+ Note that because the barrier construct does not have a C language
+ statement as part of its syntax, there are some restrictions on its
+ placement within a program. The barrier directive may only be placed
+ in the program at a position where ignoring or deleting the directive
+ would result in a program with correct syntax. */
+
+void f2(void)
+{
+ label:
+ #pragma omp barrier
+} /* { dg-error "label at end of compound statement" } */
+
+void f3(_Bool p)
+{
+ if (p)
+ #pragma omp barrier /* { dg-error "compound statements" } */
+}
--- /dev/null
+// { dg-do compile }
+
+void foo()
+{
+ bad1:
+ #pragma omp parallel
+ goto bad1; // { dg-error "invalid exit" }
+
+ goto bad2; // { dg-error "invalid entry" }
+ #pragma omp parallel
+ {
+ bad2: ;
+ }
+
+ #pragma omp parallel
+ {
+ int i;
+ goto ok1;
+ for (i = 0; i < 10; ++i)
+ { ok1: break; }
+ }
+}
--- /dev/null
+// { dg-do compile }
+
+void foo(int i)
+{
+ int j;
+ switch (i) // { dg-error "invalid entry" }
+ {
+ #pragma omp parallel
+ { case 0:; }
+ }
+ switch (i) // { dg-error "invalid entry" }
+ {
+ #pragma omp for
+ for (j = 0; j < 10; ++ j)
+ { case 1:; }
+ }
+ switch (i) // { dg-error "invalid entry" }
+ {
+ #pragma omp critical
+ { case 2:; }
+ }
+ switch (i) // { dg-error "invalid entry" }
+ {
+ #pragma omp master
+ { case 3:; }
+ }
+ switch (i) // { dg-error "invalid entry" }
+ {
+ #pragma omp sections
+ { case 4:;
+ #pragma omp section
+ { case 5:; }
+ }
+ }
+ switch (i) // { dg-error "invalid entry" }
+ {
+ #pragma omp ordered
+ { default:; }
+ }
+}
--- /dev/null
+/* PR c++/24516 */
+/* { dg-do compile } */
+
+void
+bar (int *p)
+{
+ int m;
+#pragma omp parallel for
+ for (m = 0; m < 1000; ++m)
+ switch (p[m])
+ {
+ case 1:
+ p[m] = 2;
+ break;
+ default:
+ p[m] = 3;
+ break;
+ }
+}
--- /dev/null
+// { dg-do compile }
+
+void foo()
+{
+ int i, j;
+
+ #pragma omp for
+ for (i = 0; i < 10; ++i)
+ break; // { dg-error "break" }
+
+ bad1:
+ #pragma omp for
+ for (i = 0; i < 10; ++i)
+ goto bad1; // { dg-error "invalid exit" }
+
+ goto bad2; // { dg-error "invalid entry" }
+ #pragma omp for
+ for (i = 0; i < 10; ++i)
+ {
+ bad2: ;
+ }
+
+ #pragma omp for
+ for (i = 0; i < 10; ++i)
+ for (j = 0; j < 10; ++j)
+ if (i == j)
+ break;
+
+ #pragma omp for
+ for (i = 0; i < 10; ++i)
+ continue;
+}
--- /dev/null
+// { dg-do compile }
+
+extern int test(int);
+void foo()
+{
+ int i;
+
+ for (i = 0; i < 10; ++i)
+ {
+ #pragma omp sections
+ {
+ continue; // { dg-error "invalid exit" }
+ }
+ }
+
+ #pragma omp sections
+ {
+ #pragma omp section
+ { bad1: ; }
+ #pragma omp section
+ goto bad1; // { dg-error "invalid exit" }
+ }
+
+ #pragma omp sections
+ {
+ goto bad2; // { dg-error "invalid exit" }
+ }
+ bad2:;
+
+ goto bad3; // { dg-error "invalid entry" }
+ #pragma omp sections
+ {
+ bad3: ;
+ }
+
+ #pragma omp sections
+ {
+ goto ok1;
+ ok1:;
+
+ #pragma omp section
+ for (i = 0; i < 10; ++i)
+ if (test(i))
+ break;
+ else
+ continue;
+
+ #pragma omp section
+ switch (i)
+ {
+ case 0:
+ break;
+ default:
+ test(i);
+ }
+ }
+}
--- /dev/null
+// { dg-do compile }
+
+void foo()
+{
+ #pragma omp critical
+ {
+ return; // { dg-error "invalid exit" }
+ }
+}
--- /dev/null
+// { dg-do compile }
+
+void foo()
+{
+ #pragma omp master
+ {
+ goto bad1; // { dg-error "invalid exit" }
+ }
+
+ #pragma omp master
+ {
+ bad1:
+ return; // { dg-error "invalid exit" }
+ }
+}
--- /dev/null
+// { dg-do compile }
+
+void foo()
+{
+ #pragma omp ordered
+ {
+ return; // { dg-error "invalid exit" }
+ }
+}
--- /dev/null
+// { dg-do compile }
+
+void foo()
+{
+ int i, j;
+ for (i = 0; i < 10; ++i)
+ {
+ #pragma omp for
+ for (j = ({ continue; 0; }); // { dg-error "invalid exit" }
+ j < ({ continue; 10; }); // { dg-error "invalid exit" }
+ j += ({ continue; 1; })) // { dg-error "invalid exit" }
+ continue;
+
+ #pragma omp for
+ for (j = ({ break; 0; }); // { dg-error "invalid exit" }
+ j < ({ break; 10; }); // { dg-error "invalid exit" }
+ j += ({ break; 1; })) // { dg-error "invalid exit" }
+ break; // { dg-error "break" }
+ }
+}
--- /dev/null
+// { dg-do compile }
+// PR 24451
+
+int foo()
+{
+ int i;
+
+ #pragma omp parallel for
+ for (i = 0; i < 10; ++i)
+ return 0; // { dg-error "invalid exit" }
+}
--- /dev/null
+// { dg-do compile }
+
+void foo(int i)
+{
+ int j;
+ switch (i) // { dg-error "invalid entry" }
+ {
+ #pragma omp parallel
+ { case 0:; }
+ #pragma omp for
+ for (j = 0; j < 10; ++ j)
+ { case 1:; }
+ #pragma omp critical
+ { case 2:; }
+ #pragma omp master
+ { case 3:; }
+ #pragma omp sections
+ { case 4:;
+ #pragma omp section
+ { case 5:; }
+ }
+ #pragma omp ordered
+ { default:; }
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-require-effective-target tls } */
+
+#define p parallel
+
+extern void bar (void);
+extern char q[];
+int t;
+#pragma omp threadprivate (t)
+
+void
+foo (int x)
+{
+ char *p;
+ struct S { int i; int j; } s;
+ char a[32];
+ double d;
+ int i;
+ const int c = 8;
+#pragma omp p shared (x, x) /* { dg-error "more than once" } */
+ ;
+#pragma omp p private (x) private (x) /* { dg-error "more than once" } */
+ ;
+#pragma omp p shared (x) firstprivate (x) /* { dg-error "more than once" } */
+ ;
+#pragma omp p firstprivate (x, x) /* { dg-error "more than once" } */
+ ;
+#pragma omp p for shared (x) lastprivate (x) /* { dg-error "more than" } */
+ for (i = 0; i < 10; i++)
+ ;
+#pragma omp p for private (x) lastprivate (x) /* { dg-error "more than" } */
+ for (i = 0; i < 10; i++)
+ ;
+#pragma omp p for lastprivate (x, x) /* { dg-error "more than once" } */
+ for (i = 0; i < 10; i++)
+ ;
+#pragma omp single private (x) copyprivate (x) /* { dg-error "more than" } */
+ ;
+#pragma omp p shared (bar) /* { dg-error "is not a variable" } */
+ ;
+#pragma omp p private (bar) /* { dg-error "is not a variable" } */
+ ;
+#pragma omp p firstprivate (bar) /* { dg-error "is not a variable" } */
+ ;
+#pragma omp p reduction (+:p) /* { dg-error "has invalid type for" } */
+ ;
+#pragma omp p reduction (*:s) /* { dg-error "has invalid type for" } */
+ ;
+#pragma omp p reduction (-:a) /* { dg-error "has invalid type for" } */
+ ;
+ d = 0;
+#pragma omp p reduction (*:d)
+ ;
+#pragma omp p reduction (|:d) /* { dg-error "has invalid type for" } */
+ ;
+#pragma omp p reduction (&&:d) /* { dg-error "has invalid type for" } */
+ ;
+#pragma omp p copyin (d) /* { dg-error "must be 'threadprivate'" } */
+ ;
+#pragma omp p copyin (x) /* { dg-error "must be 'threadprivate'" } */
+ ;
+#pragma omp p for firstprivate (x) lastprivate (x)
+ for (i = 0; i < 10; i++)
+ ;
+#pragma omp p private (q) /* { dg-error "incomplete type" } */
+ ;
+#pragma omp p firstprivate (q) /* { dg-error "incomplete type" } */
+ ;
+#pragma omp p for lastprivate (q) /* { dg-error "incomplete type" } */
+ for (i = 0; i < 10; i++)
+ ;
+#pragma omp p shared (t) /* { dg-error "predetermined 'threadprivate'" } */
+ ;
+#pragma omp p private (t) /* { dg-error "predetermined 'threadprivate'" } */
+ ;
+#pragma omp p firstprivate (t) /* { dg-error "predetermined 'threadpriv" } */
+ ;
+#pragma omp p for lastprivate (t) /* { dg-error "predetermined 'threadpr" } */
+ for (i = 0; i < 10; i++)
+ ;
+#pragma omp p reduction (*:t) /* { dg-error "predetermined 'threadprivate" } */
+ ;
+#pragma omp p shared (c) /* { dg-error "predetermined 'shared'" } */
+ ;
+#pragma omp p private (c) /* { dg-error "predetermined 'shared'" } */
+ ;
+#pragma omp p firstprivate (c) /* { dg-error "predetermined 'shared'" } */
+ ;
+#pragma omp p for lastprivate (c) /* { dg-error "predetermined 'shared'" } */
+ for (i = 0; i < 10; i++)
+ ;
+#pragma omp p reduction (*:c) /* { dg-error "predetermined 'shared'" } */
+ ;
+}
--- /dev/null
+// { dg-do compile }
+// { dg-require-effective-target tls }
+
+int i, j;
+
+#pragma omp threadprivate (i)
+
+void bar(void);
+void foo(void)
+{
+ int k;
+ extern int l;
+ extern int m;
+
+#pragma omp threadprivate (m)
+
+ #pragma omp parallel copyin(i)
+ bar();
+ #pragma omp parallel copyin(j) // { dg-error "threadprivate" }
+ bar();
+ #pragma omp parallel copyin(k) // { dg-error "threadprivate" }
+ bar();
+ #pragma omp parallel copyin(l) // { dg-error "threadprivate" }
+ bar();
+ #pragma omp parallel copyin(m)
+ bar();
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-omplower" } */
+
+extern void bar(int);
+
+void foo (void)
+{
+ #pragma omp critical
+ bar(0);
+
+ /* Note that "name" is in its own namespace, thus this foo is not
+ the same as the function. */
+ #pragma omp critical(foo)
+ {
+ bar(1);
+ bar(2);
+ }
+
+ #pragma omp critical
+ #pragma omp critical(foo)
+ bar(3);
+}
+
+/* { dg-final { scan-tree-dump-times "GOMP_critical_start" 2 "omplower" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_critical_end" 2 "omplower" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_critical_name_start" 2 "omplower" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_critical_name_end" 2 "omplower" } } */
+/* { dg-final { cleanup-tree-dump "omplower" } } */
--- /dev/null
+/* { dg-do compile } */
+
+void f1(void)
+{
+ #pragma omp critical a /* { dg-error "expected" } */
+ ;
+ #pragma omp critical ( /* { dg-error "expected identifier" } */
+ ;
+ #pragma omp critical (a /* { dg-error "expected .\\)." } */
+ ;
+ #pragma omp critical (a b) /* { dg-error "expected .\\)." } */
+} /* { dg-error "expected expression" } */
--- /dev/null
+// { dg-do compile }
+// { dg-options "-fopenmp -fdump-tree-omplower" }
+
+void bar(void);
+void foo(void)
+{
+ #pragma omp critical (xyzzy)
+ bar();
+}
+
+// { dg-final { scan-tree-dump-times "\\&\\.gomp_critical_user_xyzzy" 2 "omplower" } }
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O -fopenmp -fdump-tree-omplower" } */
+
+main()
+{
+#pragma omp parallel
+ {;}
+}
+
+/* There should not be a GOMP_parallel_start call. */
+/* { dg-final { scan-tree-dump-times "GOMP_parallel_start" 0 "omplower"} } */
+/* { dg-final { cleanup-tree-dump "omplower" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+void f1(void)
+{
+ #pragma omp flush
+}
+
+int x, y, z;
+
+void f2(_Bool p)
+{
+ if (p)
+ {
+ #pragma omp flush (x)
+ }
+ else
+ {
+ #pragma omp flush (x, y, z)
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "__sync_synchronize" 3 "gimple" } } */
+/* { dg-final { cleanup-tree-dump "gimple" } } */
--- /dev/null
+/* { dg-do compile } */
+
+void f1(void)
+{
+ #pragma omp flush a /* { dg-error "expected" } */
+ #pragma omp flush ( /* { dg-error "expected identifier" } */
+ #pragma omp flush (b /* { dg-error "undeclared|expected|for each" } */
+ #pragma omp flush (c d) /* { dg-error "undeclared|expected" } */
+ #pragma omp flush (e) /* { dg-error "undeclared" } */
+}
--- /dev/null
+/* { dg-do compile } */
+
+void foo (int j, int k)
+{
+ int i;
+
+ /* Valid loops. */
+ #pragma omp for
+ for (i = 0; i < 10; i++)
+ baz (i);
+
+ #pragma omp for
+ for (i = j; i <= 10; i+=4)
+ baz (i);
+
+ #pragma omp for
+ for (i = j; i > 0; i = i - 1)
+ baz (j);
+
+ #pragma omp for
+ for (i = j; i >= k; i--)
+ baz (i);
+
+ /* Malformed parallel loops. */
+ #pragma omp for
+ i = 0; /* { dg-error "for statement expected" } */
+ for ( ; i < 10; )
+ {
+ baz (i);
+ i++;
+ }
+
+ #pragma omp for
+ for (i = 0; ; i--) /* { dg-error "missing controlling predicate" } */
+ {
+ if (i >= 10)
+ break; /* { dg-error "break" } */
+ baz (i);
+ }
+
+ #pragma omp for
+ for (i = 0; i < 10 && j > 4; i-=3) /* { dg-error "invalid controlling predicate" } */
+ baz (i);
+
+ #pragma omp for
+ for (i = 0; i < 10; i-=3, j+=2) /* { dg-error "invalid increment expression" } */
+ baz (i);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-lower" } */
+
+extern void bar(int);
+
+void foo (int n)
+{
+ int i;
+
+ #pragma omp for schedule(runtime) ordered
+ for (i = 0; i < n; ++i)
+ bar(i);
+}
+
+/* { dg-final { scan-tree-dump-times "GOMP_loop_ordered_runtime_start" 1 "lower" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_ordered_runtime_next" 1 "lower" } } */
+/* { dg-final { cleanup-tree-dump "lower" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -fopenmp" } */
+
+extern void baz (int);
+
+void foo (int j, int k)
+{
+ int i;
+
+ /* Valid loops. */
+ #pragma omp for
+ for (i = 0; i < 10; i++)
+ baz (i);
+
+ #pragma omp for
+ for (i = j; i <= 10; i+=4)
+ baz (i);
+
+ #pragma omp for
+ for (i = j; i > 0; i = i - 1)
+ baz (j);
+
+ #pragma omp for
+ for (i = j; i >= k; i--)
+ baz (i);
+
+ #pragma omp for
+ for (int l = j; l < 10; l++)
+ baz (l);
+
+ /* Malformed parallel loops. */
+ #pragma omp for
+ i = 0; /* { dg-error "for statement expected" } */
+ for ( ; i < 10; )
+ {
+ baz (i);
+ i++;
+ }
+
+ #pragma omp for
+ for (i = 0; ; i--) /* { dg-error "missing controlling predicate" } */
+ {
+ if (i >= 10)
+ break; /* { dg-error "break" } */
+ baz (i);
+ }
+
+ #pragma omp for
+ for (i = 0;
+ i < 10 && j > 4; /* { dg-error "invalid controlling predicate" } */
+ i-=3)
+ baz (i);
+
+ #pragma omp for
+ for (i = 0;
+ i < 10;
+ i-=3, j+=2) /* { dg-error "invalid increment expression" } */
+ baz (i);
+
+ int m = 0;
+ #pragma omp for
+ for (; m < 10; m++) /* { dg-error "expected" } */
+ baz (m);
+
+ m = 0;
+ #pragma omp for
+ for (int n = 0; m < 10; m++) /* { dg-error "invalid controlling predicate|invalid increment expression" } */
+ baz (m);
+
+ #pragma omp for
+ for (m = 0; m < 10; i++) /* { dg-error "invalid increment expression" } */
+ baz (m);
+}
--- /dev/null
+int foo (void)
+{
+ int i, a;
+
+ a = 30;
+
+ #pragma omp parallel for lastprivate (a)
+ for (i = 0; i < 10; i++)
+ a = a + i;
+
+ return a;
+}
--- /dev/null
+// At one point in development, a typo disabled the remapping of the
+// for iteration variable as private.
+
+// { dg-do compile }
+// { dg-options "-fopenmp -fdump-tree-lower" }
+
+extern void bar(int);
+void foo(void)
+{
+ int i;
+
+#pragma omp parallel for default(none)
+ for (i = 0; i < 10; i++)
+ bar(i);
+}
+
+// { dg-final { scan-tree-dump-times "omp_data_o" 0 "lower" } }
+// { dg-final { cleanup-tree-dump "lower" } }
--- /dev/null
+// { dg-do compile }
+
+extern int printf (const char *, ...);
+extern void foo (int *);
+
+int main (void)
+{
+ double d = 6;
+ int i = 1, j = 6, k = 8;
+#pragma omp parallel shared(d) private(i) num_threads (4)
+ {
+ i = 4;
+#pragma omp for lastprivate(j)
+ for (j = 1; j <= k; j++)
+ printf ("%s %d %d %d %p %g\n", "Hello, World!", i, j, k, &j, d);
+ printf ("%s %d %g\n", "Hello, World!", i, d);
+ }
+ return 0;
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+void foo()
+{
+ long n = 10;
+ int i;
+#pragma omp for
+ for (i=0; i < n; ++i) ;
+#pragma omp for
+ for (i=0; n > i; ++i) ;
+}
--- /dev/null
+// PR 24703
+// { dg-do compile }
+
+void work(int);
+int work_param;
+int sphinx_omp_thread_count;
+int schedule_loop_cap;
+
+int measure_omp_parallel_for_dynamic (void)
+{
+ int j;
+
+#pragma omp parallel for schedule(dynamic)
+ for(j=0; j < sphinx_omp_thread_count * schedule_loop_cap; j++)
+ work(work_param);
+
+ return 0;
+}
--- /dev/null
+/* { dg-do compile } */
+extern int bar (int);
+
+void
+foo (void)
+{
+ int j, k = 1, l = 30, m = 4;
+ long int o = 4;
+ long long int p = 0;
+#pragma omp for
+ for (j = k; j <= l; j += m - 1)
+ ;
+#pragma omp for
+ for (j = k; j <= l; j += (m - 1))
+ ;
+#pragma omp for
+ for (j = k; j <= l; j += bar (m - 1))
+ ;
+#pragma omp for
+ for (j = k; j <= l; j = j + m - 1)
+ ;
+#pragma omp for
+ for (j = k; j <= l; j = j + (m - 1))
+ ;
+#pragma omp for
+ for (j = k; j <= l; j = j + bar (m - 1))
+ ;
+#pragma omp for
+ for (j = ({ int n; n = k; n; }); j <= l; j++)
+ ;
+#pragma omp for
+ for (j = k; j <= ({ int n; n = l; n; }); j++)
+ ;
+#pragma omp for
+ for (j = k; j <= l; j += ({ int n; n = 1; n; }))
+ ;
+#pragma omp for
+ for (j = k; j <= l; j += m + 1)
+ ;
+#pragma omp for
+ for (j = k; j <= l; j += o)
+ ;
+#pragma omp for
+ for (j = k; j <= l; j = j + o)
+ ;
+#pragma omp for
+ for (j = k; j <= l; j = o + 1 + j)
+ ;
+#pragma omp for
+ for (j = k; j <= l; j = o + m + j)
+ ;
+#pragma omp for
+ for (j = k; j <= l; j += o + p)
+ ;
+#pragma omp for
+ for (j = k; j <= l; j = j + o + p)
+ ;
+#pragma omp for
+ for (j = l; j >= k; j -= o)
+ ;
+#pragma omp for
+ for (j = l; j >= k; j -= p)
+ ;
+#pragma omp for
+ for (j = l; j >= k; j -= o + p)
+ ;
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O -fopenmp -fdump-tree-omplower" } */
+
+void
+foo (int *a, int i)
+{
+ int j, k = 1, l = 30, m = 4;
+#pragma omp parallel for num_threads (3 * i) schedule (dynamic, i * 4)
+ for (j = 0; j <= l; j++)
+ a[j] = 1;
+#pragma omp parallel for num_threads (3 * i) schedule (dynamic, i * 4)
+ for (j = k; j <= l; j += (m - 1))
+ a[j] = 2;
+#pragma omp parallel for num_threads (3 * i) schedule (dynamic, 4)
+ for (j = 0; j <= l; j++)
+ a[j] = 3;
+#pragma omp parallel for num_threads (3 * i) schedule (dynamic, 4)
+ for (j = k; j <= l; j += (m - 1))
+ a[j] = 4;
+}
+
+void
+bar (int *a, int i)
+{
+ int j, k = 1, l = 30, m = 4;
+#pragma omp parallel for num_threads (3 * i) schedule (guided, i * 4)
+ for (j = 0; j <= l; j++)
+ a[j] = 1;
+#pragma omp parallel for num_threads (3 * i) schedule (guided, i * 4)
+ for (j = k; j <= l; j += (m - 1))
+ a[j] = 2;
+#pragma omp parallel for num_threads (3 * i) schedule (guided, 4)
+ for (j = 0; j <= l; j++)
+ a[j] = 3;
+#pragma omp parallel for num_threads (3 * i) schedule (guided, 4)
+ for (j = k; j <= l; j += (m - 1))
+ a[j] = 4;
+}
+
+/* { dg-final { scan-tree-dump-times "GOMP_parallel_loop_dynamic_start" 4 "omplower" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "GOMP_parallel_loop_guided_start" 4 "omplower" { xfail *-*-* } } } */
+/* { dg-final { cleanup-tree-dump "omplower" } } */
--- /dev/null
+/* Verify that if GOMP_parallel_loop_dynamic_start is used, variables
+ mentioned in the INIT, COND and INCR expressions aren't unnecessarily
+ copied to the omp_fn function. */
+/* { dg-do compile } */
+/* { dg-options "-O -fopenmp -fdump-tree-gimple" } */
+
+void foo (int *a, int i, int j, int k, int l, int m)
+{
+#pragma omp parallel for num_threads (3 * i) schedule (dynamic, i * 4)
+ for (j = 0; j <= (6 * l + 4 * k); j++)
+ a[j] = 1;
+#pragma omp parallel for num_threads (3 * i) schedule (dynamic, i * 4)
+ for (j = m; j <= l; j += (k + l - m))
+ a[j] = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "shared\\(a\\)" 2 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "shared\\(k\\)" 0 "gimple" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "shared\\(l\\)" 0 "gimple" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "shared\\(m\\)" 0 "gimple" { xfail *-*-* } } } */
+/* { dg-final { cleanup-tree-dump "gimple" } } */
--- /dev/null
+/* { dg-do compile } */
+
+void foo()
+{
+ int i;
+
+ #pragma omp for nowait
+ for (i = 0; i < 10; ++i) ;
+
+ #pragma omp for nowait nowait /* { dg-error "too many" } */
+ for (i = 0; i < 10; ++i) ;
+
+ #pragma omp for ordered
+ for (i = 0; i < 10; ++i) ;
+
+ #pragma omp for ordered ordered /* { dg-error "too many" } */
+ for (i = 0; i < 10; ++i) ;
+}
--- /dev/null
+// { dg-do compile }
+
+int bar ();
+
+void foo()
+{
+ int i;
+
+ #pragma omp for schedule // { dg-error "expected '\\('" }
+ for (i = 0; i < 10; ++i) ;
+
+ #pragma omp for schedule static // { dg-error "expected '\\('" }
+ for (i = 0; i < 10; ++i) ;
+
+ #pragma omp for schedule ( // { dg-error "invalid schedule kind" }
+ for (i = 0; i < 10; ++i) ;
+
+ #pragma omp for schedule ( static // { dg-error "expected" }
+ for (i = 0; i < 10; ++i) ;
+
+ #pragma omp for schedule ( static )
+ for (i = 0; i < 10; ++i) ;
+
+ #pragma omp for schedule ( foo ) // { dg-error "invalid schedule kind" }
+ for (i = 0; i < 10; ++i) ;
+
+ #pragma omp for schedule ( static 1 // { dg-error "expected" }
+ for (i = 0; i < 10; ++i) ;
+
+ #pragma omp for schedule ( static 1 ) nowait // { dg-error "expected" }
+ for (i = 0; i < 10; ++i) ;
+
+ #pragma omp for schedule ( static, 1 ) nowait
+ for (i = 0; i < 10; ++i) ;
+
+ #pragma omp for schedule ( static, 1, 1 ) nowait // { dg-error "expected '\\)'" }
+ for (i = 0; i < 10; ++i) ;
+
+ #pragma omp for schedule ( static, 1 + 1 ) nowait
+ for (i = 0; i < 10; ++i) ;
+
+ #pragma omp for schedule ( static, 1.0 ) // { dg-error "expected integer expression" }
+ for (i = 0; i < 10; ++i) ;
+
+ #pragma omp for schedule (dynamic)
+ for (i = 0; i < 10; ++i) ;
+
+ #pragma omp for schedule (dynamic, bar ())
+ for (i = 0; i < 10; ++i) ;
+
+ #pragma omp for schedule (guided)
+ for (i = 0; i < 10; ++i) ;
+
+ #pragma omp for schedule (guided, bar ())
+ for (i = 0; i < 10; ++i) ;
+
+ #pragma omp for schedule (runtime)
+ for (i = 0; i < 10; ++i) ;
+
+ #pragma omp for schedule (runtime, bar ()) // { dg-error "does not take" }
+ for (i = 0; i < 10; ++i) ;
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-lower" } */
+
+extern void bar(int);
+
+void foo (int n)
+{
+ int i;
+
+ #pragma omp for schedule(dynamic)
+ for (i = 0; i < n; ++i)
+ bar(i);
+}
+
+/* { dg-final { scan-tree-dump-times "GOMP_loop_dynamic_start" 1 "lower" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_dynamic_next" 1 "lower" } } */
+/* { dg-final { cleanup-tree-dump "lower" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-lower" } */
+
+extern void bar(int);
+
+void foo (int n)
+{
+ int i;
+
+ #pragma omp for schedule(guided)
+ for (i = 0; i < n; ++i)
+ bar(i);
+}
+
+/* { dg-final { scan-tree-dump-times "GOMP_loop_guided_start" 1 "lower" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_guided_next" 1 "lower" } } */
+/* { dg-final { cleanup-tree-dump "lower" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-lower" } */
+
+extern void bar(int);
+
+void foo (int n)
+{
+ int i;
+
+ #pragma omp for schedule(runtime)
+ for (i = 0; i < n; ++i)
+ bar(i);
+}
+
+/* { dg-final { scan-tree-dump-times "GOMP_loop_runtime_start" 1 "lower" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_runtime_next" 1 "lower" } } */
+/* { dg-final { cleanup-tree-dump "lower" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-lower" } */
+
+extern void bar(int);
+
+void foo (int n)
+{
+ int i;
+
+ #pragma omp for schedule(static) ordered
+ for (i = 0; i < n; ++i)
+ bar(i);
+}
+
+/* { dg-final { scan-tree-dump-times "GOMP_loop_ordered_static_start" 1 "lower" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_ordered_static_next" 1 "lower" } } */
+/* { dg-final { cleanup-tree-dump "lower" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-lower" } */
+
+extern void bar(int);
+
+void foo (int n)
+{
+ int i;
+
+ #pragma omp for schedule(dynamic) ordered
+ for (i = 0; i < n; ++i)
+ bar(i);
+}
+
+/* { dg-final { scan-tree-dump-times "GOMP_loop_ordered_dynamic_start" 1 "lower" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_ordered_dynamic_next" 1 "lower" } } */
+/* { dg-final { cleanup-tree-dump "lower" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-lower" } */
+
+extern void bar(int);
+
+void foo (int n)
+{
+ int i;
+
+ #pragma omp for schedule(guided) ordered
+ for (i = 0; i < n; ++i)
+ bar(i);
+}
+
+/* { dg-final { scan-tree-dump-times "GOMP_loop_ordered_guided_start" 1 "lower" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_ordered_guided_next" 1 "lower" } } */
+/* { dg-final { cleanup-tree-dump "lower" } } */
--- /dev/null
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [find $srcdir/$subdir *.c]] \
+ "" "-fopenmp"
+
+# All done.
+dg-finish
--- /dev/null
+// { dg-do compile }
+
+#define N 10
+
+extern void bar(void);
+void foo(void)
+{
+ #pragma omp parallel num_threads(N)
+ bar();
+}
--- /dev/null
+// { dg-do compile }
+
+#define p parallel
+#define s(x) shared(x##1, x##2)
+#define d(x) default(x)
+
+void bar(int, int, int, int);
+void foo(void)
+{
+ int a1, a2, b1, b2;
+
+ #pragma omp p s(a) s(b) d(none)
+ bar(a1, a2, b1, b2);
+}
--- /dev/null
+/* { dg-do compile } */
+
+extern void bar(int);
+
+void foo (void)
+{
+ #pragma omp master
+ bar(0);
+
+ #pragma omp master
+ {
+ bar(1);
+ bar(2);
+ }
+
+ /* Yes, this is legal -- structured-block contains statement contains
+ openmp-construct contains master-construct. */
+ #pragma omp master
+ #pragma omp master
+ #pragma omp master
+ ;
+}
--- /dev/null
+/* { dg-do compile } */
+
+void f1(void)
+{
+ #pragma omp master asdf /* { dg-error "expected" } */
+ #pragma omp master
+} /* { dg-error "expected expression" } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-omplower" } */
+
+extern void bar(int);
+
+void foo (void)
+{
+ #pragma omp master
+ bar(0);
+}
+
+/* { dg-final { scan-tree-dump-times "omp_get_thread_num" 1 "omplower" } } */
+/* { dg-final { cleanup-tree-dump "omplower" } } */
--- /dev/null
+/* { dg-do compile } */
+
+extern void bar(void);
+void foo(void)
+{
+ #pragma omp parallel num_threads (0) /* { dg-warning "must be positive" } */
+ {
+ bar ();
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+extern int foo(void);
+extern void bar(void);
+
+int main ()
+{
+ /* Malformed uses of 'if' and 'num_threads'. */
+ #pragma omp parallel if (foo () > 10) if (foo () == 3) /* { dg-error "too many" } */
+ {
+ bar ();
+ }
+
+ #pragma omp parallel num_threads (3) num_threads (20) /* { dg-error "too many" } */
+ {
+ bar ();
+ }
+
+ /* Valid uses of 'if' and 'num_threads'. */
+ #pragma omp parallel if (foo () == 10) num_threads (foo ())
+ {
+ bar ();
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-omplower" } */
+
+extern void bar(int);
+
+void foo (void)
+{
+ #pragma omp ordered
+ bar(0);
+
+ #pragma omp ordered
+ {
+ bar(1);
+ bar(2);
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "GOMP_ordered_start" 2 "omplower" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_ordered_end" 2 "omplower" } } */
+/* { dg-final { cleanup-tree-dump "omplower" } } */
--- /dev/null
+/* { dg-do compile } */
+
+void f1(void)
+{
+ #pragma omp ordered asdf /* { dg-error "expected" } */
+ #pragma omp ordered
+} /* { dg-error "expected expression" } */
--- /dev/null
+// { dg-do compile }
+
+void foo()
+{
+ int i;
+
+ #pragma omp parallel
+ {
+ #pragma omp parallel
+ {
+ #pragma omp parallel
+ {
+ i++;
+ }
+ }
+ }
+}
--- /dev/null
+// { dg-do compile }
+
+void foo()
+{
+ int i;
+
+ #pragma omp parallel default(none) // { dg-error "enclosing" }
+ {
+ #pragma omp parallel
+ {
+ #pragma omp parallel default(none) // { dg-error "enclosing" }
+ {
+ i++; // { dg-error "not specified" }
+ }
+ }
+ }
+}
--- /dev/null
+// { dg-do compile }
+
+extern int printf (const char *, ...);
+
+int main (void)
+{
+ double d = 6;
+ int i = 1;
+#pragma omp parallel shared(d) private(i) num_threads (4 + i)
+ {
+ i = 4;
+ printf ("%s %d %g\n", "Hello, World!", i, d);
+ }
+ return 0;
+}
--- /dev/null
+// { dg-do compile }
+
+extern void bar (void);
+
+int main (void)
+{
+ int i;
+#pragma omp parallel for nowait /* { dg-error "'nowait'" } */
+ for (i = 0; i < 10; i++)
+ bar ();
+}
--- /dev/null
+/* { dg-do compile } */
+
+extern void bar(int);
+
+void f1(void)
+{
+ #pragma omp sections nowait
+ {
+ bar (1);
+ #pragma omp section
+ bar (2);
+ #pragma omp section
+ bar (3);
+ #pragma omp section
+ bar (4);
+ #pragma omp section
+ bar (5);
+ }
+}
+
+void f2(void)
+{
+ #pragma omp sections
+ {
+ #pragma omp section
+ {
+ bar (1);
+ bar (1);
+ }
+ #pragma omp section
+ bar (2);
+ #pragma omp section
+ bar (3);
+ #pragma omp section
+ bar (4);
+ #pragma omp section
+ bar (5);
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+extern void bar(int);
+void foo(void)
+{
+ #pragma omp sections
+ bar (0); // { dg-error "expected" }
+
+ #pragma omp sections
+ {
+ } // { dg-error "expected" }
+
+ #pragma omp sections
+ {
+ bar (1);
+ }
+
+ #pragma omp sections
+ {
+ #pragma omp section
+ bar(2);
+ bar(3); // { dg-error "expected" }
+ bar(4);
+ #pragma omp section
+ bar(5);
+ bar(6); // { dg-error "expected" }
+ bar(7);
+ }
+}
--- /dev/null
+
+// { dg-do compile }
+
+extern void bar (void);
+
+int main (void)
+{
+ #pragma omp parallel sections nowait /* { dg-error "'nowait'" } */
+ {
+ #pragma omp section
+ { bar(); }
+ #pragma omp section
+ { bar(); }
+ }
+}
--- /dev/null
+/* PR c++/24613 */
+/* { dg-compile } */
+
+#pragma omp section /* { dg-error "may only be used in" } */
+
+int i;
+
+void
+foo (void)
+{
+ #pragma omp section /* { dg-error "may only be used in" } */
+ i++;
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-require-effective-target tls } */
+
+#include <stdlib.h>
+
+int thrglobalvar;
+#pragma omp threadprivate (thrglobalvar)
+int globalvar;
+const int constvar = 8;
+
+int
+foo (int x)
+{
+ return x;
+}
+
+int
+bar (int *x)
+{
+ return *x;
+}
+
+int
+main (void)
+{
+ static int thrlocvar;
+#pragma omp threadprivate (thrlocvar)
+ static int locvar;
+ static int *p;
+ int i, j, s, l;
+
+ p = malloc (sizeof (int));
+ if (p == NULL)
+ return 0;
+ *p = 7;
+ s = 6;
+ l = 0;
+#pragma omp parallel for /* { dg-error "enclosing parallel" } */ \
+ default (none) private (p) shared (s)
+ for (i = 0; i < 64; i++)
+ {
+ int k = foo (0); /* Predetermined - private (automatic var declared */
+ k++; /* in scope of construct). */
+ thrglobalvar++; /* Predetermined - threadprivate. */
+ thrlocvar++; /* Predetermined - threadprivate. */
+ foo (i); /* Predetermined - private (omp for loop variable). */
+ foo (constvar); /* Predetermined - shared (const qualified type). */
+ foo (*p); /* *p predetermined - shared (heap allocated */
+ (*p)++; /* storage). */
+ bar (p); /* Explicitly determined - private. */
+ foo (s); /* Explicitly determined - shared. */
+ globalvar++; /* { dg-error "not specified in" } */
+ locvar++; /* { dg-error "not specified in" } */
+ l++; /* { dg-error "not specified in" } */
+ for (j = 0; j < 2; j++); /* { dg-error "not specified in" } */
+ }
+ return 0;
+}
--- /dev/null
+/* { dg-do compile } */
+
+void
+foo (void)
+{
+ int i;
+ int a[10];
+ #pragma omp parallel private (i) shared (a)
+ {
+ i = 1;
+ #pragma omp parallel shared (a, i)
+ {
+ #pragma omp master
+ i = 2;
+ #pragma omp parallel private (i) shared (a)
+ {
+ for (i = 0; i < 10; i++)
+ a[i] = i + 1;
+ }
+ #pragma omp master
+ i = 3;
+ }
+ i = 4;
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+#define N 50
+#define CHUNKSIZE 5
+
+main ()
+{
+ int i, chunk;
+ float c[N];
+
+ chunk = CHUNKSIZE;
+#pragma omp parallel for shared (c, chunk) schedule (dynamic, chunk)
+ for (i = 0; i < N; i++)
+ c[i] = i;
+
+ return 0;
+}
--- /dev/null
+static int bork;
+
+void bar(void);
+
+void foobar (void)
+{
+#pragma omp parallel
+ {
+#pragma omp for lastprivate(bork)
+ for (bork = 0; bork < 100; bork++) {
+ bar();
+ }
+ }
+}
--- /dev/null
+// { dg-do compile }
+// { dg-require-effective-target tls }
+
+int tp1;
+static int tp2;
+extern int tp3;
+
+int tp4 = 1;
+static int tp5 = 1;
+
+#pragma omp threadprivate (tp1, tp2, tp3, tp4, tp5)
+
+#pragma omp threadprivate (undef) // { dg-error "undeclared" }
+
+int tp6;
+int foo(void) { return tp6; }
+
+#pragma omp threadprivate (tp6) // { dg-error "after first use" }
--- /dev/null
+/* { dg-do compile } */
+/* { dg-require-effective-target tls } */
+
+extern char buf[];
+#pragma omp threadprivate (buf) /* { dg-error "has incomplete type" } */
+
+void
+foo (void)
+{
+ int i;
+#pragma omp threadprivate (i) /* { dg-error "automatic variable" } */
+ i = 0;
+}
--- /dev/null
+// PR 24612
+// { dg-do compile }
+// { dg-options "-O -Wuninitialized -fopenmp" }
+
+void foo()
+{
+ int i;
+#pragma omp parallel shared(i)
+ {
+ i = 0;
+ ++i;
+ }
+}
--- /dev/null
+// { dg-do compile }
+
+void foo(int n)
+{
+ int A[n];
+
+ #pragma omp parallel default(none) // { dg-error "enclosing" }
+ {
+ A[0] = 0; // { dg-error "'A' not specified" }
+ }
+}
--- /dev/null
+// { dg-do compile }
+
+void foo(int n, int i)
+{
+ int A[n];
+
+ #pragma omp parallel private(A)
+ {
+ A[i] = 0;
+ }
+}
--- /dev/null
+// { dg-do compile }
+
+void foo(int n, int i)
+{
+ int A[n];
+
+ #pragma omp parallel shared(A)
+ {
+ A[i] = sizeof(A);
+ }
+}
--- /dev/null
+// { dg-do compile }
+
+void foo(int n, int i)
+{
+ int A[n];
+
+ #pragma omp parallel firstprivate(A)
+ {
+ A[i] = 1;
+ }
+}
--- /dev/null
+// { dg-do compile }
+
+void foo(int n, int i)
+{
+ int A[n];
+
+ #pragma omp parallel sections lastprivate(A)
+ {
+ A[i] = 1;
+ }
+}
stmt_ann_t ann = get_stmt_ann (t);
ann->bb = bb;
- /* If the statement is a label, add the label to block-to-labels map
- so that we can speed up edge creation for GOTO_EXPRs. */
- if (TREE_CODE (t) == LABEL_EXPR)
+ /* If the statement is a label, add the label to block-to-labels
+ map so that we can speed up edge creation for GOTO_EXPRs.
+ Note that LABEL_TO_BLOCK_MAP may not exist if we are
+ currently expanding into RTL (in which case, this mapping is
+ unnecessary, anyway). */
+ if (TREE_CODE (t) == LABEL_EXPR && !currently_expanding_to_rtl)
{
int uid;
tree_node_can_be_shared (tree t)
{
if (IS_TYPE_OR_DECL_P (t)
- /* We check for constants explicitly since they are not considered
- gimple invariants if they overflowed. */
- || CONSTANT_CLASS_P (t)
|| is_gimple_min_invariant (t)
|| TREE_CODE (t) == SSA_NAME
- || t == error_mark_node)
+ || t == error_mark_node
+ || TREE_CODE (t) == IDENTIFIER_NODE)
return true;
if (TREE_CODE (t) == CASE_LABEL_EXPR)
return true;
while (((TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF)
- /* We check for constants explicitly since they are not considered
- gimple invariants if they overflowed. */
- && (CONSTANT_CLASS_P (TREE_OPERAND (t, 1))
- || is_gimple_min_invariant (TREE_OPERAND (t, 1))))
- || (TREE_CODE (t) == COMPONENT_REF
- || TREE_CODE (t) == REALPART_EXPR
- || TREE_CODE (t) == IMAGPART_EXPR))
+ && is_gimple_min_invariant (TREE_OPERAND (t, 1)))
+ || TREE_CODE (t) == COMPONENT_REF
+ || TREE_CODE (t) == REALPART_EXPR
+ || TREE_CODE (t) == IMAGPART_EXPR)
t = TREE_OPERAND (t, 0);
if (DECL_P (t))
if (prev_stmt && DECL_NONLOCAL (LABEL_EXPR_LABEL (stmt)))
{
- error ("nonlocal label %s is not first "
- "in a sequence of labels in bb %d",
- IDENTIFIER_POINTER (DECL_NAME (LABEL_EXPR_LABEL (stmt))),
- bb->index);
+ error ("nonlocal label ");
+ print_generic_expr (stderr, LABEL_EXPR_LABEL (stmt), 0);
+ fprintf (stderr, " is not first in a sequence of labels in bb %d",
+ bb->index);
err = 1;
}
if (label_to_block (LABEL_EXPR_LABEL (stmt)) != bb)
{
- error ("label %s to block does not match in bb %d",
- IDENTIFIER_POINTER (DECL_NAME (LABEL_EXPR_LABEL (stmt))),
- bb->index);
+ error ("label ");
+ print_generic_expr (stderr, LABEL_EXPR_LABEL (stmt), 0);
+ fprintf (stderr, " to block does not match in bb %d",
+ bb->index);
err = 1;
}
if (decl_function_context (LABEL_EXPR_LABEL (stmt))
!= current_function_decl)
{
- error ("label %s has incorrect context in bb %d",
- IDENTIFIER_POINTER (DECL_NAME (LABEL_EXPR_LABEL (stmt))),
- bb->index);
+ error ("label ");
+ print_generic_expr (stderr, LABEL_EXPR_LABEL (stmt), 0);
+ fprintf (stderr, " has incorrect context in bb %d",
+ bb->index);
err = 1;
}
}
if (TREE_CODE (stmt) == LABEL_EXPR)
{
- error ("label %s in the middle of basic block %d",
- IDENTIFIER_POINTER (DECL_NAME (LABEL_EXPR_LABEL (stmt))),
- bb->index);
+ error ("label ");
+ print_generic_expr (stderr, LABEL_EXPR_LABEL (stmt), 0);
+ fprintf (stderr, " in the middle of basic block %d", bb->index);
err = 1;
}
}
+
bsi = bsi_last (bb);
if (bsi_end_p (bsi))
continue;
}
if (! tree_int_cst_lt (CASE_LOW (prev), CASE_LOW (c)))
{
- error ("case labels not sorted:");
+ error ("case labels not sorted: ");
print_generic_expr (stderr, prev, 0);
fprintf (stderr," is greater than ");
print_generic_expr (stderr, c, 0);
bool ignore_topmost_bind = false, any_var = false;
basic_block bb;
tree chain;
-
+ struct function *saved_cfun;
+
fprintf (file, "%s (", lang_hooks.decl_printable_name (fn, 2));
arg = DECL_ARGUMENTS (fn);
return;
}
+ /* Switch CFUN to point to FN. */
+ saved_cfun = cfun;
+ cfun = DECL_STRUCT_FUNCTION (fn);
+
/* When GIMPLE is lowered, the variables are no longer available in
BIND_EXPRs, so display them separately. */
if (cfun && cfun->decl == fn && cfun->unexpanded_var_list)
/* Make a tree based dump. */
chain = DECL_SAVED_TREE (fn);
- if (TREE_CODE (chain) == BIND_EXPR)
+ if (chain && TREE_CODE (chain) == BIND_EXPR)
{
if (ignore_topmost_bind)
{
}
fprintf (file, "\n\n");
+
+ /* Restore CFUN. */
+ cfun = saved_cfun;
+}
+
+
+/* Dump FUNCTION_DECL FN to stderr using FLAGS (see TDF_* in tree.h) */
+
+void
+debug_function (tree fn, int flags)
+{
+ dump_function_to_file (fn, stderr, flags);
}
extern void queue_and_dump_type (dump_info_p, tree);
extern void dump_function (enum tree_dump_index, tree);
extern void dump_function_to_file (tree, FILE *, int);
+extern void debug_function (tree, int);
extern int dump_flag (dump_info_p, int, tree);
extern unsigned int dump_register (const char *, const char *, const char *,
case RESX_EXPR:
case PHI_NODE:
case STATEMENT_LIST:
+ case OMP_PARALLEL:
+ case OMP_FOR:
+ case OMP_SECTIONS:
+ case OMP_SECTION:
+ case OMP_SINGLE:
+ case OMP_MASTER:
+ case OMP_ORDERED:
+ case OMP_CRITICAL:
/* These are always void. */
return true;
GS_ALL_DONE = 1 /* The expression is fully gimplified. */
};
+/* Type of parallel constructs. Used to decide what runtime function
+ to use for launching children threads and the gimplification
+ strategy. */
+
+enum omp_parallel_type {
+ IS_NOT_PARALLEL = 0,
+
+ /* Regular omp parallel */
+ IS_PARALLEL,
+
+ /* Combined parallel + workshare (parallel loop and parallel
+ sections). */
+ IS_COMBINED_PARALLEL
+};
+
extern enum gimplify_status gimplify_expr (tree *, tree *, tree *,
bool (*) (tree), fallback_t);
extern void gimplify_type_sizes (tree, tree *);
extern void free_stmt_list (tree);
extern tree force_labels_r (tree *, int *, void *);
extern enum gimplify_status gimplify_va_arg_expr (tree *, tree *, tree *);
+struct gimplify_omp_ctx;
+extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
+
+/* In omp-low.c. */
+extern tree find_omp_clause (tree, enum tree_code);
+extern void diagnose_omp_structured_block_errors (tree);
+extern tree omp_reduction_init (tree, tree);
+enum omp_parallel_type determine_parallel_type (tree stmt);
/* In tree-nested.c. */
extern void lower_nested_functions (tree);
+extern void insert_field_into_struct (tree, tree);
+
+/* Convenience routines to walk all statements of a gimple function.
+ The difference between these walkers and the generic walk_tree is
+ that walk_stmt provides context information to the callback
+ routine to know whether it is currently on the LHS or RHS of an
+ assignment (IS_LHS) or contexts where only GIMPLE values are
+ allowed (VAL_ONLY).
+
+ This is useful in walkers that need to re-write sub-expressions
+ inside statements while making sure the result is still in GIMPLE
+ form.
+
+ Note that this is useful exclusively before the code is converted
+ into SSA form. Once the program is in SSA form, the standard
+ operand interface should be used to analyze/modify statements. */
+
+struct walk_stmt_info
+{
+ /* For each statement, we invoke CALLBACK via walk_tree. The passed
+ data is a walk_stmt_info structure. */
+ walk_tree_fn callback;
+
+ /* Points to the current statement being walked. */
+ tree_stmt_iterator tsi;
+
+ /* Additional data that CALLBACK may want to carry through the
+ recursion. */
+ void *info;
+
+ /* Indicates whether the *TP being examined may be replaced
+ with something that matches is_gimple_val (if true) or something
+ slightly more complicated (if false). "Something" technically
+ means the common subset of is_gimple_lvalue and is_gimple_rhs,
+ but we never try to form anything more complicated than that, so
+ we don't bother checking.
+
+ Also note that CALLBACK should update this flag while walking the
+ sub-expressions of a statement. For instance, when walking the
+ statement 'foo (&var)', the flag VAL_ONLY will initially be set
+ to true, however, when walking &var, the operand of that
+ ADDR_EXPR does not need to be a GIMPLE value. */
+ bool val_only;
+
+ /* True if we are currently walking the LHS of an assignment. */
+ bool is_lhs;
+
+ /* Optional. Set to true by CALLBACK if it made any changes. */
+ bool changed;
+
+ /* True if we're interested in seeing BIND_EXPRs. */
+ bool want_bind_expr;
+
+ /* True if we're interested in seeing RETURN_EXPRs. */
+ bool want_return_expr;
+
+ /* True if we're interested in location information. */
+ bool want_locations;
+};
+
+void walk_stmts (struct walk_stmt_info *, tree *);
#endif /* _TREE_SIMPLE_H */
return expr;
}
-/* If EXPR is a single statement, naked or in a STATEMENT_LIST, then
- return it. Otherwise return NULL. */
+/* If EXPR is a single statement return it. If EXPR is a
+ STATEMENT_LIST containing exactly one statement S, return S.
+ Otherwise, return NULL. */
tree
expr_only (tree expr)
struct nesting_info *inner;
struct nesting_info *next;
+ htab_t GTY ((param_is (struct var_map_elt))) field_map;
htab_t GTY ((param_is (struct var_map_elt))) var_map;
+ bitmap suppress_expansion;
+
tree context;
tree new_local_var_chain;
+ tree debug_var_chain;
tree frame_type;
tree frame_decl;
tree chain_field;
/* Insert FIELD into TYPE, sorted by alignment requirements. */
-static void
+void
insert_field_into_struct (tree type, tree field)
{
tree *p;
tree field;
dummy.old = decl;
- slot = htab_find_slot (info->var_map, &dummy, insert);
+ slot = htab_find_slot (info->field_map, &dummy, insert);
if (!slot)
{
gcc_assert (insert != INSERT);
return field;
}
\f
-/* Convenience routines to walk all statements of a gimple function.
-
- For each statement, we invoke CALLBACK via walk_tree. The passed
- data is a walk_stmt_info structure. Of note here is a TSI that
- points to the current statement being walked. The VAL_ONLY flag
- that indicates whether the *TP being examined may be replaced
- with something that matches is_gimple_val (if true) or something
- slightly more complicated (if false). "Something" technically
- means the common subset of is_gimple_lvalue and is_gimple_rhs,
- but we never try to form anything more complicated than that, so
- we don't bother checking. */
-
-struct walk_stmt_info
-{
- walk_tree_fn callback;
- tree_stmt_iterator tsi;
- struct nesting_info *info;
- bool val_only;
- bool is_lhs;
- bool changed;
-};
+/* Iterate over all sub-statements of *TP calling walk_tree with
+ WI->CALLBACK for every sub-expression in each statement found. */
-/* A subroutine of walk_function. Iterate over all sub-statements of *TP. */
-
-static void
+void
walk_stmts (struct walk_stmt_info *wi, tree *tp)
{
tree t = *tp;
+ int walk_subtrees;
+
if (!t)
return;
+ if (wi->want_locations && EXPR_HAS_LOCATION (t))
+ input_location = EXPR_LOCATION (t);
+
switch (TREE_CODE (t))
{
case STATEMENT_LIST:
walk_stmts (wi, &TREE_OPERAND (t, 0));
walk_stmts (wi, &TREE_OPERAND (t, 1));
break;
+
case BIND_EXPR:
+ if (wi->want_bind_expr)
+ {
+ walk_subtrees = 1;
+ wi->callback (tp, &walk_subtrees, wi);
+ if (!walk_subtrees)
+ break;
+ }
walk_stmts (wi, &BIND_EXPR_BODY (t));
break;
case RETURN_EXPR:
+ if (wi->want_return_expr)
+ {
+ walk_subtrees = 1;
+ wi->callback (tp, &walk_subtrees, wi);
+ if (!walk_subtrees)
+ break;
+ }
walk_stmts (wi, &TREE_OPERAND (t, 0));
break;
}
}
-/* Invoke CALLBACK on all statements of INFO->CONTEXT. */
+/* Invoke CALLBACK on all statements of *STMT_P. */
static void
-walk_function (walk_tree_fn callback, struct nesting_info *info)
+walk_body (walk_tree_fn callback, struct nesting_info *info, tree *stmt_p)
{
struct walk_stmt_info wi;
wi.info = info;
wi.val_only = true;
- walk_stmts (&wi, &DECL_SAVED_TREE (info->context));
+ walk_stmts (&wi, stmt_p);
+}
+
+/* Invoke CALLBACK on all statements of INFO->CONTEXT. */
+
+static inline void
+walk_function (walk_tree_fn callback, struct nesting_info *info)
+{
+ walk_body (callback, info, &DECL_SAVED_TREE (info->context));
}
/* Similarly for ROOT and all functions nested underneath, depth first. */
create_nesting_tree (struct cgraph_node *cgn)
{
struct nesting_info *info = GGC_CNEW (struct nesting_info);
+ info->field_map = htab_create_ggc (7, var_map_hash, var_map_eq, ggc_free);
info->var_map = htab_create_ggc (7, var_map_hash, var_map_eq, ggc_free);
+ info->suppress_expansion = BITMAP_GGC_ALLOC ();
info->context = cgn->decl;
for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested)
return x;
}
+/* A subroutine of convert_nonlocal_reference. Create a local variable
+ in the nested function with DECL_VALUE_EXPR set to reference the true
+ variable in the parent function. This is used both for debug info
+ and in OpenMP lowering. */
+
+static tree
+get_nonlocal_debug_decl (struct nesting_info *info, tree decl)
+{
+ struct var_map_elt *elt, dummy;
+ tree target_context;
+ struct nesting_info *i;
+ tree x, field, new_decl;
+ void **slot;
+
+ dummy.old = decl;
+ slot = htab_find_slot (info->var_map, &dummy, INSERT);
+ elt = *slot;
+
+ if (elt)
+ return elt->new;
+
+ target_context = decl_function_context (decl);
+
+ /* A copy of the code in get_frame_field, but without the temporaries. */
+ if (info->context == target_context)
+ {
+ /* Make sure frame_decl gets created. */
+ (void) get_frame_type (info);
+ x = info->frame_decl;
+ i = info;
+ }
+ else
+ {
+ x = get_chain_decl (info);
+ for (i = info->outer; i->context != target_context; i = i->outer)
+ {
+ field = get_chain_field (i);
+ x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
+ x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
+ }
+ x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
+ }
+
+ field = lookup_field_for_decl (i, decl, INSERT);
+ x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
+ if (use_pointer_in_frame (decl))
+ x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
+
+ /* ??? We should be remapping types as well, surely. */
+ new_decl = build_decl (VAR_DECL, DECL_NAME (decl), TREE_TYPE (decl));
+ DECL_CONTEXT (new_decl) = info->context;
+ DECL_SOURCE_LOCATION (new_decl) = DECL_SOURCE_LOCATION (decl);
+ DECL_ARTIFICIAL (new_decl) = DECL_ARTIFICIAL (decl);
+ DECL_IGNORED_P (new_decl) = DECL_IGNORED_P (decl);
+ TREE_THIS_VOLATILE (new_decl) = TREE_THIS_VOLATILE (decl);
+ TREE_SIDE_EFFECTS (new_decl) = TREE_SIDE_EFFECTS (decl);
+ TREE_READONLY (new_decl) = TREE_READONLY (decl);
+ TREE_ADDRESSABLE (new_decl) = TREE_ADDRESSABLE (decl);
+ DECL_SEEN_IN_BIND_EXPR_P (new_decl) = 1;
+
+ SET_DECL_VALUE_EXPR (new_decl, x);
+ DECL_HAS_VALUE_EXPR_P (new_decl) = 1;
+
+ elt = ggc_alloc (sizeof (*elt));
+ elt->old = decl;
+ elt->new = new_decl;
+ *slot = elt;
+
+ TREE_CHAIN (new_decl) = info->debug_var_chain;
+ info->debug_var_chain = new_decl;
+
+ return new_decl;
+}
+
/* Called via walk_function+walk_tree, rewrite all references to VAR
and PARM_DECLs that belong to outer functions.
be CHAIN->FOO. For two levels it'll be CHAIN->__chain->FOO. Further
indirections apply to decls for which use_pointer_in_frame is true. */
+static bool convert_nonlocal_omp_clauses (tree *, struct walk_stmt_info *);
+
static tree
convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data)
{
struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
struct nesting_info *info = wi->info;
tree t = *tp;
+ tree save_local_var_chain;
+ bitmap save_suppress;
*walk_subtrees = 0;
switch (TREE_CODE (t))
case PARM_DECL:
if (decl_function_context (t) != info->context)
{
- tree target_context = decl_function_context (t);
- struct nesting_info *i;
tree x;
wi->changed = true;
- for (i = info->outer; i->context != target_context; i = i->outer)
- continue;
- x = lookup_field_for_decl (i, t, INSERT);
- x = get_frame_field (info, target_context, x, &wi->tsi);
- if (use_pointer_in_frame (t))
+ x = get_nonlocal_debug_decl (info, t);
+ if (!bitmap_bit_p (info->suppress_expansion, DECL_UID (t)))
{
- x = init_tmp_var (info, x, &wi->tsi);
- x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
+ tree target_context = decl_function_context (t);
+ struct nesting_info *i;
+ for (i = info->outer; i->context != target_context; i = i->outer)
+ continue;
+ x = lookup_field_for_decl (i, t, INSERT);
+ x = get_frame_field (info, target_context, x, &wi->tsi);
+ if (use_pointer_in_frame (t))
+ {
+ x = init_tmp_var (info, x, &wi->tsi);
+ x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
+ }
}
if (wi->val_only)
walk_tree (tp, convert_nonlocal_reference, wi, NULL);
break;
+ case OMP_PARALLEL:
+ save_suppress = info->suppress_expansion;
+ if (convert_nonlocal_omp_clauses (&OMP_PARALLEL_CLAUSES (t), wi))
+ {
+ tree c;
+ c = get_chain_decl (info);
+ c = build1 (OMP_CLAUSE_FIRSTPRIVATE, void_type_node, c);
+ OMP_CLAUSE_CHAIN (c) = OMP_PARALLEL_CLAUSES (t);
+ OMP_PARALLEL_CLAUSES (t) = c;
+ }
+
+ save_local_var_chain = info->new_local_var_chain;
+ info->new_local_var_chain = NULL;
+
+ walk_body (convert_nonlocal_reference, info, &OMP_PARALLEL_BODY (t));
+
+ if (info->new_local_var_chain)
+ declare_tmp_vars (info->new_local_var_chain, OMP_PARALLEL_BODY (t));
+ info->new_local_var_chain = save_local_var_chain;
+ info->suppress_expansion = save_suppress;
+ break;
+
+ case OMP_FOR:
+ case OMP_SECTIONS:
+ case OMP_SINGLE:
+ save_suppress = info->suppress_expansion;
+ convert_nonlocal_omp_clauses (&OMP_CLAUSES (t), wi);
+ walk_body (convert_nonlocal_reference, info, &OMP_BODY (t));
+ info->suppress_expansion = save_suppress;
+ break;
+
+ case OMP_SECTION:
+ case OMP_MASTER:
+ case OMP_ORDERED:
+ walk_body (convert_nonlocal_reference, info, &OMP_BODY (t));
+ break;
+
default:
if (!IS_TYPE_OR_DECL_P (t))
{
return NULL_TREE;
}
+static bool
+convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
+{
+ struct nesting_info *info = wi->info;
+ bool need_chain = false;
+ tree clause, decl;
+ int dummy;
+ bitmap new_suppress;
+
+ new_suppress = BITMAP_GGC_ALLOC ();
+ bitmap_copy (new_suppress, info->suppress_expansion);
+
+ for (clause = *pclauses; clause ; clause = OMP_CLAUSE_CHAIN (clause))
+ {
+ switch (TREE_CODE (clause))
+ {
+ case OMP_CLAUSE_PRIVATE:
+ case OMP_CLAUSE_FIRSTPRIVATE:
+ case OMP_CLAUSE_LASTPRIVATE:
+ case OMP_CLAUSE_REDUCTION:
+ case OMP_CLAUSE_COPYPRIVATE:
+ case OMP_CLAUSE_SHARED:
+ decl = OMP_CLAUSE_DECL (clause);
+ if (decl_function_context (decl) != info->context)
+ {
+ bitmap_set_bit (new_suppress, DECL_UID (decl));
+ OMP_CLAUSE_DECL (clause) = get_nonlocal_debug_decl (info, decl);
+ need_chain = true;
+ }
+ break;
+
+ case OMP_CLAUSE_SCHEDULE:
+ if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause) == NULL)
+ break;
+ /* FALLTHRU */
+ case OMP_CLAUSE_IF:
+ case OMP_CLAUSE_NUM_THREADS:
+ wi->val_only = true;
+ wi->is_lhs = false;
+ convert_nonlocal_reference (&TREE_OPERAND (clause, 0), &dummy, wi);
+ break;
+
+ case OMP_CLAUSE_NOWAIT:
+ case OMP_CLAUSE_ORDERED:
+ case OMP_CLAUSE_DEFAULT:
+ case OMP_CLAUSE_COPYIN:
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+ }
+
+ info->suppress_expansion = new_suppress;
+
+ return need_chain;
+}
+
+/* A subroutine of convert_local_reference. Create a local variable
+ in the parent function with DECL_VALUE_EXPR set to reference the
+ field in FRAME. This is used both for debug info and in OpenMP
+ lowering. */
+
+static tree
+get_local_debug_decl (struct nesting_info *info, tree decl, tree field)
+{
+ struct var_map_elt *elt, dummy;
+ tree x, new_decl;
+ void **slot;
+
+ dummy.old = decl;
+ slot = htab_find_slot (info->var_map, &dummy, INSERT);
+ elt = *slot;
+
+ if (elt)
+ return elt->new;
+
+ /* Make sure frame_decl gets created. */
+ (void) get_frame_type (info);
+ x = info->frame_decl;
+ x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
+
+ new_decl = build_decl (VAR_DECL, DECL_NAME (decl), TREE_TYPE (decl));
+ DECL_CONTEXT (new_decl) = info->context;
+ DECL_SOURCE_LOCATION (new_decl) = DECL_SOURCE_LOCATION (decl);
+ DECL_ARTIFICIAL (new_decl) = DECL_ARTIFICIAL (decl);
+ DECL_IGNORED_P (new_decl) = DECL_IGNORED_P (decl);
+ TREE_THIS_VOLATILE (new_decl) = TREE_THIS_VOLATILE (decl);
+ TREE_SIDE_EFFECTS (new_decl) = TREE_SIDE_EFFECTS (decl);
+ TREE_READONLY (new_decl) = TREE_READONLY (decl);
+ TREE_ADDRESSABLE (new_decl) = TREE_ADDRESSABLE (decl);
+ DECL_SEEN_IN_BIND_EXPR_P (new_decl) = 1;
+
+ SET_DECL_VALUE_EXPR (new_decl, x);
+ DECL_HAS_VALUE_EXPR_P (new_decl) = 1;
+
+ elt = ggc_alloc (sizeof (*elt));
+ elt->old = decl;
+ elt->new = new_decl;
+ *slot = elt;
+
+ TREE_CHAIN (new_decl) = info->debug_var_chain;
+ info->debug_var_chain = new_decl;
+
+ return new_decl;
+}
+
/* Called via walk_function+walk_tree, rewrite all references to VAR
and PARM_DECLs that were referenced by inner nested functions.
The rewrite will be a structure reference to the local frame variable. */
+static bool convert_local_omp_clauses (tree *, struct walk_stmt_info *);
+
static tree
convert_local_reference (tree *tp, int *walk_subtrees, void *data)
{
struct nesting_info *info = wi->info;
tree t = *tp, field, x;
bool save_val_only;
+ tree save_local_var_chain;
+ bitmap save_suppress;
*walk_subtrees = 0;
switch (TREE_CODE (t))
break;
wi->changed = true;
- x = get_frame_field (info, info->context, field, &wi->tsi);
+ x = get_local_debug_decl (info, t, field);
+ if (!bitmap_bit_p (info->suppress_expansion, DECL_UID (t)))
+ x = get_frame_field (info, info->context, field, &wi->tsi);
if (wi->val_only)
{
wi->val_only = save_val_only;
break;
+ case OMP_PARALLEL:
+ save_suppress = info->suppress_expansion;
+ if (convert_local_omp_clauses (&OMP_PARALLEL_CLAUSES (t), wi))
+ {
+ tree c;
+ (void) get_frame_type (info);
+ c = build1 (OMP_CLAUSE_SHARED, void_type_node, info->frame_decl);
+ OMP_CLAUSE_CHAIN (c) = OMP_PARALLEL_CLAUSES (t);
+ OMP_PARALLEL_CLAUSES (t) = c;
+ }
+
+ save_local_var_chain = info->new_local_var_chain;
+ info->new_local_var_chain = NULL;
+
+ walk_body (convert_local_reference, info, &OMP_PARALLEL_BODY (t));
+
+ if (info->new_local_var_chain)
+ declare_tmp_vars (info->new_local_var_chain, OMP_PARALLEL_BODY (t));
+ info->new_local_var_chain = save_local_var_chain;
+ info->suppress_expansion = save_suppress;
+ break;
+
+ case OMP_FOR:
+ case OMP_SECTIONS:
+ case OMP_SINGLE:
+ save_suppress = info->suppress_expansion;
+ convert_local_omp_clauses (&OMP_CLAUSES (t), wi);
+ walk_body (convert_local_reference, info, &OMP_BODY (t));
+ info->suppress_expansion = save_suppress;
+ break;
+
+ case OMP_SECTION:
+ case OMP_MASTER:
+ case OMP_ORDERED:
+ walk_body (convert_local_reference, info, &OMP_BODY (t));
+ break;
+
default:
if (!IS_TYPE_OR_DECL_P (t))
{
return NULL_TREE;
}
+static bool
+convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
+{
+ struct nesting_info *info = wi->info;
+ bool need_frame = false;
+ tree clause, decl;
+ int dummy;
+ bitmap new_suppress;
+
+ new_suppress = BITMAP_GGC_ALLOC ();
+ bitmap_copy (new_suppress, info->suppress_expansion);
+
+ for (clause = *pclauses; clause ; clause = OMP_CLAUSE_CHAIN (clause))
+ {
+ switch (TREE_CODE (clause))
+ {
+ case OMP_CLAUSE_PRIVATE:
+ case OMP_CLAUSE_FIRSTPRIVATE:
+ case OMP_CLAUSE_LASTPRIVATE:
+ case OMP_CLAUSE_REDUCTION:
+ case OMP_CLAUSE_COPYPRIVATE:
+ case OMP_CLAUSE_SHARED:
+ decl = OMP_CLAUSE_DECL (clause);
+ if (decl_function_context (decl) == info->context
+ && !use_pointer_in_frame (decl))
+ {
+ tree field = lookup_field_for_decl (info, decl, NO_INSERT);
+ if (field)
+ {
+ bitmap_set_bit (new_suppress, DECL_UID (decl));
+ OMP_CLAUSE_DECL (clause)
+ = get_local_debug_decl (info, decl, field);
+ need_frame = true;
+ }
+ }
+ break;
+
+ case OMP_CLAUSE_SCHEDULE:
+ if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause) == NULL)
+ break;
+ /* FALLTHRU */
+ case OMP_CLAUSE_IF:
+ case OMP_CLAUSE_NUM_THREADS:
+ wi->val_only = true;
+ wi->is_lhs = false;
+ convert_local_reference (&TREE_OPERAND (clause, 0), &dummy, wi);
+ break;
+
+ case OMP_CLAUSE_NOWAIT:
+ case OMP_CLAUSE_ORDERED:
+ case OMP_CLAUSE_DEFAULT:
+ case OMP_CLAUSE_COPYIN:
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+ }
+
+ info->suppress_expansion = new_suppress;
+
+ return need_frame;
+}
+
/* Called via walk_function+walk_tree, rewrite all GOTO_EXPRs that
reference labels from outer functions. The rewrite will be a
call to __builtin_nonlocal_goto. */
*walk_subtrees = 1;
break;
+ case OMP_FOR:
+ case OMP_SECTIONS:
+ case OMP_SINGLE:
+ case OMP_MASTER:
+ case OMP_ORDERED:
+ case OMP_CRITICAL:
+ walk_body (convert_call_expr, info, &OMP_BODY (t));
+ break;
+
default:
break;
}
tree stmt_list = NULL;
tree context = root->context;
struct function *sf;
- struct cgraph_node *node;
/* If we created a non-local frame type or decl, we need to lay them
out at this time. */
if (root->new_local_var_chain)
declare_tmp_vars (root->new_local_var_chain,
DECL_SAVED_TREE (root->context));
+ if (root->debug_var_chain)
+ declare_tmp_vars (root->debug_var_chain,
+ DECL_SAVED_TREE (root->context));
/* Dump the translated tree function. */
dump_function (TDI_nested, root->context);
- node = cgraph_node (root->context);
+}
+
+static void
+finalize_nesting_tree (struct nesting_info *root)
+{
+ do
+ {
+ if (root->inner)
+ finalize_nesting_tree (root->inner);
+ finalize_nesting_tree_1 (root);
+ root = root->next;
+ }
+ while (root);
+}
+
+/* Unnest the nodes and pass them to cgraph. */
+
+static void
+unnest_nesting_tree_1 (struct nesting_info *root)
+{
+ struct cgraph_node *node = cgraph_node (root->context);
/* For nested functions update the cgraph to reflect unnesting.
We also delay finalizing of these functions up to this point. */
}
static void
-finalize_nesting_tree (struct nesting_info *root)
+unnest_nesting_tree (struct nesting_info *root)
{
do
{
if (root->inner)
- finalize_nesting_tree (root->inner);
- finalize_nesting_tree_1 (root);
+ unnest_nesting_tree (root->inner);
+ unnest_nesting_tree_1 (root);
root = root->next;
}
while (root);
walk_all_functions (convert_nl_goto_receiver, root);
convert_all_function_calls (root);
finalize_nesting_tree (root);
+ unnest_nesting_tree (root);
free_nesting_tree (root);
root = NULL;
}
#define TDF_STMTADDR (1 << 12) /* Address of stmt. */
#define TDF_GRAPH (1 << 13) /* a graph dump is being emitted */
+#define TDF_CHAIN (1 << 14) /* Follow TREE_CHAIN when
+ dumping *_DECLs. */
extern char *get_dump_file_name (enum tree_dump_index);
extern int dump_enabled_p (enum tree_dump_index);
#define PROP_no_crit_edges (1 << 7)
#define PROP_rtl (1 << 8)
#define PROP_alias (1 << 9)
+#define PROP_gimple_lomp (1 << 10) /* lowered OpenMP directives */
#define PROP_trees \
(PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh)
extern struct tree_opt_pass pass_lower_complex;
extern struct tree_opt_pass pass_lower_vector;
extern struct tree_opt_pass pass_lower_vector_ssa;
+extern struct tree_opt_pass pass_lower_omp;
extern struct tree_opt_pass pass_object_sizes;
extern struct tree_opt_pass pass_fold_builtins;
extern struct tree_opt_pass pass_stdarg;
/* Local functions, macros and variables. */
static int op_prio (tree);
+static const char *op_symbol_1 (enum tree_code);
static const char *op_symbol (tree);
static void pretty_print_string (pretty_printer *, const char*);
static void print_call_name (pretty_printer *, tree);
static pretty_printer buffer;
static int initialized = 0;
-static bool dumping_stmts;
/* Try to print something for an unknown tree code. */
fprintf (stderr, "\n");
}
+void
+debug_tree_chain (tree t)
+{
+ print_generic_expr (stderr, t, TDF_VOPS|TDF_UID|TDF_CHAIN);
+ fprintf (stderr, "\n");
+}
+
/* Prints declaration DECL to the FILE with details specified by FLAGS. */
void
print_generic_decl (FILE *file, tree decl, int flags)
{
maybe_init_pretty_print (file);
- dumping_stmts = true;
print_declaration (&buffer, decl, 2, flags);
pp_write_text_to_stream (&buffer);
}
print_generic_stmt (FILE *file, tree t, int flags)
{
maybe_init_pretty_print (file);
- dumping_stmts = true;
dump_generic_node (&buffer, t, 0, flags, true);
pp_flush (&buffer);
}
int i;
maybe_init_pretty_print (file);
- dumping_stmts = true;
for (i = 0; i < indent; i++)
pp_space (&buffer);
print_generic_expr (FILE *file, tree t, int flags)
{
maybe_init_pretty_print (file);
- dumping_stmts = false;
dump_generic_node (&buffer, t, 0, flags, false);
}
static void
dump_decl_name (pretty_printer *buffer, tree node, int flags)
{
- if (DECL_NAME (node))
- pp_tree_identifier (buffer, DECL_NAME (node));
+ tree t = node;
- if ((flags & TDF_UID)
- || DECL_NAME (node) == NULL_TREE)
+ while (t)
{
- if (TREE_CODE (node) == LABEL_DECL
- && LABEL_DECL_UID (node) != -1)
- pp_printf (buffer, "L." HOST_WIDE_INT_PRINT_DEC,
- LABEL_DECL_UID (node));
- else
+ if (DECL_NAME (t))
+ pp_tree_identifier (buffer, DECL_NAME (t));
+
+ if ((flags & TDF_UID)
+ || DECL_NAME (t) == NULL_TREE)
+ {
+ if (TREE_CODE (t) == LABEL_DECL
+ && LABEL_DECL_UID (t) != -1)
+ pp_printf (buffer, "L." HOST_WIDE_INT_PRINT_DEC,
+ LABEL_DECL_UID (t));
+ else
+ {
+ char c = TREE_CODE (t) == CONST_DECL ? 'C' : 'D';
+ pp_printf (buffer, "%c.%u", c, DECL_UID (t));
+ }
+ }
+
+ if (flags & TDF_CHAIN)
{
- char c = TREE_CODE (node) == CONST_DECL ? 'C' : 'D';
- pp_printf (buffer, "%c.%u", c, DECL_UID (node));
+ t = TREE_CHAIN (t);
+ pp_string (buffer, " ");
}
+ else
+ t = NULL_TREE;
}
}
pp_character (buffer, ']');
}
+/* Dump the list of OpenMP clauses. */
+
+static void
+dump_omp_clauses (pretty_printer *buffer, tree clause, int spc, int flags)
+{
+ const char *name;
+
+ if (clause == NULL)
+ return;
+
+ pp_space (buffer);
+ while (1)
+ {
+ switch (TREE_CODE (clause))
+ {
+ case OMP_CLAUSE_PRIVATE:
+ name = "private";
+ goto print_remap;
+ case OMP_CLAUSE_SHARED:
+ name = "shared";
+ goto print_remap;
+ case OMP_CLAUSE_FIRSTPRIVATE:
+ name = "firstprivate";
+ goto print_remap;
+ case OMP_CLAUSE_LASTPRIVATE:
+ name = "lastprivate";
+ goto print_remap;
+ case OMP_CLAUSE_COPYIN:
+ name = "copyin";
+ goto print_remap;
+ case OMP_CLAUSE_COPYPRIVATE:
+ name = "copyprivate";
+ goto print_remap;
+ print_remap:
+ pp_string (buffer, name);
+ pp_character (buffer, '(');
+ dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
+ spc, flags, false);
+ pp_character (buffer, ')');
+ break;
+
+ case OMP_CLAUSE_REDUCTION:
+ pp_string (buffer, "reduction(");
+ pp_string (buffer, op_symbol_1 (OMP_CLAUSE_REDUCTION_CODE (clause)));
+ pp_character (buffer, ':');
+ dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
+ spc, flags, false);
+ pp_character (buffer, ')');
+ break;
+
+ case OMP_CLAUSE_IF:
+ pp_string (buffer, "if(");
+ dump_generic_node (buffer, OMP_CLAUSE_IF_EXPR (clause),
+ spc, flags, false);
+ pp_character (buffer, ')');
+ break;
+
+ case OMP_CLAUSE_NUM_THREADS:
+ pp_string (buffer, "num_threads(");
+ dump_generic_node (buffer, OMP_CLAUSE_NUM_THREADS_EXPR (clause),
+ spc, flags, false);
+ pp_character (buffer, ')');
+ break;
+
+ case OMP_CLAUSE_NOWAIT:
+ pp_string (buffer, "nowait");
+ break;
+ case OMP_CLAUSE_ORDERED:
+ pp_string (buffer, "ordered");
+ break;
+
+ case OMP_CLAUSE_DEFAULT:
+ pp_string (buffer, "default(");
+ switch (OMP_CLAUSE_DEFAULT_KIND (clause))
+ {
+ case OMP_CLAUSE_DEFAULT_UNSPECIFIED:
+ break;
+ case OMP_CLAUSE_DEFAULT_SHARED:
+ pp_string (buffer, "shared");
+ break;
+ case OMP_CLAUSE_DEFAULT_NONE:
+ pp_string (buffer, "none");
+ break;
+ case OMP_CLAUSE_DEFAULT_PRIVATE:
+ pp_string (buffer, "private");
+ break;
+ default:
+ gcc_unreachable ();
+ }
+ pp_character (buffer, ')');
+ break;
+
+ case OMP_CLAUSE_SCHEDULE:
+ pp_string (buffer, "schedule(");
+ switch (OMP_CLAUSE_SCHEDULE_KIND (clause))
+ {
+ case OMP_CLAUSE_SCHEDULE_STATIC:
+ pp_string (buffer, "static");
+ break;
+ case OMP_CLAUSE_SCHEDULE_DYNAMIC:
+ pp_string (buffer, "dynamic");
+ break;
+ case OMP_CLAUSE_SCHEDULE_GUIDED:
+ pp_string (buffer, "guided");
+ break;
+ case OMP_CLAUSE_SCHEDULE_RUNTIME:
+ pp_string (buffer, "runtime");
+ break;
+ default:
+ gcc_unreachable ();
+ }
+ if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause))
+ {
+ pp_character (buffer, ',');
+ dump_generic_node (buffer,
+ OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause),
+ spc, flags, false);
+ }
+ pp_character (buffer, ')');
+ break;
+
+ default:
+ /* Should never happen. */
+ dump_generic_node (buffer, clause, spc, flags, false);
+ break;
+ }
+
+ clause = OMP_CLAUSE_CHAIN (clause);
+ if (clause == NULL)
+ return;
+ pp_space (buffer);
+ }
+}
+
/* Dump the node NODE on the pretty_printer BUFFER, SPC spaces of indent.
FLAGS specifies details to show in the dump (see TDF_* in tree.h). If
IS_STMT is true, the object printed is considered to be a statement
if (is_stmt && (flags & TDF_STMTADDR))
pp_printf (buffer, "<&%p> ", (void *)node);
- if (dumping_stmts
- && (flags & TDF_LINENO)
- && EXPR_HAS_LOCATION (node))
+ if ((flags & TDF_LINENO) && EXPR_HAS_LOCATION (node))
{
expanded_location xloc = expand_location (EXPR_LOCATION (node));
pp_character (buffer, '[');
}
break;
- case BLOCK:
- NIY;
- break;
-
case VOID_TYPE:
case INTEGER_TYPE:
case REAL_TYPE:
}
dump_generic_node (buffer, TREE_OPERAND (node, 0),
- spc, flags, dumping_stmts);
- if (dumping_stmts)
+ spc, flags, !(flags & TDF_SLIM));
+ if (flags & TDF_SLIM)
newline_and_indent (buffer, spc);
else
{
tp = &TREE_OPERAND (*tp, 1))
{
dump_generic_node (buffer, TREE_OPERAND (*tp, 0),
- spc, flags, dumping_stmts);
- if (dumping_stmts)
+ spc, flags, !(flags & TDF_SLIM));
+ if (flags & TDF_SLIM)
newline_and_indent (buffer, spc);
else
{
}
}
- dump_generic_node (buffer, *tp, spc, flags, dumping_stmts);
+ dump_generic_node (buffer, *tp, spc, flags, !(flags & TDF_SLIM));
}
break;
tree_stmt_iterator si;
bool first = true;
- if ((flags & TDF_SLIM) || !dumping_stmts)
+ if (flags & TDF_SLIM)
{
pp_string (buffer, "<STATEMENT_LIST>");
break;
if (SWITCH_BODY (node))
{
newline_and_indent (buffer, spc+4);
- dump_generic_node (buffer, SWITCH_BODY (node), spc+4, flags, true);
+ dump_generic_node (buffer, SWITCH_BODY (node), spc+4, flags,
+ true);
}
else
{
{
tree elt = TREE_VEC_ELT (vec, i);
newline_and_indent (buffer, spc+4);
- dump_generic_node (buffer, elt, spc+4, flags, false);
- pp_string (buffer, " goto ");
- dump_generic_node (buffer, CASE_LABEL (elt), spc+4, flags, true);
- pp_semicolon (buffer);
+ if (elt)
+ {
+ dump_generic_node (buffer, elt, spc+4, flags, false);
+ pp_string (buffer, " goto ");
+ dump_generic_node (buffer, CASE_LABEL (elt), spc+4,
+ flags, true);
+ pp_semicolon (buffer);
+ }
+ else
+ pp_string (buffer, "case ???: goto ???;");
}
}
newline_and_indent (buffer, spc+2);
pp_string (buffer, " > ");
break;
+ case OMP_PARALLEL:
+ pp_string (buffer, "#pragma omp parallel");
+ dump_omp_clauses (buffer, OMP_PARALLEL_CLAUSES (node), spc, flags);
+
+ dump_omp_body:
+ if (!(flags & TDF_SLIM) && OMP_BODY (node))
+ {
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '{');
+ newline_and_indent (buffer, spc + 4);
+ dump_generic_node (buffer, OMP_BODY (node), spc + 4, flags, false);
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '}');
+ }
+ is_expr = false;
+ break;
+
+ case OMP_FOR:
+ pp_string (buffer, "#pragma omp for");
+ dump_omp_clauses (buffer, OMP_FOR_CLAUSES (node), spc, flags);
+
+ if (!(flags & TDF_SLIM))
+ {
+ if (OMP_FOR_PRE_BODY (node))
+ {
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '{');
+ spc += 4;
+ newline_and_indent (buffer, spc);
+ dump_generic_node (buffer, OMP_FOR_PRE_BODY (node),
+ spc, flags, false);
+ }
+ newline_and_indent (buffer, spc);
+ pp_string (buffer, "for (");
+ dump_generic_node (buffer, OMP_FOR_INIT (node), spc, flags, false);
+ pp_string (buffer, "; ");
+ dump_generic_node (buffer, OMP_FOR_COND (node), spc, flags, false);
+ pp_string (buffer, "; ");
+ dump_generic_node (buffer, OMP_FOR_INCR (node), spc, flags, false);
+ pp_string (buffer, ")");
+ if (OMP_FOR_BODY (node))
+ {
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '{');
+ newline_and_indent (buffer, spc + 4);
+ dump_generic_node (buffer, OMP_FOR_BODY (node), spc + 4, flags,
+ false);
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '}');
+ }
+ if (OMP_FOR_PRE_BODY (node))
+ {
+ spc -= 4;
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '}');
+ }
+ }
+ is_expr = false;
+ break;
+
+ case OMP_SECTIONS:
+ pp_string (buffer, "#pragma omp sections");
+ dump_omp_clauses (buffer, OMP_SECTIONS_CLAUSES (node), spc, flags);
+ goto dump_omp_body;
+
+ case OMP_SECTION:
+ pp_string (buffer, "#pragma omp section");
+ goto dump_omp_body;
+
+ case OMP_MASTER:
+ pp_string (buffer, "#pragma omp master");
+ goto dump_omp_body;
+
+ case OMP_ORDERED:
+ pp_string (buffer, "#pragma omp ordered");
+ goto dump_omp_body;
+
+ case OMP_CRITICAL:
+ pp_string (buffer, "#pragma omp critical");
+ if (OMP_CRITICAL_NAME (node))
+ {
+ pp_space (buffer);
+ pp_character (buffer, '(');
+ dump_generic_node (buffer, OMP_CRITICAL_NAME (node), spc,
+ flags, false);
+ pp_character (buffer, ')');
+ }
+ goto dump_omp_body;
+
+ case OMP_ATOMIC:
+ pp_string (buffer, "#pragma omp atomic");
+ newline_and_indent (buffer, spc + 2);
+ dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
+ pp_space (buffer);
+ pp_character (buffer, '=');
+ pp_space (buffer);
+ dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
+ break;
+
+ case OMP_SINGLE:
+ pp_string (buffer, "#pragma omp single");
+ dump_omp_clauses (buffer, OMP_SINGLE_CLAUSES (node), spc, flags);
+ goto dump_omp_body;
+
case REDUC_MAX_EXPR:
pp_string (buffer, " REDUC_MAX_EXPR < ");
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
pp_string (buffer, " > ");
break;
+ case BLOCK:
+ {
+ tree t;
+ pp_string (buffer, "BLOCK");
+
+ if (BLOCK_ABSTRACT (node))
+ pp_string (buffer, " [abstract]");
+
+ if (TREE_ASM_WRITTEN (node))
+ pp_string (buffer, " [written]");
+
+ newline_and_indent (buffer, spc + 2);
+
+ if (BLOCK_SUPERCONTEXT (node))
+ {
+ pp_string (buffer, "SUPERCONTEXT: ");
+ if (TREE_CODE (BLOCK_SUPERCONTEXT (node)) == BLOCK)
+ pp_printf (buffer, "BLOCK %p",
+ (void *)BLOCK_SUPERCONTEXT (node));
+ else
+ dump_generic_node (buffer, BLOCK_SUPERCONTEXT (node), 0, flags,
+ false);
+ newline_and_indent (buffer, spc + 2);
+ }
+
+ if (BLOCK_SUBBLOCKS (node))
+ {
+ pp_string (buffer, "SUBBLOCKS: ");
+ for (t = BLOCK_SUBBLOCKS (node); t; t = BLOCK_CHAIN (t))
+ pp_printf (buffer, "%p ", (void *)t);
+ newline_and_indent (buffer, spc + 2);
+ }
+
+ if (BLOCK_VARS (node))
+ {
+ pp_string (buffer, "VARS: ");
+ for (t = BLOCK_VARS (node); t; t = TREE_CHAIN (t))
+ {
+ dump_generic_node (buffer, t, 0, flags, false);
+ pp_string (buffer, " ");
+ }
+ newline_and_indent (buffer, spc + 2);
+ }
+
+ if (BLOCK_ABSTRACT_ORIGIN (node))
+ {
+ pp_string (buffer, "ABSTRACT_ORIGIN: ");
+ if (TREE_CODE (BLOCK_ABSTRACT_ORIGIN (node)) == BLOCK)
+ pp_printf (buffer, "BLOCK %p",
+ (void *)BLOCK_ABSTRACT_ORIGIN (node));
+ else
+ dump_generic_node (buffer, BLOCK_ABSTRACT_ORIGIN (node), 0, flags,
+ false);
+ newline_and_indent (buffer, spc + 2);
+ }
+ }
+ break;
+
default:
NIY;
}
}
}
+ if (TREE_CODE (t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (t))
+ {
+ pp_string (buffer, " [value-expr: ");
+ dump_generic_node (buffer, DECL_VALUE_EXPR (t), spc, flags, false);
+ pp_character (buffer, ']');
+ }
+
pp_character (buffer, ';');
}
/* Return the symbol associated with operator OP. */
static const char *
-op_symbol (tree op)
+op_symbol_1 (enum tree_code code)
{
- gcc_assert (op);
-
- switch (TREE_CODE (op))
+ switch (code)
{
case MODIFY_EXPR:
return "=";
case POSTINCREMENT_EXPR:
return "++ ";
+ case MAX_EXPR:
+ return "max";
+
+ case MIN_EXPR:
+ return "min";
+
default:
return "<<< ??? >>>";
}
}
+static const char *
+op_symbol (tree op)
+{
+ return op_symbol_1 (TREE_CODE (op));
+}
+
/* Prints the name of a CALL_EXPR. */
static void
dump_generic_bb (FILE *file, basic_block bb, int indent, int flags)
{
maybe_init_pretty_print (file);
- dumping_stmts = true;
dump_generic_bb_buff (&buffer, bb, indent, flags);
pp_flush (&buffer);
}
gcc_assert (INDEX_EDGE_PRED_BB (el, edge_index) != EXIT_BLOCK_PTR);
if (INDEX_EDGE_PRED_BB (el, edge_index) == ENTRY_BLOCK_PTR)
- ending_block = ENTRY_BLOCK_PTR->next_bb;
+ ending_block = single_succ (ENTRY_BLOCK_PTR);
else
ending_block = find_pdom (INDEX_EDGE_PRED_BB (el, edge_index));
}
tree
+build5_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
+ tree arg2, tree arg3, tree arg4 MEM_STAT_DECL)
+{
+ bool constant, read_only, side_effects, invariant;
+ tree t;
+
+ gcc_assert (TREE_CODE_LENGTH (code) == 5);
+
+ t = make_node_stat (code PASS_MEM_STAT);
+ TREE_TYPE (t) = tt;
+
+ side_effects = TREE_SIDE_EFFECTS (t);
+
+ PROCESS_ARG(0);
+ PROCESS_ARG(1);
+ PROCESS_ARG(2);
+ PROCESS_ARG(3);
+ PROCESS_ARG(4);
+
+ TREE_SIDE_EFFECTS (t) = side_effects;
+ TREE_THIS_VOLATILE (t)
+ = (TREE_CODE_CLASS (code) == tcc_reference
+ && arg0 && TREE_THIS_VOLATILE (arg0));
+
+ return t;
+}
+
+tree
build7_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
tree arg2, tree arg3, tree arg4, tree arg5,
tree arg6 MEM_STAT_DECL)
tree_code_name[TREE_CODE (node)], function, trim_filename (file), line);
}
+/* Similar to tree_check_failed, except that instead of specifying a
+ dozen codes, use the knowledge that they're all sequential. */
+
+void
+tree_range_check_failed (const tree node, const char *file, int line,
+ const char *function, enum tree_code c1,
+ enum tree_code c2)
+{
+ char *buffer;
+ unsigned length = 0;
+ enum tree_code c;
+
+ for (c = c1; c <= c2; ++c)
+ length += 4 + strlen (tree_code_name[c]);
+
+ length += strlen ("expected ");
+ buffer = alloca (length);
+ length = 0;
+
+ for (c = c1; c <= c2; ++c)
+ {
+ const char *prefix = length ? " or " : "expected ";
+
+ strcpy (buffer + length, prefix);
+ length += strlen (prefix);
+ strcpy (buffer + length, tree_code_name[c]);
+ length += strlen (tree_code_name[c]);
+ }
+
+ internal_error ("tree check: %s, have %s in %s, at %s:%d",
+ buffer, tree_code_name[TREE_CODE (node)],
+ function, trim_filename (file), line);
+}
+
+
/* Similar to tree_check_failed, except that we check that a tree does
not have the specified code, given in CL. */
interesting below this point in the tree. */
if (!walk_subtrees)
{
+ /* But we still need to check our siblings. */
if (code == TREE_LIST)
- /* But we still need to check our siblings. */
WALK_SUBTREE_TAIL (TREE_CHAIN (*tp));
+ else if (code >= OMP_CLAUSE_PRIVATE && code <= OMP_CLAUSE_DEFAULT)
+ WALK_SUBTREE_TAIL (OMP_CLAUSE_CHAIN (*tp));
else
return NULL_TREE;
}
if (result || ! walk_subtrees)
return result;
- /* If this is a DECL_EXPR, walk into various fields of the type that it's
- defining. We only want to walk into these fields of a type in this
- case. Note that decls get walked as part of the processing of a
- BIND_EXPR.
-
- ??? Precisely which fields of types that we are supposed to walk in
- this case vs. the normal case aren't well defined. */
- if (code == DECL_EXPR
- && TREE_CODE (DECL_EXPR_DECL (*tp)) == TYPE_DECL
- && TREE_CODE (TREE_TYPE (DECL_EXPR_DECL (*tp))) != ERROR_MARK)
+ switch (code)
{
- tree *type_p = &TREE_TYPE (DECL_EXPR_DECL (*tp));
+ case ERROR_MARK:
+ case IDENTIFIER_NODE:
+ case INTEGER_CST:
+ case REAL_CST:
+ case VECTOR_CST:
+ case STRING_CST:
+ case BLOCK:
+ case PLACEHOLDER_EXPR:
+ case SSA_NAME:
+ case FIELD_DECL:
+ case RESULT_DECL:
+ /* None of these have subtrees other than those already walked
+ above. */
+ break;
- /* Call the function for the type. See if it returns anything or
- doesn't want us to continue. If we are to continue, walk both
- the normal fields and those for the declaration case. */
- result = (*func) (type_p, &walk_subtrees, data);
- if (result || !walk_subtrees)
- return NULL_TREE;
+ case TREE_LIST:
+ WALK_SUBTREE (TREE_VALUE (*tp));
+ WALK_SUBTREE_TAIL (TREE_CHAIN (*tp));
+ break;
- result = walk_type_fields (*type_p, func, data, pset);
- if (result)
- return result;
+ case TREE_VEC:
+ {
+ int len = TREE_VEC_LENGTH (*tp);
- WALK_SUBTREE (TYPE_SIZE (*type_p));
- WALK_SUBTREE (TYPE_SIZE_UNIT (*type_p));
+ if (len == 0)
+ break;
- /* If this is a record type, also walk the fields. */
- if (TREE_CODE (*type_p) == RECORD_TYPE
- || TREE_CODE (*type_p) == UNION_TYPE
- || TREE_CODE (*type_p) == QUAL_UNION_TYPE)
- {
- tree field;
+ /* Walk all elements but the first. */
+ while (--len)
+ WALK_SUBTREE (TREE_VEC_ELT (*tp, len));
- for (field = TYPE_FIELDS (*type_p); field;
- field = TREE_CHAIN (field))
- {
- /* We'd like to look at the type of the field, but we can easily
- get infinite recursion. So assume it's pointed to elsewhere
- in the tree. Also, ignore things that aren't fields. */
- if (TREE_CODE (field) != FIELD_DECL)
- continue;
-
- WALK_SUBTREE (DECL_FIELD_OFFSET (field));
- WALK_SUBTREE (DECL_SIZE (field));
- WALK_SUBTREE (DECL_SIZE_UNIT (field));
- if (TREE_CODE (*type_p) == QUAL_UNION_TYPE)
- WALK_SUBTREE (DECL_QUALIFIER (field));
- }
- }
- }
+ /* Now walk the first one as a tail call. */
+ WALK_SUBTREE_TAIL (TREE_VEC_ELT (*tp, 0));
+ }
- else if (code != SAVE_EXPR
- && code != BIND_EXPR
- && IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code)))
- {
- int i, len;
-
- /* Walk over all the sub-trees of this operand. */
- len = TREE_CODE_LENGTH (code);
- /* TARGET_EXPRs are peculiar: operands 1 and 3 can be the same.
- But, we only want to walk once. */
- if (code == TARGET_EXPR
- && TREE_OPERAND (*tp, 3) == TREE_OPERAND (*tp, 1))
- --len;
-
- /* Go through the subtrees. We need to do this in forward order so
- that the scope of a FOR_EXPR is handled properly. */
-#ifdef DEBUG_WALK_TREE
- for (i = 0; i < len; ++i)
- WALK_SUBTREE (TREE_OPERAND (*tp, i));
-#else
- for (i = 0; i < len - 1; ++i)
- WALK_SUBTREE (TREE_OPERAND (*tp, i));
+ case COMPLEX_CST:
+ WALK_SUBTREE (TREE_REALPART (*tp));
+ WALK_SUBTREE_TAIL (TREE_IMAGPART (*tp));
- if (len)
- {
- /* The common case is that we may tail recurse here. */
- if (code != BIND_EXPR
- && !TREE_CHAIN (*tp))
- WALK_SUBTREE_TAIL (TREE_OPERAND (*tp, len - 1));
- else
- WALK_SUBTREE (TREE_OPERAND (*tp, len - 1));
- }
-#endif
- }
+ case CONSTRUCTOR:
+ {
+ unsigned HOST_WIDE_INT idx;
+ constructor_elt *ce;
- /* If this is a type, walk the needed fields in the type. */
- else if (TYPE_P (*tp))
- {
- result = walk_type_fields (*tp, func, data, pset);
- if (result)
- return result;
- }
- else
- {
- /* Not one of the easy cases. We must explicitly go through the
- children. */
- switch (code)
- {
- case ERROR_MARK:
- case IDENTIFIER_NODE:
- case INTEGER_CST:
- case REAL_CST:
- case VECTOR_CST:
- case STRING_CST:
- case BLOCK:
- case PLACEHOLDER_EXPR:
- case SSA_NAME:
- case FIELD_DECL:
- case RESULT_DECL:
- /* None of these have subtrees other than those already walked
- above. */
- break;
+ for (idx = 0;
+ VEC_iterate(constructor_elt, CONSTRUCTOR_ELTS (*tp), idx, ce);
+ idx++)
+ WALK_SUBTREE (ce->value);
+ }
+ break;
- case TREE_LIST:
- WALK_SUBTREE (TREE_VALUE (*tp));
- WALK_SUBTREE_TAIL (TREE_CHAIN (*tp));
- break;
+ case SAVE_EXPR:
+ WALK_SUBTREE_TAIL (TREE_OPERAND (*tp, 0));
- case TREE_VEC:
+ case BIND_EXPR:
+ {
+ tree decl;
+ for (decl = BIND_EXPR_VARS (*tp); decl; decl = TREE_CHAIN (decl))
{
- int len = TREE_VEC_LENGTH (*tp);
+ /* Walk the DECL_INITIAL and DECL_SIZE. We don't want to walk
+ into declarations that are just mentioned, rather than
+ declared; they don't really belong to this part of the tree.
+ And, we can see cycles: the initializer for a declaration
+ can refer to the declaration itself. */
+ WALK_SUBTREE (DECL_INITIAL (decl));
+ WALK_SUBTREE (DECL_SIZE (decl));
+ WALK_SUBTREE (DECL_SIZE_UNIT (decl));
+ }
+ WALK_SUBTREE_TAIL (BIND_EXPR_BODY (*tp));
+ }
- if (len == 0)
- break;
+ case STATEMENT_LIST:
+ {
+ tree_stmt_iterator i;
+ for (i = tsi_start (*tp); !tsi_end_p (i); tsi_next (&i))
+ WALK_SUBTREE (*tsi_stmt_ptr (i));
+ }
+ break;
- /* Walk all elements but the first. */
- while (--len)
- WALK_SUBTREE (TREE_VEC_ELT (*tp, len));
+ case OMP_CLAUSE_PRIVATE:
+ case OMP_CLAUSE_SHARED:
+ case OMP_CLAUSE_FIRSTPRIVATE:
+ case OMP_CLAUSE_LASTPRIVATE:
+ case OMP_CLAUSE_COPYIN:
+ case OMP_CLAUSE_COPYPRIVATE:
+ case OMP_CLAUSE_IF:
+ case OMP_CLAUSE_NUM_THREADS:
+ case OMP_CLAUSE_SCHEDULE:
+ WALK_SUBTREE (TREE_OPERAND (*tp, 0));
+ /* FALLTHRU */
+
+ case OMP_CLAUSE_NOWAIT:
+ case OMP_CLAUSE_ORDERED:
+ case OMP_CLAUSE_DEFAULT:
+ WALK_SUBTREE_TAIL (OMP_CLAUSE_CHAIN (*tp));
+
+ case OMP_CLAUSE_REDUCTION:
+ {
+ int i;
+ for (i = 0; i < 4; i++)
+ WALK_SUBTREE (TREE_OPERAND (*tp, i));
+ WALK_SUBTREE_TAIL (OMP_CLAUSE_CHAIN (*tp));
+ }
- /* Now walk the first one as a tail call. */
- WALK_SUBTREE_TAIL (TREE_VEC_ELT (*tp, 0));
- }
+ case TARGET_EXPR:
+ {
+ int i, len;
+
+ /* TARGET_EXPRs are peculiar: operands 1 and 3 can be the same.
+ But, we only want to walk once. */
+ len = (TREE_OPERAND (*tp, 3) == TREE_OPERAND (*tp, 1)) ? 2 : 3;
+ for (i = 0; i < len; ++i)
+ WALK_SUBTREE (TREE_OPERAND (*tp, i));
+ WALK_SUBTREE_TAIL (TREE_OPERAND (*tp, len));
+ }
- case COMPLEX_CST:
- WALK_SUBTREE (TREE_REALPART (*tp));
- WALK_SUBTREE_TAIL (TREE_IMAGPART (*tp));
+ case DECL_EXPR:
+ /* Walk into various fields of the type that it's defining. We only
+ want to walk into these fields of a type in this case. Note that
+ decls get walked as part of the processing of a BIND_EXPR.
- case CONSTRUCTOR:
- {
- unsigned HOST_WIDE_INT idx;
- constructor_elt *ce;
+ ??? Precisely which fields of types that we are supposed to walk in
+ this case vs. the normal case aren't well defined. */
+ if (TREE_CODE (DECL_EXPR_DECL (*tp)) == TYPE_DECL
+ && TREE_CODE (TREE_TYPE (DECL_EXPR_DECL (*tp))) != ERROR_MARK)
+ {
+ tree *type_p = &TREE_TYPE (DECL_EXPR_DECL (*tp));
- for (idx = 0;
- VEC_iterate(constructor_elt, CONSTRUCTOR_ELTS (*tp), idx, ce);
- idx++)
- WALK_SUBTREE (ce->value);
- }
- break;
+ /* Call the function for the type. See if it returns anything or
+ doesn't want us to continue. If we are to continue, walk both
+ the normal fields and those for the declaration case. */
+ result = (*func) (type_p, &walk_subtrees, data);
+ if (result || !walk_subtrees)
+ return NULL_TREE;
- case SAVE_EXPR:
- WALK_SUBTREE_TAIL (TREE_OPERAND (*tp, 0));
+ result = walk_type_fields (*type_p, func, data, pset);
+ if (result)
+ return result;
- case BIND_EXPR:
- {
- tree decl;
- for (decl = BIND_EXPR_VARS (*tp); decl; decl = TREE_CHAIN (decl))
- {
- /* Walk the DECL_INITIAL and DECL_SIZE. We don't want to walk
- into declarations that are just mentioned, rather than
- declared; they don't really belong to this part of the tree.
- And, we can see cycles: the initializer for a declaration
- can refer to the declaration itself. */
- WALK_SUBTREE (DECL_INITIAL (decl));
- WALK_SUBTREE (DECL_SIZE (decl));
- WALK_SUBTREE (DECL_SIZE_UNIT (decl));
- }
- WALK_SUBTREE_TAIL (BIND_EXPR_BODY (*tp));
- }
+ /* If this is a record type, also walk the fields. */
+ if (TREE_CODE (*type_p) == RECORD_TYPE
+ || TREE_CODE (*type_p) == UNION_TYPE
+ || TREE_CODE (*type_p) == QUAL_UNION_TYPE)
+ {
+ tree field;
- case STATEMENT_LIST:
- {
- tree_stmt_iterator i;
- for (i = tsi_start (*tp); !tsi_end_p (i); tsi_next (&i))
- WALK_SUBTREE (*tsi_stmt_ptr (i));
- }
- break;
+ for (field = TYPE_FIELDS (*type_p); field;
+ field = TREE_CHAIN (field))
+ {
+ /* We'd like to look at the type of the field, but we can
+ easily get infinite recursion. So assume it's pointed
+ to elsewhere in the tree. Also, ignore things that
+ aren't fields. */
+ if (TREE_CODE (field) != FIELD_DECL)
+ continue;
+
+ WALK_SUBTREE (DECL_FIELD_OFFSET (field));
+ WALK_SUBTREE (DECL_SIZE (field));
+ WALK_SUBTREE (DECL_SIZE_UNIT (field));
+ if (TREE_CODE (*type_p) == QUAL_UNION_TYPE)
+ WALK_SUBTREE (DECL_QUALIFIER (field));
+ }
+ }
- default:
- /* ??? This could be a language-defined node. We really should make
- a hook for it, but right now just ignore it. */
- break;
+ WALK_SUBTREE (TYPE_SIZE (*type_p));
+ WALK_SUBTREE_TAIL (TYPE_SIZE_UNIT (*type_p));
}
+ /* FALLTHRU */
+
+ default:
+ if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code)))
+ {
+ int i, len;
+
+ /* Walk over all the sub-trees of this operand. */
+ len = TREE_CODE_LENGTH (code);
+
+ /* Go through the subtrees. We need to do this in forward order so
+ that the scope of a FOR_EXPR is handled properly. */
+ if (len)
+ {
+ for (i = 0; i < len - 1; ++i)
+ WALK_SUBTREE (TREE_OPERAND (*tp, i));
+ WALK_SUBTREE_TAIL (TREE_OPERAND (*tp, len - 1));
+ }
+ }
+
+ /* If this is a type, walk the needed fields in the type. */
+ else if (TYPE_P (*tp))
+ return walk_type_fields (*tp, func, data, pset);
+ break;
}
/* We didn't find what we were looking for. */
return result;
}
+
+/* Return true if STMT is an empty statement or contains nothing but
+ empty statements. */
+
+bool
+empty_body_p (tree stmt)
+{
+ tree_stmt_iterator i;
+ tree body;
+
+ if (IS_EMPTY_STMT (stmt))
+ return true;
+ else if (TREE_CODE (stmt) == BIND_EXPR)
+ body = BIND_EXPR_BODY (stmt);
+ else if (TREE_CODE (stmt) == STATEMENT_LIST)
+ body = stmt;
+ else
+ return false;
+
+ for (i = tsi_start (body); !tsi_end_p (i); tsi_next (&i))
+ if (!empty_body_p (tsi_stmt (i)))
+ return false;
+
+ return true;
+}
+
#include "gt-tree.h"
DEFTREECODE (TARGET_MEM_REF, "target_mem_ref", tcc_reference, 7)
+/* The ordering of the codes between OMP_PARALLEL and OMP_CRITICAL is
+ exposed to TREE_RANGE_CHECK. */
+/* OpenMP - #pragma omp parallel [clause1 ... clauseN]
+ Operand 0: OMP_PARALLEL_BODY: Code to be executed by all threads.
+ Operand 1: OMP_PARALLEL_CLAUSES: List of clauses. */
+DEFTREECODE (OMP_PARALLEL, "omp_parallel", tcc_statement, 2)
+
+/* OpenMP - #pragma omp for [clause1 ... clauseN]
+ Operand 0: OMP_FOR_BODY: Loop body.
+ Operand 1: OMP_FOR_CLAUSES: List of clauses.
+ Operand 2: OMP_FOR_INIT: Initialization code of the form
+ VAR = N1.
+ Operand 3: OMP_FOR_COND: Loop conditional expression of the form
+ VAR { <, >, <=, >= } N2.
+ Operand 4: OMP_FOR_INCR: Loop index increment of the form
+ VAR { +=, -= } INCR.
+ Operand 5: OMP_FOR_PRE_BODY: Filled by the gimplifier with things
+ from INIT, COND, and INCR that are technically part of the
+ OMP_FOR structured block, but are evaluated before the loop
+ body begins.
+
+ VAR must be a signed integer variable, which is implicitly thread
+ private. N1, N2 and INCR are required to be loop invariant integer
+ expressions that are evaluated without any synchronization.
+ The evaluation order, frequency of evaluation and side-effects are
+ unspecified by the standard. */
+DEFTREECODE (OMP_FOR, "omp_for", tcc_statement, 6)
+
+/* OpenMP - #pragma omp sections [clause1 ... clauseN]
+ Operand 0: OMP_SECTIONS_BODY: Sections body.
+ Operand 1: OMP_SECTIONS_CLAUSES: List of clauses. */
+DEFTREECODE (OMP_SECTIONS, "omp_sections", tcc_statement, 2)
+
+/* OpenMP - #pragma omp single
+ Operand 0: OMP_SINGLE_BODY: Single section body.
+ Operand 1: OMP_SINGLE_CLAUSES: List of clauses. */
+DEFTREECODE (OMP_SINGLE, "omp_single", tcc_statement, 2)
+
+/* OpenMP - #pragma omp section
+ Operand 0: OMP_SECTION_BODY: Section body. */
+DEFTREECODE (OMP_SECTION, "omp_section", tcc_statement, 1)
+
+/* OpenMP - #pragma omp master
+ Operand 0: OMP_MASTER_BODY: Master section body. */
+DEFTREECODE (OMP_MASTER, "omp_master", tcc_statement, 1)
+
+/* OpenMP - #pragma omp ordered
+ Operand 0: OMP_ORDERED_BODY: Master section body. */
+DEFTREECODE (OMP_ORDERED, "omp_ordered", tcc_statement, 1)
+
+/* OpenMP - #pragma omp critical [name]
+ Operand 0: OMP_CRITICAL_BODY: Critical section body.
+ Operand 1: OMP_CRITICAL_NAME: Identifier for critical section. */
+DEFTREECODE (OMP_CRITICAL, "omp_critical", tcc_statement, 2)
+
+/* OpenMP - #pragma omp atomic
+ Operand 0: The address at which the atomic operation is to be performed.
+ This address should be stabilized with save_expr.
+ Operand 1: The expression to evaluate. When the old value of the object
+ at the address is used in the expression, it should appear as if
+ build_fold_indirect_ref of the address. */
+DEFTREECODE (OMP_ATOMIC, "omp_atomic", tcc_statement, 2)
+
+/* The ordering of the codes between OMP_CLAUSE_PRIVATE and
+ OMP_CLAUSE_DEFAULT is exposed to TREE_RANGE_CHECK. */
+/* OpenMP clause: private (variable_list). */
+DEFTREECODE (OMP_CLAUSE_PRIVATE, "private", tcc_expression, 1)
+
+/* OpenMP clause: shared (variable_list). */
+DEFTREECODE (OMP_CLAUSE_SHARED, "shared", tcc_expression, 1)
+
+/* OpenMP clause: firstprivate (variable_list). */
+DEFTREECODE (OMP_CLAUSE_FIRSTPRIVATE, "firstprivate", tcc_expression, 1)
+
+/* OpenMP clause: lastprivate (variable_list). */
+DEFTREECODE (OMP_CLAUSE_LASTPRIVATE, "lastprivate", tcc_expression, 1)
+
+/* OpenMP clause: reduction (operator:variable_list).
+ OMP_CLAUSE_REDUCTION_CODE: The tree_code of the operator.
+ Operand 1: OMP_CLAUSE_REDUCTION_INIT: Stmt-list to initialize the var.
+ Operand 2: OMP_CLAUSE_REDUCTION_MERGE:
+ Stmt-list to merge private var into the shared one.
+ Operand 3: OMP_CLAUSE_REDUCTION_PLACEHOLDER:
+ A dummy VAR_DECL placeholder used in OMP_CLAUSE_REDUCTION_MERGE. */
+DEFTREECODE (OMP_CLAUSE_REDUCTION, "reduction", tcc_expression, 4)
+
+/* OpenMP clause: copyin (variable_list). */
+DEFTREECODE (OMP_CLAUSE_COPYIN, "copyin", tcc_expression, 1)
+
+/* OpenMP clause: copyprivate (variable_list). */
+DEFTREECODE (OMP_CLAUSE_COPYPRIVATE, "copyprivate", tcc_expression, 1)
+
+/* OpenMP clause: if (scalar-expression). */
+DEFTREECODE (OMP_CLAUSE_IF, "if", tcc_expression, 1)
+
+/* OpenMP clause: num_threads (integer-expression). */
+DEFTREECODE (OMP_CLAUSE_NUM_THREADS, "num_threads", tcc_expression, 1)
+
+/* OpenMP clause: schedule. */
+DEFTREECODE (OMP_CLAUSE_SCHEDULE, "schedule", tcc_expression, 1)
+
+/* OpenMP clause: nowait. */
+DEFTREECODE (OMP_CLAUSE_NOWAIT, "nowait", tcc_expression, 0)
+
+/* OpenMP clause: ordered. */
+DEFTREECODE (OMP_CLAUSE_ORDERED, "ordered", tcc_expression, 0)
+
+/* OpenMP clause: default. */
+DEFTREECODE (OMP_CLAUSE_DEFAULT, "default", tcc_expression, 0)
+
/* Reduction operations.
Operations that take a vector of elements and "reduce" it to a scalar
result (e.g. summing the elements of the vector, finding the minimum over
..._TYPE
SAVE_EXPR_RESOLVED_P in
SAVE_EXPR
+ OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE in
+ OMP_CLAUSE_LASTPRIVATE
+ OMP_CLAUSE_PRIVATE_DEBUG in
+ OMP_CLAUSE_PRIVATE
private_flag:
__FUNCTION__); \
__t; })
+#define TREE_RANGE_CHECK(T, CODE1, CODE2) __extension__ \
+({ const tree __t = (T); \
+ if (TREE_CODE (__t) < (CODE1) && TREE_CODE (__t) > (CODE2)) \
+ tree_range_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, \
+ (CODE1), (CODE2)); \
+ __t; })
+
/* These checks have to be special cased. */
#define EXPR_CHECK(T) __extension__ \
({ const tree __t = (T); \
extern void tree_class_check_failed (const tree, const enum tree_code_class,
const char *, int, const char *)
ATTRIBUTE_NORETURN;
+extern void tree_range_check_failed (const tree, const char *, int,
+ const char *, enum tree_code,
+ enum tree_code);
extern void tree_not_class_check_failed (const tree,
const enum tree_code_class,
const char *, int, const char *)
#define TREE_CHECK5(T, CODE1, CODE2, CODE3, CODE4, CODE5) (T)
#define TREE_NOT_CHECK5(T, CODE1, CODE2, CODE3, CODE4, CODE5) (T)
#define TREE_CLASS_CHECK(T, CODE) (T)
+#define TREE_RANGE_CHECK(T, CODE1, CODE2) (T)
#define EXPR_CHECK(T) (T)
#define NON_TYPE_CHECK(T) (T)
#define TREE_VEC_ELT_CHECK(T, I) ((T)->vec.a[I])
#define ASSERT_EXPR_VAR(NODE) TREE_OPERAND (ASSERT_EXPR_CHECK (NODE), 0)
#define ASSERT_EXPR_COND(NODE) TREE_OPERAND (ASSERT_EXPR_CHECK (NODE), 1)
+/* OpenMP directive and clause accessors. */
+
+#define OMP_BODY(NODE) \
+ TREE_OPERAND (TREE_RANGE_CHECK (NODE, OMP_PARALLEL, OMP_CRITICAL), 0)
+#define OMP_CLAUSES(NODE) \
+ TREE_OPERAND (TREE_RANGE_CHECK (NODE, OMP_PARALLEL, OMP_SINGLE), 1)
+
+#define OMP_PARALLEL_BODY(NODE) TREE_OPERAND (OMP_PARALLEL_CHECK (NODE), 0)
+#define OMP_PARALLEL_CLAUSES(NODE) TREE_OPERAND (OMP_PARALLEL_CHECK (NODE), 1)
+
+#define OMP_FOR_BODY(NODE) TREE_OPERAND (OMP_FOR_CHECK (NODE), 0)
+#define OMP_FOR_CLAUSES(NODE) TREE_OPERAND (OMP_FOR_CHECK (NODE), 1)
+#define OMP_FOR_INIT(NODE) TREE_OPERAND (OMP_FOR_CHECK (NODE), 2)
+#define OMP_FOR_COND(NODE) TREE_OPERAND (OMP_FOR_CHECK (NODE), 3)
+#define OMP_FOR_INCR(NODE) TREE_OPERAND (OMP_FOR_CHECK (NODE), 4)
+#define OMP_FOR_PRE_BODY(NODE) TREE_OPERAND (OMP_FOR_CHECK (NODE), 5)
+
+#define OMP_SECTIONS_BODY(NODE) TREE_OPERAND (OMP_SECTIONS_CHECK (NODE), 0)
+#define OMP_SECTIONS_CLAUSES(NODE) TREE_OPERAND (OMP_SECTIONS_CHECK (NODE), 1)
+
+#define OMP_SECTION_BODY(NODE) TREE_OPERAND (OMP_SECTION_CHECK (NODE), 0)
+
+#define OMP_SINGLE_BODY(NODE) TREE_OPERAND (OMP_SINGLE_CHECK (NODE), 0)
+#define OMP_SINGLE_CLAUSES(NODE) TREE_OPERAND (OMP_SINGLE_CHECK (NODE), 1)
+
+#define OMP_MASTER_BODY(NODE) TREE_OPERAND (OMP_MASTER_CHECK (NODE), 0)
+
+#define OMP_ORDERED_BODY(NODE) TREE_OPERAND (OMP_ORDERED_CHECK (NODE), 0)
+
+#define OMP_CRITICAL_BODY(NODE) TREE_OPERAND (OMP_CRITICAL_CHECK (NODE), 0)
+#define OMP_CRITICAL_NAME(NODE) TREE_OPERAND (OMP_CRITICAL_CHECK (NODE), 1)
+
+#define OMP_CLAUSE_CHAIN(NODE) \
+ TREE_CHAIN (TREE_RANGE_CHECK (NODE, OMP_CLAUSE_PRIVATE, OMP_CLAUSE_DEFAULT))
+#define OMP_CLAUSE_DECL(NODE) \
+ TREE_OPERAND (TREE_RANGE_CHECK (NODE, OMP_CLAUSE_PRIVATE, \
+ OMP_CLAUSE_COPYPRIVATE), 0)
+
+/* True on a PRIVATE clause if its decl is kept around for debugging
+ information only and its DECL_VALUE_EXPR is supposed to point
+ to what it has been remapped to. */
+#define OMP_CLAUSE_PRIVATE_DEBUG(NODE) \
+ TREE_PUBLIC (OMP_CLAUSE_PRIVATE_CHECK (NODE))
+
+/* True on a LASTPRIVATE clause if a FIRSTPRIVATE clause for the same
+ decl is present in the chain. */
+#define OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE(NODE) \
+ TREE_PUBLIC (OMP_CLAUSE_LASTPRIVATE_CHECK (NODE))
+
+#define OMP_CLAUSE_IF_EXPR(NODE) \
+ TREE_OPERAND (OMP_CLAUSE_IF_CHECK (NODE), 0)
+#define OMP_CLAUSE_NUM_THREADS_EXPR(NODE) \
+ TREE_OPERAND (OMP_CLAUSE_NUM_THREADS_CHECK (NODE), 0)
+#define OMP_CLAUSE_SCHEDULE_CHUNK_EXPR(NODE) \
+ TREE_OPERAND (OMP_CLAUSE_SCHEDULE_CHECK (NODE), 0)
+
+#define OMP_CLAUSE_REDUCTION_CODE(NODE) \
+ (OMP_CLAUSE_REDUCTION_CHECK (NODE)->exp.complexity)
+#define OMP_CLAUSE_REDUCTION_INIT(NODE) \
+ TREE_OPERAND (OMP_CLAUSE_REDUCTION_CHECK (NODE), 1)
+#define OMP_CLAUSE_REDUCTION_MERGE(NODE) \
+ TREE_OPERAND (OMP_CLAUSE_REDUCTION_CHECK (NODE), 2)
+#define OMP_CLAUSE_REDUCTION_PLACEHOLDER(NODE) \
+ TREE_OPERAND (OMP_CLAUSE_REDUCTION_CHECK (NODE), 3)
+
+enum omp_clause_schedule_kind
+{
+ OMP_CLAUSE_SCHEDULE_STATIC,
+ OMP_CLAUSE_SCHEDULE_DYNAMIC,
+ OMP_CLAUSE_SCHEDULE_GUIDED,
+ OMP_CLAUSE_SCHEDULE_RUNTIME
+};
+
+#define OMP_CLAUSE_SCHEDULE_KIND(NODE) \
+ (OMP_CLAUSE_SCHEDULE_CHECK (NODE)->exp.complexity)
+
+enum omp_clause_default_kind
+{
+ OMP_CLAUSE_DEFAULT_UNSPECIFIED,
+ OMP_CLAUSE_DEFAULT_SHARED,
+ OMP_CLAUSE_DEFAULT_NONE,
+ OMP_CLAUSE_DEFAULT_PRIVATE
+};
+
+#define OMP_CLAUSE_DEFAULT_KIND(NODE) \
+ (OMP_CLAUSE_DEFAULT_CHECK (NODE)->exp.complexity)
+
struct tree_exp GTY(())
{
struct tree_common common;
extern tree build4_stat (enum tree_code, tree, tree, tree, tree,
tree MEM_STAT_DECL);
#define build4(c,t1,t2,t3,t4,t5) build4_stat (c,t1,t2,t3,t4,t5 MEM_STAT_INFO)
+extern tree build5_stat (enum tree_code, tree, tree, tree, tree, tree,
+ tree MEM_STAT_DECL);
+#define build5(c,t1,t2,t3,t4,t5,t6) build5_stat (c,t1,t2,t3,t4,t5,t6 MEM_STAT_INFO)
extern tree build7_stat (enum tree_code, tree, tree, tree, tree, tree,
tree, tree, tree MEM_STAT_DECL);
#define build7(c,t1,t2,t3,t4,t5,t6,t7,t8) \
extern tree upper_bound_in_type (tree, tree);
extern tree lower_bound_in_type (tree, tree);
extern int operand_equal_for_phi_arg_p (tree, tree);
+extern bool empty_body_p (tree);
\f
/* In stmt.c */
extern tree c_strlen (tree, int);
extern tree std_gimplify_va_arg_expr (tree, tree, tree *, tree *);
extern tree build_va_arg_indirect_ref (tree);
+tree build_string_literal (int, const char *);
/* In convert.c */
extern tree strip_float_extensions (tree);
--- /dev/null
+2006-01-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/25219
+ * testsuite/libgomp.fortran/pr25219.f90: New test.
+
+2005-12-05 Uros Bizjak <uros@kss-loka.si>
+
+ * testsuite/libgomp.c/pr24455.c, testsuite/libgomp.c/copyin-1.c,
+ testsuite/libgomp.c/copyin-2.c, testsuite/libgomp.c/copyin-3.c,
+ testsuite/libgomp.c++/copyin-1.C, testsuite/libgomp.c++/copyin-2.C,
+ testsuite/libgomp.c++/ctor-5.C, testsuite/libgomp.c++/ctor-8.C,
+ testsuite/libgomp.c++/ctor-9.C, testsuite/libgomp.c++/pr24455.C,
+ testsuite/libgomp.fortran/threadprivate1.f90,
+ testsuite/libgomp.fortran/threadprivate2.f90,
+ testsuite/libgomp.fortran/threadprivate3.f90,
+ testsuite/libgomp.fortran/appendix-a/a.22.7.f9,
+ testsuite/libgomp.fortran/appendix-a/a.22.8.f9,
+ testsuite/libgomp.fortran/omp_parse3.f90: Change required
+ effective-target to TLS runtime.
+
+ * testsuite/libgomp.fortran/pr25162.f: Require
+ effective-target TLS runtime.
+
+2005-12-01 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.fortran/nestedfn2.f90: New test.
+ * testsuite/libgomp.c/nestedfn-3.c: New test.
+
+2005-11-30 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/25162
+ * testsuite/libgomp.fortran/pr25162.f: New test.
+
+2005-11-28 Jakub Jelinek <jakub@redhat.com>
+
+ * config/posix/time.c (omp_get_wtime, omp_get_wtick): Fall back to
+ CLOCK_REALTIME if clock_* (CLOCK_MONOTONIC, &ts) call failed.
+
+2005-11-25 Jakub Jelinek <jakub@redhat.com>
+
+ * alloc.c, barrier.c, critical.c, env.c, error.c, fortran.c, iter.c,
+ libgomp.h, libgomp_f.h.in, libgomp_g.h, loop.c, mkomp_h.pl, omp.h.in,
+ omp_lib.f90.in, omp_lib.h.in, ordered.c, parallel.c, sections.c,
+ single.c, team.c, work.c, config/linux/alpha/futex.h,
+ config/linux/bar.c, config/linux/bar.h, config/linux/ia64/futex.h,
+ config/linux/lock.c, config/linux/mutex.c, config/linux/mutex.h,
+ config/linux/powerpc/futex.h, config/linux/s390/futex.h,
+ config/linux/sem.c, config/linux/sem.h, config/linux/sparc/futex.h,
+ config/linux/x86/futex.h, config/posix/bar.c, config/posix/bar.h,
+ config/posix/lock.c, config/posix/mutex.h, config/posix/proc.c,
+ config/posix/sem.c, config/posix/sem.h, config/posix/time.c: Update
+ FSF address.
+
+2005-11-18 Jakub Jelinek <jakub@redhat.com>
+
+ * Makefile.am: Move libgomp_f.h from nodist_include_HEADERS
+ to nodist_noinst_HEADERS.
+ * Makefile.in: Rebuilt.
+
+ * config/posix/omp-lock.h (omp_nest_lock_t): Change into struct,
+ add integer count field.
+ * config/posix/lock.c (omp_destroy_nest_lock): Adjust for
+ omp_nest_lock_t type change.
+ (omp_init_nest_lock): Likewise. Initialize count to 0.
+ (omp_set_nest_lock): Adjust for omp_nest_lock_t type change.
+ Increment count.
+ (omp_unset_nest_lock): Adjust for omp_nest_lock_t type change.
+ Decrement count.
+ (omp_test_nest_lock): Adjust for omp_nest_lock_t type change.
+ Increment count if successful and return the new nesting level.
+ * config/linux/lock.c (omp_test_nest_lock): Return new nesting level.
+ * omp_lib.f90.in (omp_test_lock): Fix LOCK argument type.
+ * testsuite/libgomp.c/lib-1.c: New test.
+ * testsuite/libgomp.fortran/lib1.f90: New test.
+ * testsuite/libgomp.fortran/lib2.f: New test.
+ * testsuite/libgomp.fortran/lib3.f: New test.
+
+2005-11-17 Richard Henderson <rth@redhat.com>
+
+ PR 24845
+ * Makefile.am (nodist_toolexeclib_HEADERS): New.
+ * configure.ac (link_gomp): New. Substitute it.
+ (AC_CONFIG_FILES): Add libgomp.spec.
+ * libgomp.spec.in: New file.
+ * Makefile.in, testsuite/Makefile.in, configure: Rebuild.
+ * testsuite/lib/libgomp-dg.exp: Add -B${blddir}/ to flags.
+
+2005-11-18 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.fortran/reduction1.f90: Adjust for
+ reduction(-:var) behaving the same as reduction(+:var).
+ * testsuite/libgomp.c/reduction-4.c: New test.
+
+2005-11-15 Uros Bizjak <uros@kss-loka.si>
+
+ * testsuite/libgomp.c/pr24455-1.c, testsuite/libgomp.c/pr24455.c,
+ testsuite/libgomp.c/copyin-1.c, testsuite/libgomp.c/copyin-2.c,
+ testsuite/libgomp.c/copyin-3.c,
+ testsuite/libgomp.c++/copyin-1.C, testsuite/libgomp.c++/copyin-2.C,
+ testsuite/libgomp.c++/ctor-5.C, testsuite/libgomp.c++/ctor-8.C,
+ testsuite/libgomp.c++/ctor-9.C, testsuite/libgomp.c++/pr24455-1.C,
+ testsuite/libgomp.c++/pr24455.C,
+ testsuite/libgomp.fortran/threadprivate1.f90,
+ testsuite/libgomp.fortran/threadprivate2.f90,
+ testsuite/libgomp.fortran/threadprivate3.f90,
+ testsuite/libgomp.fortran/appendix-a/a.22.7.f9,
+ testsuite/libgomp.fortran/appendix-a/a.22.8.f9,
+ testsuite/libgomp.fortran/omp_parse3.f90: Require
+ effective-target TLS.
+
+2005-11-14 Diego Novillo <dnovillo@redhat.com>
+
+ * HEADER: Remove.
+
+2005-11-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR libgomp/24797
+ * team.c (initialize_team): Pass NULL rather than free as
+ pthread_key_create destructor. Initialize thread specific data
+ pointer in initial thread to a static local variable rather than
+ malloced memory.
+
+2005-11-11 Uros Bizjak <uros@kss-loka.si>
+
+ * testsuite/lib/libgomp-dg.exp: Locate libgcc.a and append
+ its location to ld_library_path.
+
+2005-11-10 Diego Novillo <dnovillo@redhat.com>
+
+ * testsuite/libgomp.c/c.exp: Rename from dg.exp.
+
+2005-11-10 Diego Novillo <dnovillo@redhat.com>
+
+ * testsuite/libgomp.c: Rename from libgomp.dg.
+
+2005-11-09 Diego Novillo <dnovillo@redhat.com>
+
+ * testsuite/libgomp.c++/pr24455.C: Add copyin clause for
+ threadprivate variable 'i'.
+
+2005-11-09 Jakub Jelinek <jakub@redhat.com>
+
+ * config/linux/s390/futex.h: New file.
+ * configure.tgt: Use it.
+
+ * testsuite/libgomp.fortran/omp_parse4.f90: Move n initialization
+ before the parallel.
+
+2005-11-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/24734
+ * testsuite/libgomp.c++/master-1.C: New test.
+
+2005-11-07 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.dg/copyin-3.c: New test.
+
+2005-11-07 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.fortran/retval1.f90: New test.
+ * testsuite/libgomp.fortran/vla7.f90: New test.
+
+2005-11-06 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.fortran/vla2.f90: New test.
+ * testsuite/libgomp.fortran/vla3.f90: New test.
+ * testsuite/libgomp.fortran/vla4.f90: New test.
+ * testsuite/libgomp.fortran/vla5.f90: New test.
+ * testsuite/libgomp.fortran/vla6.f90: New test.
+
+2005-11-01 Jakub Jelinek <jakub@redhat.com>
+
+ * config/linux/sparc/futex.h: New file.
+ * configure.tgt: Use it.
+ * testsuite/lib/libgomp-dg.exp: Use -mcpu=v9 for sparc testing.
+
+ * critical.c: Include stdlib.h.
+ * acinclude.m4 (LIBGOMP_CHECK_SYNC_BUILTINS): Avoid warnings about
+ ignoring return value.
+ * configure.ac: Don't put -Wc,-pthread into XCFLAGS until after
+ LIBGOMP_CHECK_SYNC_BUILTINS check.
+ * configure: Rebuilt.
+
+2005-10-31 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.fortran/vla1.f90: New test.
+
+2005-10-31 Richard Henderson <rth@redhat.com>
+
+ * testsuite/libgomp.fortran/character2.f90: Fix race condition
+ setting 's' in different threads.
+
+2005-10-31 Jakub Jelinek <jakub@redhat.com>
+
+ * libgomp.h (attribute_hidden, ialias): Define.
+ * config/posix/proc.c (omp_get_num_procs): Add ialias.
+ * config/posix/time.c (omp_get_wtime, omp_get_wtick): Likewise.
+ * config/posix/lock.c (omp_init_lock, omp_init_nest_lock,
+ omp_destroy_lock, omp_destroy_nest_lock, omp_set_lock,
+ omp_set_nest_lock, omp_unset_lock, omp_unset_nest_lock,
+ omp_test_lock, omp_test_nest_lock): Likewise.
+ * config/linux/lock.c (omp_init_lock, omp_init_nest_lock,
+ omp_destroy_lock, omp_destroy_nest_lock, omp_set_lock,
+ omp_set_nest_lock, omp_unset_lock, omp_unset_nest_lock,
+ omp_test_lock, omp_test_nest_lock): Likewise.
+ * env.c (omp_set_dynamic, omp_set_nested, omp_set_num_threads,
+ omp_get_dynamic, omp_get_nested): Likewise.
+ * parallel.c (omp_get_num_threads, omp_get_max_threads,
+ omp_get_thread_num, omp_in_parallel): Likewise.
+ * fortran.c (ialias_redirect): Define.
+ (omp_init_lock, omp_init_nest_lock, omp_destroy_lock,
+ omp_destroy_nest_lock, omp_set_lock, omp_set_nest_lock,
+ omp_unset_lock, omp_unset_nest_lock, omp_test_lock,
+ omp_test_nest_lock, omp_set_dynamic, omp_set_nested,
+ omp_set_num_threads, omp_get_dynamic, omp_get_nested,
+ omp_in_parallel, omp_get_max_threads, omp_get_num_procs,
+ omp_get_num_threads, omp_get_thread_num, omp_get_wtick,
+ omp_get_wtime): Add ialias_redirect.
+
+2005-10-30 Jakub Jelinek <jakub@redhat.com>
+
+ * fortran.c: Include stdlib.h.
+
+2005-10-29 Jakub Jelinek <jakub@redhat.com>
+
+ * Makefile.am (env.o, env.lo): Depend on libgomp_f.h.
+ * Makefile.in: Regenerated.
+
+2005-10-28 Jakub Jelinek <jakub@redhat.com>
+
+ * mkomp_h.pl: Remove all -Wc, option prefixes in $COMPILE.
+ * libgomp_f.h.in (omp_check_defines): New function.
+ * env.c: Include libgomp_f.h.
+ (initialize_env): Call omp_check_defines.
+
+ * testsuite/libgomp.dg/copyin-2.c: New test.
+ * testsuite/libgomp.c++/copyin-2.C: New test.
+ * testsuite/libgomp.fortran/threadprivate3.f90: New test.
+
+ * testsuite/libgomp.fortran/threadprivate2.f90: New test.
+ * testsuite/libgomp.fortran/sharing2.f90: New test.
+
+ * testsuite/libgomp.dg/copyin-1.c: New test.
+ * testsuite/libgomp.c++/copyin-1.C: New test.
+
+2005-10-26 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.fortran/crayptr1.f90: New test.
+
+ * testsuite/libgomp.fortran/workshare1.f90: New test.
+
+ * libgomp.fortran/appendix-a/a.28.5.f90: Change into compile
+ only test.
+ * libgomp.fortran/sharing1.f90: New test.
+
+2005-10-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/24502
+ * testsuite/libgomp.c++/loop-7.C: New test.
+
+ * testsuite/libgomp.dg/nestedfn-2.c: New test.
+
+ * testsuite/libgomp.dg/nestedfn-1.c: New test.
+ * testsuite/libgomp.fortran/reduction6.f90: New test.
+ * testsuite/libgomp.fortran/nestedfn1.f90: New test.
+
+2005-10-23 Richard Henderson <rth@redhat.com>
+
+ * testsuite/libgomp.c++/ctor-1.C: New.
+ * testsuite/libgomp.c++/ctor-2.C: New.
+ * testsuite/libgomp.c++/ctor-3.C: New.
+ * testsuite/libgomp.c++/ctor-4.C: New.
+ * testsuite/libgomp.c++/ctor-5.C: New.
+ * testsuite/libgomp.c++/ctor-6.C: New.
+ * testsuite/libgomp.c++/ctor-7.C: New.
+ * testsuite/libgomp.c++/ctor-8.C: New.
+ * testsuite/libgomp.c++/ctor-9.C: New.
+
+2005-10-21 Diego Novillo <dnovillo@redhat.com>
+
+ PR 24455
+ * testsuite/libgomp.c++/pr24455-1.C: New test.
+ * testsuite/libgomp.c++/pr24455.C: New test.
+ * testsuite/libgomp.dg/pr24455-1.c: New test.
+ * testsuite/libgomp.dg/pr24455.c: New test.
+
+2005-10-20 Richard Henderson <rth@redhat.com>
+
+ * testsuite/libgomp.c++/loop-6.C: New.
+ * testsuite/libgomp.dg/loop-3.c: New.
+
+2005-10-20 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.fortran/jacobi.f: Don't make i and j
+ explicitly private.
+ * testsuite/libgomp.fortran/omp_parse1.f90 (test_do): Make i
+ explicitly shared.
+
+2005-10-19 Diego Novillo <dnovillo@redhat.com>
+
+ * testsuite/libgomp.fortran/jacobi.f: New test.
+
+2005-10-19 Richard Henderson <rth@redhat.com>
+
+ * configure.tgt (i?86-linux): Default to with_arch instead of
+ CFLAGS. Add -mtune to match target_cpu.
+ (x86_64-linux): Tune to i686.
+
+ * fortran.c (omp_test_nest_lock_): Fix typo.
+
+2005-10-19 Jakub Jelinek <jakub@redhat.com>
+
+ * ordered.c (gomp_ordered_first, gomp_ordered_last, gomp_ordered_next,
+ gomp_ordered_sync): Do nothing if team->nthreads == 1.
+ * testsuite/libgomp.dg/ordered-3.c: New test.
+
+ * testsuite/libgomp.dg/appendix-a/a.18.1.c: Remove unconditional abort.
+ Remove volatile keyword.
+
+ * testsuite/libgomp.fortran/appendix-a/a.19.1.f90: Reorder variables
+ in COMMON block to avoid warnings on 64-bit targets.
+
+2005-10-18 Diego Novillo <dnovillo@redhat.com>
+
+ * testsuite/libgomp.dg/shared-3.c: New test.
+
+2005-10-18 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.fortran/appendix-a/a.31.3.f90: Removed.
+ * testsuite/libgomp.fortran/reduction5.f90: New test.
+
+2005-10-18 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.fortran/appendix-a/a.40.1.f90: Add -ffixed-form to
+ dg-options.
+ * testsuite/libgomp.fortran/appendix-a/a.18.1.f90: Likewise. Enable
+ flush loop now that __sync_synchronize has proper memory barrier.
+ * testsuite/libgomp.fortran/appendix-a/a.3.1.f90: Fix a typo.
+ Add -ffixed-form to dg-options.
+
+2005-10-17 Diego Novillo <dnovillo@redhat.com>
+
+ * testsuite/libgomp.fortran/fortran.exp: Also gather tests
+ from subdirectories.
+ * testsuite/libgomp.fortran/appendix-a/a.15.1.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.16.1.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.18.1.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.19.1.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.2.1.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.21.1.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.22.7.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.22.8.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.26.1.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.28.1.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.28.2.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.28.3.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.28.4.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.28.5.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.3.1.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.31.3.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.31.4.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.31.5.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.33.3.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.38.1.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.39.1.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.4.1.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.40.1.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a.5.1.f90: New test.
+ * testsuite/libgomp.fortran/appendix-a/a10.1.f90: New test.
+
+2005-10-17 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.dg/dg.exp: Only unset lang_* if
+ lang_library_path exists. Use find instead of glob to gather tests.
+ * testsuite/libgomp.dg/appendix-a/appendix-a.exp: Removed.
+
+2005-10-17 Diego Novillo <dnovillo@redhat.com>
+
+ * testsuite/libgomp.dg/appendix-a/a.15.1.c: New test.
+ * testsuite/libgomp.dg/appendix-a/a.16.1.c: New test.
+ * testsuite/libgomp.dg/appendix-a/a.18.1.c: New test.
+ * testsuite/libgomp.dg/appendix-a/a.19.1.c: New test.
+ * testsuite/libgomp.dg/appendix-a/a.2.1.c: New test.
+ * testsuite/libgomp.dg/appendix-a/a.21.1.c: New test.
+ * testsuite/libgomp.dg/appendix-a/a.26.1.c: New test.
+ * testsuite/libgomp.dg/appendix-a/a.29.1.c: New test.
+ * testsuite/libgomp.dg/appendix-a/a.3.1.c: New test.
+ * testsuite/libgomp.dg/appendix-a/a.39.1.c: New test.
+ * testsuite/libgomp.dg/appendix-a/a.4.1.c: New test.
+ * testsuite/libgomp.dg/appendix-a/a.5.1.c: New test.
+ * testsuite/libgomp.dg/appendix-a/appendix-a.exp: New file.
+
+2005-10-15 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.dg/vla-1.c: New test.
+
+ * testsuite/libgomp.fortran/reference2.f90: New test.
+
+ * testsuite/libgomp.fortran/character2.f90: Remove explicit
+ declaration of omp_get_thread_num.
+ * testsuite/libgomp.fortran/threadprivate1.f90: Likewise. Add
+ use omp_lib.
+
+ * testsuite/libgomp.fortran/reduction1.f90: New test.
+ * testsuite/libgomp.fortran/reduction2.f90: New test.
+ * testsuite/libgomp.fortran/reduction3.f90: New test.
+ * testsuite/libgomp.fortran/reduction4.f90: New test.
+
+2005-10-13 Richard Henderson <rth@redhat.com>
+
+ * Makefile.am (libgomp_la_SOURCES): Add bar.c.
+ * Makefile.in: Regenerate.
+ * barrier.c (GOMP_barrier): Use gomp_barrier_wait.
+ * libgomp.h: Include bar.h.
+ (struct gomp_barrier): Remove.
+ (struct gomp_team): Add barrier. Replace master_barrier with
+ master_release. Replace threads with ordered_release.
+ (struct gomp_thread): Replace barrier with release.
+ * ordered.c (gomp_ordered_first): Update for ordered_release change.
+ (gomp_ordered_last, gomp_ordered_next, gomp_ordered_static_init,
+ gomp_ordered_static_next, gomp_ordered_sync): Likewise.
+ * single.c (GOMP_single_copy_start): Use gomp_barrier_wait.
+ (GOMP_single_copy_end): Likewise.
+ * team.c (gomp_threads_dock): New.
+ (gomp_barrier_init, gomp_barrier_destroy): Remove.
+ (gomp_thread_start): Use gomp_barrier_wait.
+ (new_team, free_team): Update for gomp_team changes.
+ (gomp_team_start): Use gomp_barrier_wait and gomp_barrier_reinit.
+ (gomp_team_end): Use gomp_barrier_wait.
+ (initialize_team): Update for gomp_thread changes.
+ * work.c (gomp_work_share_end): Use gomp_barrier_wait_start.
+ (gomp_work_share_end_nowait): Use atomic ops when available.
+ * config/linux/bar.c, config/linux/bar.h: New files.
+ * config/posix/bar.c, config/posix/bar.h: New files.
+
+2005-10-13 Jakub Jelinek <jakub@redhat.com>
+
+ * single.c (GOMP_single_copy_end): Don't segfault if team is NULL.
+ * testsuite/libgomp.dg/single-2.c: New test.
+
+ * testsuite/libgomp.dg/dg.exp (lang_library_path, lang_test_file,
+ lang_link_flags): Unset, so that they aren't inherited from previously
+ sourced *.exp.
+
+ * testsuite/libgomp.fortran/threadprivate1.f90: New test.
+
+2005-10-12 Richard Henderson <rth@redhat.com>
+
+ * testsuite/lib/libgomp-dg.exp: Set blddir at toplevel.
+ (libgomp_init): Use lang_test_file, lang_library_path, and
+ lang_link_flags, set by the subdirectory files. Add -fopenmp here.
+
+ * testsuite/libgomp.fortran/fortran.exp (lang_library_path): New.
+ (lang_test_file, lang_link_flags): New.
+ (DEFAULT_FFLAGS, ALWAYS_CFLAGS, multilibs, blddir): Remove.
+
+ * testsuite/libgomp.c++/c++.exp, testsuite/libgomp.c++/loop-1.C,
+ testsuite/libgomp.c++/loop-2.C, testsuite/libgomp.c++/loop-3.C,
+ testsuite/libgomp.c++/loop-4.C, testsuite/libgomp.c++/nested-1.C,
+ testsuite/libgomp.c++/parallel-1.C,
+ testsuite/libgomp.c++/reduction-1.C,
+ testsuite/libgomp.c++/reduction-2.C,
+ testsuite/libgomp.c++/reduction-3.C,
+ testsuite/libgomp.c++/sections-1.C, testsuite/libgomp.c++/shared-1.C,
+ testsuite/libgomp.c++/shared-2.C, testsuite/libgomp.c++/single-1.C,
+ testsuite/libgomp.c++/single-2.C, testsuite/libgomp.c++/single-3.C:
+ New files, largely cribbed from the C testsuite.
+
+2005-10-12 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.fortran/character1.f90: New test.
+ * testsuite/libgomp.fortran/character2.f90: New test.
+
+ * testsuite/libgomp.dg/nested-1.c: New test.
+ * testsuite/libgomp.dg/nested-2.c: New test.
+ * testsuite/libgomp.fortran/do1.f90: New test.
+ * testsuite/libgomp.fortran/do2.f90: New test.
+
+ * testsuite/libgomp.fortran/reference1.f90: New test.
+
+2005-10-11 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.dg/reduction-1.c: New test.
+ * testsuite/libgomp.dg/reduction-2.c: New test.
+ * testsuite/libgomp.dg/reduction-3.c: New test.
+
+2005-10-10 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.dg/atomic-1.c: New test.
+ * testsuite/libgomp.dg/atomic-2.c: New test.
+
+2005-10-09 Richard Henderson <rth@redhat.com>
+
+ * critical.c (atomic_lock): New.
+ (initialize_critical): Initialize it.
+ (GOMP_atomic_start, GOMP_atomic_end): New.
+ * libgomp.map: Export them.
+ * libgomp_g.h: Declare them.
+
+ * testsuite/libgomp.dg/atomic-10.c: Move from gcc testsuite.
+
+2005-10-02 Richard Henderson <rth@redhat.com>
+
+ * configure.ac: Move save_CFLAGS hack earlier. Append -Wall/-Werror
+ to XCFLAGS instead of CFLAGS.
+
+2005-09-30 Richard Henderson <rth@redhat.com>
+
+ * configure.ac: Determine whether -pthread or -lpthread is needed.
+ * Makefile.am (libgomp_la_LDFLAGS): Remove explicit -lpthread.
+ * Makefine.in, configure: Rebuild.
+
+2005-09-28 Richard Henderson <rth@redhat.com>
+
+ * testsuite/libgomp.dg/omp-loop03.c: Fix return code.
+ * testsuite/libgomp.dg/omp-single-3.c: New test.
+
+2005-09-28 Diego Novillo <dnovillo@redhat.com>
+
+ * testsuite/libgomp.dg/omp-single-2.c: New test.
+ * testsuite/libgomp.dg/shared-2.c: Fix return code.
+
+2005-09-27 Richard Henderson <rth@redhat.com>
+
+ * testsuite/libgomp.dg/omp-loop03.c: Add initial barrier.
+ * testsuite/libgomp.dg/omp-parallel-for.c: Specify static schedule.
+
+2005-09-27 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.dg/omp-loop03.c: New test.
+
+2005-09-27 Diego Novillo <dnovillo@redhat.com>
+
+ * testsuite/libgomp.dg/omp-parallel-for.c: New test.
+
+2005-09-27 Diego Novillo <dnovillo@redhat.com>
+
+ * testsuite/libgomp.dg/omp-single-1.c: New test.
+ * testsuite/libgomp.dg/shared-1.c: Return 0.
+ Add prototype for abort.
+ * testsuite/libgomp.dg/shared-2.c: Likewise.
+
+2005-09-26 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.fortran/omp_parse3.f90: Fix non-conforming
+ constructs.
+
+2005-09-26 Diego Novillo <dnovillo@redhat.com>
+
+ * testsuite/libgomp.dg/shared-1.c: New test.
+ * testsuite/libgomp.dg/shared-2.c: New test.
+
+2005-09-24 Richard Henderson <rth@redhat.com>
+
+ * testsuite/libgomp.dg/omp_workshare3.c: Mark dg-error.
+
+2005-09-24 Richard Henderson <rth@redhat.com>
+
+ * iter.c (gomp_iter_static_next): Round up when computing number
+ of iterations. Don't bother distributing a remainder equally.
+
+ * testsuite/libgomp.dg/omp-loop01.c (main1): Rename from main.
+ Don't call srand. Zero b before testing.
+ (main): New.
+
+2005-09-24 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.fortran/omp_atomic1.f90: New test.
+ * testsuite/libgomp.fortran/omp_atomic2.f90: New test.
+
+2005-09-23 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.fortran/omp_parse1.f90: Add a test for !$omp do
+ without !$omp end do, followed immediately by subroutine end.
+
+2005-09-23 Diego Novillo <dnovillo@redhat.com>
+
+ * testsuite/libgomp.dg/omp-parallel-if.c: New test.
+
+2005-09-22 Richard Henderson <rth@redhat.com>
+
+ * critical.c (GOMP_critical_name_start): Change argument to void**.
+ Reuse the pointer space if the mutex fits.
+ (GOMP_critical_name_end): Likewise.
+ (initialize_critical): Don't define if GOMP_MUTEX_INIT_0.
+ * libgomp_g.h (GOMP_critical_name_start): Update decl.
+ (GOMP_critical_name_end): Likewise.
+ * config/linux/mutex.h (GOMP_MUTEX_INIT_0): New.
+ * config/posix/mutex.h (GOMP_MUTEX_INIT_0): New.
+
+2005-09-20 Richard Henderson <rth@redhat.com>
+
+ * critical.c (GOMP_critical_name_start, GOMP_critical_name_end): New.
+ (create_lock_lock): New.
+ (initialize_critical): Initialize it.
+ * libgomp.map (GOMP_critical_name_start, GOMP_critical_name_end): New.
+ * libgomp_g.h (GOMP_ordered_start, GOMP_ordered_end): Declare.
+
+2005-09-20 Diego Novillo <dnovillo@redhat.com>
+
+ * testsuite/libgom.dg/omp-loop01.c: Include stdio.h.
+
+2005-09-20 Diego Novillo <dnovillo@redhat.com>
+
+ * testsuite/libgomp.dg/omp-loop01.c: New test.
+ * testsuite/libgomp.dg/omp-loop02.c: New test.
+
+2005-09-20 Jakub Jelinek <jakub@redhat.com>
+
+ * configure.ac (AC_PROG_FC): Add.
+ (USE_FORTRAN): New automake conditional.
+ * configure: Rebuilt.
+ * Makefile.am (libgomp_la_SOURCES): Add fortran.c.
+ (nodist_include_HEADERS): Add omp_lib.h, omp_lib.f90 and libgomp_f.h.
+ If USE_FORTRAN, add also omp_lib.mod and omp_lib_kinds.mod.
+ Add rules to build them.
+ * Makefile.in: Rebuilt.
+ * mkomp_h.pl: Compute and replace also OMP_LOCK_KIND and
+ OMP_NEST_LOCK_KIND.
+ * libgomp.map: Add Fortran wrappers.
+ * libgomp_f.h.in: New file.
+ * omp_lib.h.in: New file.
+ * omp_lib.f90.in: New file.
+ * fortran.c: New file.
+ * testsuite/lib/libgomp-dg.exp: Load a few more .exp files.
+ Append libgfortran directory to LD_LIBRARY_PATH if it exists.
+ Add -Lpath_to_libgfortran and -lgfortran -lgfortranbegin if
+ libgfortran has been built.
+ * testsuite/libgomp.fortran/fortran.exp: New file.
+ * testsuite/libgomp.fortran/omp_cond1.f: New test.
+ * testsuite/libgomp.fortran/omp_cond2.f: New test.
+ * testsuite/libgomp.fortran/omp_cond3.F90: New test.
+ * testsuite/libgomp.fortran/omp_cond4.F90: New test.
+ * testsuite/libgomp.fortran/omp_hello.f: New test.
+ * testsuite/libgomp.fortran/omp_orphan.f: New test.
+ * testsuite/libgomp.fortran/omp_parse1.f90: New test.
+ * testsuite/libgomp.fortran/omp_parse2.f90: New test.
+ * testsuite/libgomp.fortran/omp_parse3.f90: New test.
+ * testsuite/libgomp.fortran/omp_parse4.f90: New test.
+ * testsuite/libgomp.fortran/omp_reduction.f: New test.
+ * testsuite/libgomp.fortran/omp_workshare1.f: New test.
+ * testsuite/libgomp.fortran/omp_workshare2.f: New test.
+
+2005-08-30 Richard Henderson <rth@redhat.com>
+
+ * loop.c (GOMP_loop_static_start): Provide fallback wrapper
+ function for when aliases are not usable.
+ (GOMP_loop_dynamic_start, GOMP_loop_guided_start,
+ GOMP_loop_ordered_static_start, GOMP_loop_ordered_dynamic_start,
+ GOMP_loop_ordered_guided_start, GOMP_loop_static_next,
+ GOMP_loop_dynamic_next, GOMP_loop_guided_next,
+ GOMP_loop_ordered_static_next, GOMP_loop_ordered_dynamic_next,
+ GOMP_loop_ordered_guided_next): Likewise.
+ * ordered.c (GOMP_ordered_start): Likewise.
+
+2005-08-01 Diego Novillo <dnovillo@redhat.com>
+
+ * testsuite/libgomp.dg/dg.exp: Use -O2 for now.
+ * testsuite/libgomp.dg/omp_hello.c: Fix return code
+ * testsuite/libgomp.dg/omp_matvec.c: Likewise.
+ * testsuite/libgomp.dg/omp_orphan.c: Likewise
+ * testsuite/libgomp.dg/omp_reduction.c: Likewise
+ * testsuite/libgomp.dg/omp_workshare1.c: Likewise
+ * testsuite/libgomp.dg/omp_workshare2.c: Likewise
+ * testsuite/libgomp.dg/omp_workshare3.c: Likewise
+ * testsuite/libgomp.dg/omp_workshare4.c: Likewise
+
+2005-07-07 Eric Christopher <echristo@redhat.com>
+ Diego Novillo <dnovillo@redhat.com>
+
+ * testsuite/libgomp.dg/dg.exp: Add -fopenmp to DEFAULT_CFLAGS.
+ * testsuite/libgomp.dg/omp_hello.c: Add standard includes, fix
+ up code.
+ * testsuite/libgomp.dg/omp_matvec.c: Ditto.
+ * testsuite/libgomp.dg/omp_orphan.c: Ditto.
+ * testsuite/libgomp.dg/omp_reduction.c: Ditto.
+ * testsuite/libgomp.dg/omp_workshare1.c: Ditto.
+ * testsuite/libgomp.dg/omp_workshare2.c: Ditto.
+ * testsuite/libgomp.dg/omp_workshare3.c: Ditto.
+ * testsuite/libgomp.dg/omp_workshare4.c: Ditto.
+
+2005-06-13 Diego Novillo <dnovillo@redhat.com>
+
+ * TOPLEVEL.patch: Remove.
+
+2005-05-16 Richard Henderson <rth@redhat.com>
+
+ * configure.ac: Test for clock_gettime.
+ * config.h.in, configure: Rebuild.
+ * config/posix/time.c: Use recommended TIME_WITH_SYS_TIME pattern.
+ (omp_get_wtime): Use clock_gettime if available.
+ (omp_get_wtick): Use clock_getres if available.
+
+2005-05-11 Richard Henderson <rth@redhat.com>
+
+ * config/linux/ia64/futex.h: New file.
+ * configure.tgt: Use it.
+
+ * team.c (gomp_barrier_init, gomp_barrier_destroy): Mark inline.
+
+2005-05-07 Richard Henderson <rth@redhat.com>
+
+ * config/linux/powerpc/futex.h: New file.
+ * configure.tgt: Use it.
+
+ * config/linux/i486/futex.h: Merge ...
+ * config/linux/x86_64/futex.h: ... into ...
+ * config/linux/x86/futex.h: ... here.
+ * configure.tgt: Update to match.
+
+2005-05-06 Richard Henderson <rth@redhat.com>
+
+ * config/linux/alpha/futex.h: Conditionally define SYS_futex.
+ * config/linux/i486/futex.h: Likewise.
+ * config/linux/x86_64/futex.h: Likewise.
+
+ * config/linux/lock.c: New file.
+ * config/linux/omp-lock.h: New file.
+
+ * critical.c, env.h: Don't include omp.h
+ * config/posix/lock.c: Include libgomp.h instead of omp.h.
+ * config/posix/time.c: Likewise.
+ * config/posix/omp-lock.h: New file.
+ * libgomp.h: Include omp-lock.h and omp.h.
+ * Makefile.am (nodist_include_HEADERS): New.
+ (omp.h): New rule.
+ * configure.ac (PERL): New.
+ * mkomp_h.pl: New file.
+ * omp.h.in: Rename from omp.h; replace omp_lock_t and omp_nest_lock_t
+ with templates.
+ * Makefile.in, configure, testsuite/Makefile.in: Rebuild.
+
+ * testsuite/lib/libgomp-dg.exp (libgomp_init): Add include into
+ build directory. Re-add -march=i486 hack.
+
+ * testsuite/lib/libgomp-dg.exp (libgomp_compile_flags): Remove.
+ (libgomp_link_flags): Remove.
+ (libgomp_initialized): Remove.
+ (libgomp_init): Don't protect from reinitialization. Copy code
+ from libstdc++ for getting the multilib set correctly.
+
+2005-05-05 Richard Henderson <rth@redhat.com>
+
+ * config/linux/alpha/futex.h: New file.
+ * configure.tgt (alpha*-*-linux*): Use it.
+
+ * config/posix/mutex.c: New file.
+ * config/posix/sem.c: Use libgomp.h.
+
+ * configure.tgt (x86_64-linux): Also test CC for -m32.
+ * config/linux/x86_64/futex.h (futex_wait): Fix r10 usage.
+
+ * testsuite/lib/libgomp-dg.exp (libgomp_link_flags): Add /
+ after $gccpath.
+
+ * Makefile.am (SUBDIRS): New.
+ (libgomp_la_LDFLAGS): Add -lpthread.
+ * configure.ac (AM_INIT_AUTOMAKE): Enable dependencies.
+ * Makefile.in, aclocal.m4, config.h.in, configure: Rebuild.
+
+ * libgomp_g.h: New file.
+ * libgomp.h: Split out all public declarations to libgomp_g.h.
+ Use pragma GCC visibility instead of ATTRIBUTE_HIDDEN.
+ * config/linux/mutex.h: Remove ATTRIBUTE_HIDDEN.
+ * config/linux/sem.h: Likewise.
+ * config/posix/sem.h: Likewise.
+
+ * Makefile.am (AM_LDFLAGS): New.
+ (libgomp_version_script): Split out from ...
+ (libgomp_la_LDFLAGS): ... here.
+ (libgomp_version_info): New.
+ * acinclude.m4 (LIBGOMP_CHECK_TLS): Use LIBGOMP_ENABLE.
+ (LIBGOMP_ENABLE): New.
+ (LIBGOMP_CHECK_LINKER_FEATURES): New.
+ (LIBGOMP_ENABLE_SYMVERS): New.
+ * configure.ac (AC_INIT): Version 1.0.
+ (enable-version-specific-runtime-libs): Use LIBGOMP_ENABLE.
+ (enable-linux-futex): Likewise. Rename from enable-futex.
+ (libtool_VERSION): New.
+ (LIBGOMP_ENABLE_SYMVERS): Use it.
+ * configure.tgt: Check with_gnu_ld wrt have_tls optimizations.
+ * Makefile.in, aclocal.m4, configure: Rebuild.
+
+ * config/linux/mutex.c: Include libgomp.h instead of mutex.h.
+ (gomp_mutex_unlock_slow): Fix typo.
+ * config/linux/sem.c: Similarly.
+ (gomp_sem_post_slow): Fix typo.
+ * config/linux/sem.h (gomp_sem_post_slow): Fix typo.
+ * config/linux/i486/futex.h: Remove USE_LINUX_SYSENTER code.
+ [__PIC__] (sys_futex0): Don't use tmp output in asm.
+
+ * Makefile.am (AM_CFLAGS): Expand with XCFLAGS.
+ (libgomp_la_LDFLAGS): Add top_srcdir to path.
+ * acinclude.m4: Copy libtool.m4 stuff from libgfortran.
+ * configure.ac: Check for getloadavg. Substitute XCFLAGS and
+ XLDFLAGS. Add XCFLAGS to CFLAGS around LIBGOMP_CHECK_SYNC_BUILTINS.
+ * configure.tgt: Set XCFLAGS and XLDFLAGS instead of CFLAGS and
+ LDFLAGS. Pull enable_futex check to top-level.
+ * libgomp.h: Fix sem.h and mutex.h includes. Define ATTRIBUTE_HIDDEN.
+ * Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.
+
+ First attempt at real configury.
+ * Makefile, config.h: Remove file.
+ * Makefile.am, Makefile.in: New file.
+ * acinclude.m4 aclocal.m4: New file.
+ * configure.ac, configure.tgt, configure: New file.
+
+ * config/posix/lock.c: Rename from sys-lock.c.
+ * config/posix/mutex.h: Rename from sys-mutex.h.
+ * config/posix/sem.c: Rename from sys-sem.c.
+ * config/posix/sem.h: Rename from sys-sem.h.
+ * config/posix/proc.c: Rename from sys-proc.c.
+ * config/posix/time.c: Rename from sys-proc.c.
+
+ * config/linux/mutex.c: New file.
+ * config/linux/mutex.h: New file.
+ * config/linux/sem.c: New file.
+ * config/linux/sem.h: New file.
+ * config/linux/i486/futex.h: New file.
+ * config/linux/x86_64/futex.h: New file.
+
+2005-05-04 Richard Henderson <rth@redhat.com>
+
+ * iter.c (gomp_iter_dynamic_next, gomp_iter_guided_next): New.
+ * libgomp.h: Declare them.
+ * loop.c (gomp_loop_dynamic_start, gomp_loop_guided_start,
+ gomp_loop_dynamic_next, gomp_loop_guided_next): Use them.
+
+2005-05-04 Richard Henderson <rth@redhat.com>
+
+ * libgomp-1 code drop
+
+2005-05-04 Richard Henderson <rth@redhat.com>
+
+ * iter.c (gomp_iter_static_next): Return tri-state on 0.
+ * ordered.c (gomp_ordered_static_next): Remove not_last argument.
+ * libgomp.h (struct gomp_team_state): Make static_trip unsigned.
+ (gomp_iter_static_next): Update.
+ (gomp_ordered_static_next): Update.
+ * loop.c (gomp_loop_static_start): Update for gomp_iter_static_next.
+ (gomp_loop_ordered_static_start): Likewise. Exit early for a
+ totally empty range.
+ (gomp_loop_ordered_static_next): Refine test for calling
+ gomp_ordered_static_next.
+ * testsuite/ordered-1.c: Add case for more threads than iterations.
+
+ * iter.c (gomp_iter_runtime_next_locked): Remove.
+ * loop.c (gomp_loop_static_start, gomp_loop_dynamic_start,
+ gomp_loop_guided_start, gomp_loop_ordered_static_start,
+ gomp_loop_ordered_dynamic_start, gomp_loop_ordered_guided_start,
+ gomp_loop_static_next, gomp_loop_dynamic_next, gomp_loop_guided_next,
+ gomp_loop_ordered_static_next, gomp_loop_ordered_dynamic_next,
+ gomp_loop_ordered_guided_next): Downcase name, make static, add
+ an external alias with the old name.
+ (GOMP_loop_runtime_start, GOMP_loop_ordered_runtime_start,
+ GOMP_loop_runtime_next, GOMP_loop_ordered_runtime_next): Use a
+ switch and call one of the above static functions.
+ * libgomp.h: Update.
+
+ * work.c (gomp_work_share_start): Lock the mutex for !first too.
+ * loop.c (GOMP_loop_static_start, GOMP_loop_dynamic_start,
+ GOMP_loop_guided_start, GOMP_loop_runtime_start,
+ GOMP_loop_ordered_static_start, GOMP_loop_ordered_dynamic_start,
+ GOMP_loop_ordered_guided_start): Update to match.
+ * sections.c (GOMP_sections_start): Likewise.
+ * single.c (GOMP_single_start, GOMP_single_copy_start): Likewise.
+
+ * ordered.c (gomp_ordered_first, gomp_ordered_last, gomp_ordered_next,
+ gomp_ordered_static_init, gomp_ordered_static_next): Rename s/_loop//.
+ Use bounds check instead of modulus.
+ (gomp_ordered_sync): Split out of GOMP_ordered_start.
+ (gomp_ordered_last): Don't sync with ordered_owner here.
+ (gomp_ordered_next): Likewise.
+ (gomp_ordered_static_loop_next): Likewise.
+ * loop.c, libgomp.h: Update to match.
+
+ * libgomp.h (GOMP_barrier): Declare.
+
+ * testsuite/barrier-1.c: New file.
+ * testsuite/critical-1.c: New file.
+ * testsuite/ordered-2.c: New file.
+ * testsuite/ordered-1.c: New file.
+ * testsuite/sections-1.c: New file.
+ * testsuite/single-1.c: New file.
+ * testsuite/Makefile (TESTS): Add them.
+
+2005-05-04 Richard Henderson <rth@redhat.com>
+
+ * libgomp.h (struct gomp_work_share): Add ordered_owner.
+ * loop.c (GOMP_loop_static_start): If not the startup thread,
+ acquire the mutex to wait for initialization complete.
+ (GOMP_loop_ordered_static_start): Likewise.
+ (GOMP_loop_ordered_runtime_start): Likewise.
+ (GOMP_loop_ordered_static_first): Remove.
+ (GOMP_loop_ordered_dynamic_first): Remove.
+ (GOMP_loop_ordered_guided_first): Remove.
+ (GOMP_loop_ordered_runtime_first): Remove.
+ * ordered.c (gomp_ordered_loop_first): Post to own release when
+ we're the first thread.
+ (gomp_ordered_loop_last): Wait on release if not owner.
+ (gomp_ordered_loop_next): Likewise.
+ (gomp_ordered_static_loop_init): New.
+ (gomp_ordered_static_loop_next): Use ordered_owner.
+ (GOMP_ordered_start): Likewise.
+ * work.c (gomp_new_work_share): Initialize ordered_owner.
+
+2005-05-03 Richard Henderson <rth@redhat.com>
+
+ * Makefile (OPT): New.
+ (CFLAGS): Use it.
+
+ * loop.c (GOMP_loop_end, GOMP_loop_end_nowait): New.
+ * sections.c (GOMP_sections_end, GOMP_sections_end_nowait): New.
+ * libgomp.h, libgomp.map, NOTES: Update to match.
+
+ * team.c (struct gomp_thread_start_data): Remove ts, fn, data.
+ Add initialized and thr members.
+ (gomp_thread_start): Pause when initially spawned to wait for
+ the whole team to be created.
+ (gomp_team_start): Release team members at the end.
+
+ * testsuite/loop-1.c (N): New. Use it instead of hardcoded 100.
+ (f_foo_1): Use GOMP_loop_end.
+ (f_foo_2): Use GOMP_loop_end_nowait.
+
+ * testsuite/loop-2.c: New file.
+ * testsuite/Makefile (TESTS): Add it.
+
+2005-05-03 Richard Henderson <rth@redhat.com>
+
+ * iter.c (gomp_iter_static_next): Fix overflow check typo.
+ (gomp_iter_dynamic_next_locked): Fix overflow check thinko.
+ * team.c (new_team): Initialize oldest_live_gen to 1 if no
+ initial work_share.
+
+ * testsuite/Makefile: New file.
+ * testsuite/loop-1.c: New file.
+
+2005-05-03 Richard Henderson <rth@redhat.com>
+
+ Initial implementation and checkin.
--- /dev/null
+## Process this file with automake to produce Makefile.in
+
+ACLOCAL_AMFLAGS = -I ../config
+SUBDIRS = testsuite
+
+## May be used by toolexeclibdir.
+gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+
+config_path = @config_path@
+search_path = $(addprefix $(top_srcdir)/config/, $(config_path)) $(top_srcdir)
+
+empty =
+space = $(empty) $(empty)
+VPATH = $(subst $(space),:,$(strip $(search_path)))
+
+AM_CPPFLAGS = $(addprefix -I, $(search_path))
+AM_CFLAGS = $(XCFLAGS)
+AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
+
+toolexeclib_LTLIBRARIES = libgomp.la
+nodist_toolexeclib_HEADERS = libgomp.spec
+
+if LIBGOMP_BUILD_VERSIONED_SHLIB
+libgomp_version_script = -Wl,--version-script,$(top_srcdir)/libgomp.map
+else
+libgomp_version_script =
+endif
+libgomp_version_info = -version-info $(libtool_VERSION)
+libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script)
+
+libgomp_la_SOURCES = alloc.c barrier.c critical.c env.c error.c iter.c \
+ loop.c ordered.c parallel.c sections.c single.c team.c work.c \
+ lock.c mutex.c proc.c sem.c bar.c time.c fortran.c
+
+nodist_noinst_HEADERS = libgomp_f.h
+nodist_include_HEADERS = omp.h omp_lib.h omp_lib.f90
+if USE_FORTRAN
+nodist_include_HEADERS += omp_lib.mod omp_lib_kinds.mod
+endif
+
+omp.h: omp.h.in mkomp_h.pl
+ $(PERL) -w $(srcdir)/mkomp_h.pl "$(COMPILE)" $(srcdir)/omp.h.in omp.h
+omp_lib.h: omp_lib.h.in mkomp_h.pl
+ $(PERL) -w $(srcdir)/mkomp_h.pl "$(COMPILE)" $(srcdir)/omp_lib.h.in \
+ omp_lib.h
+omp_lib.f90: omp_lib.f90.in mkomp_h.pl
+ $(PERL) -w $(srcdir)/mkomp_h.pl "$(COMPILE)" $(srcdir)/omp_lib.f90.in \
+ omp_lib.f90
+libgomp_f.h: libgomp_f.h.in mkomp_h.pl
+ $(PERL) -w $(srcdir)/mkomp_h.pl "$(COMPILE)" $(srcdir)/libgomp_f.h.in \
+ libgomp_f.h
+omp_lib_kinds.mod: omp_lib.mod
+ :
+omp_lib.mod: omp_lib.f90
+ $(FC) $(FCFLAGS) -fsyntax-only omp_lib.f90
+fortran.lo: libgomp_f.h
+fortran.o: libgomp_f.h
+env.lo: libgomp_f.h
+env.o: libgomp_f.h
--- /dev/null
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+SOURCES = $(libgomp_la_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+@USE_FORTRAN_TRUE@am__append_1 = omp_lib.mod omp_lib_kinds.mod
+DIST_COMMON = $(am__configure_deps) $(srcdir)/../config.guess \
+ $(srcdir)/../config.sub $(srcdir)/../depcomp \
+ $(srcdir)/../install-sh $(srcdir)/../ltmain.sh \
+ $(srcdir)/../missing $(srcdir)/../mkinstalldirs \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/config.h.in $(srcdir)/libgomp.spec.in \
+ $(top_srcdir)/configure ChangeLog
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
+ $(top_srcdir)/../config/lead-dot.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno configure.status.lineno
+mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES = libgomp.spec
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(toolexeclibdir)" \
+ "$(DESTDIR)$(includedir)" "$(DESTDIR)$(toolexeclibdir)"
+toolexeclibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
+libgomp_la_LIBADD =
+am_libgomp_la_OBJECTS = alloc.lo barrier.lo critical.lo env.lo \
+ error.lo iter.lo loop.lo ordered.lo parallel.lo sections.lo \
+ single.lo team.lo work.lo lock.lo mutex.lo proc.lo sem.lo \
+ bar.lo time.lo fortran.lo
+libgomp_la_OBJECTS = $(am_libgomp_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
+depcomp = $(SHELL) $(top_srcdir)/../depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgomp_la_SOURCES)
+DIST_SOURCES = $(libgomp_la_SOURCES)
+MULTISRCTOP =
+MULTIBUILDTOP =
+MULTIDIRS =
+MULTISUBDIR =
+MULTIDO = true
+MULTICLEAN = true
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+nodist_includeHEADERS_INSTALL = $(INSTALL_HEADER)
+nodist_toolexeclibHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(nodist_include_HEADERS) $(nodist_noinst_HEADERS) \
+ $(nodist_toolexeclib_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ { test ! -d $(distdir) \
+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+VPATH = $(subst $(space),:,$(strip $(search_path)))
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FC = @FC@
+FCFLAGS = @FCFLAGS@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBGOMP_BUILD_VERSIONED_SHLIB_FALSE = @LIBGOMP_BUILD_VERSIONED_SHLIB_FALSE@
+LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE = @LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OPT_LDFLAGS = @OPT_LDFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+RANLIB = @RANLIB@
+SECTION_LDFLAGS = @SECTION_LDFLAGS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_FORTRAN_FALSE = @USE_FORTRAN_FALSE@
+USE_FORTRAN_TRUE = @USE_FORTRAN_TRUE@
+VERSION = @VERSION@
+XCFLAGS = @XCFLAGS@
+XLDFLAGS = @XLDFLAGS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_FC = @ac_ct_FC@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+config_path = @config_path@
+datadir = @datadir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+libtool_VERSION = @libtool_VERSION@
+link_gomp = @link_gomp@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexecdir = @toolexecdir@
+toolexeclibdir = @toolexeclibdir@
+ACLOCAL_AMFLAGS = -I ../config
+SUBDIRS = testsuite
+gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+search_path = $(addprefix $(top_srcdir)/config/, $(config_path)) $(top_srcdir)
+empty =
+space = $(empty) $(empty)
+AM_CPPFLAGS = $(addprefix -I, $(search_path))
+AM_CFLAGS = $(XCFLAGS)
+AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
+toolexeclib_LTLIBRARIES = libgomp.la
+nodist_toolexeclib_HEADERS = libgomp.spec
+@LIBGOMP_BUILD_VERSIONED_SHLIB_FALSE@libgomp_version_script =
+@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp_version_script = -Wl,--version-script,$(top_srcdir)/libgomp.map
+libgomp_version_info = -version-info $(libtool_VERSION)
+libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script)
+libgomp_la_SOURCES = alloc.c barrier.c critical.c env.c error.c iter.c \
+ loop.c ordered.c parallel.c sections.c single.c team.c work.c \
+ lock.c mutex.c proc.c sem.c bar.c time.c fortran.c
+
+nodist_noinst_HEADERS = libgomp_f.h
+nodist_include_HEADERS = omp.h omp_lib.h omp_lib.f90 $(am__append_1)
+all: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
+ cd $(srcdir) && $(AUTOMAKE) --foreign \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) stamp-h1; \
+ else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: $(am__configure_deps)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+libgomp.spec: $(top_builddir)/config.status $(srcdir)/libgomp.spec.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(toolexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(toolexeclibdir)"
+ @list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=install $(toolexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(toolexeclibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(toolexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(toolexeclibdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-toolexeclibLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @set -x; list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(toolexeclibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(toolexeclibdir)/$$p"; \
+ done
+
+clean-toolexeclibLTLIBRARIES:
+ -test -z "$(toolexeclib_LTLIBRARIES)" || rm -f $(toolexeclib_LTLIBRARIES)
+ @list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libgomp.la: $(libgomp_la_OBJECTS) $(libgomp_la_DEPENDENCIES)
+ $(LINK) -rpath $(toolexeclibdir) $(libgomp_la_LDFLAGS) $(libgomp_la_OBJECTS) $(libgomp_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alloc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bar.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/barrier.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/critical.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/env.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fortran.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lock.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loop.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mutex.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ordered.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parallel.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sections.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sem.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/single.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/team.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/work.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+
+# GNU Make needs to see an explicit $(MAKE) variable in the command it
+# runs to enable its job server during parallel builds. Hence the
+# comments below.
+all-multi:
+ $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE)
+install-multi:
+ $(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do # $(MAKE)
+
+mostlyclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean # $(MAKE)
+clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean # $(MAKE)
+distclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean # $(MAKE)
+maintainer-clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean # $(MAKE)
+uninstall-info-am:
+install-nodist_includeHEADERS: $(nodist_include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)"
+ @list='$(nodist_include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(nodist_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+ $(nodist_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+uninstall-nodist_includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(nodist_include_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(includedir)/$$f"; \
+ done
+install-nodist_toolexeclibHEADERS: $(nodist_toolexeclib_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(toolexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(toolexeclibdir)"
+ @list='$(nodist_toolexeclib_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(nodist_toolexeclibHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(toolexeclibdir)/$$f'"; \
+ $(nodist_toolexeclibHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(toolexeclibdir)/$$f"; \
+ done
+
+uninstall-nodist_toolexeclibHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(nodist_toolexeclib_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(toolexeclibdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(toolexeclibdir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ mkdir $(distdir)
+ $(mkdir_p) $(distdir)/. $(distdir)/.. $(distdir)/../config
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && cd $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
+distuninstallcheck:
+ @cd $(distuninstallcheck_dir) \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES) all-multi $(HEADERS) config.h
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(toolexeclibdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-multi clean-recursive
+
+clean-am: clean-generic clean-libtool clean-toolexeclibLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-multi distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-hdr distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-nodist_includeHEADERS
+
+install-exec-am: install-multi install-nodist_toolexeclibHEADERS \
+ install-toolexeclibLTLIBRARIES
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-multi maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-multi mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-nodist_includeHEADERS \
+ uninstall-nodist_toolexeclibHEADERS \
+ uninstall-toolexeclibLTLIBRARIES
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am all-multi \
+ am--refresh check check-am clean clean-generic clean-libtool \
+ clean-multi clean-recursive clean-toolexeclibLTLIBRARIES ctags \
+ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \
+ dist-tarZ dist-zip distcheck distclean distclean-compile \
+ distclean-generic distclean-hdr distclean-libtool \
+ distclean-multi distclean-recursive distclean-tags \
+ distcleancheck distdir distuninstallcheck dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-multi \
+ install-nodist_includeHEADERS \
+ install-nodist_toolexeclibHEADERS install-strip \
+ install-toolexeclibLTLIBRARIES installcheck installcheck-am \
+ installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-multi \
+ maintainer-clean-recursive mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool mostlyclean-multi \
+ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-info-am \
+ uninstall-nodist_includeHEADERS \
+ uninstall-nodist_toolexeclibHEADERS \
+ uninstall-toolexeclibLTLIBRARIES
+
+
+omp.h: omp.h.in mkomp_h.pl
+ $(PERL) -w $(srcdir)/mkomp_h.pl "$(COMPILE)" $(srcdir)/omp.h.in omp.h
+omp_lib.h: omp_lib.h.in mkomp_h.pl
+ $(PERL) -w $(srcdir)/mkomp_h.pl "$(COMPILE)" $(srcdir)/omp_lib.h.in \
+ omp_lib.h
+omp_lib.f90: omp_lib.f90.in mkomp_h.pl
+ $(PERL) -w $(srcdir)/mkomp_h.pl "$(COMPILE)" $(srcdir)/omp_lib.f90.in \
+ omp_lib.f90
+libgomp_f.h: libgomp_f.h.in mkomp_h.pl
+ $(PERL) -w $(srcdir)/mkomp_h.pl "$(COMPILE)" $(srcdir)/libgomp_f.h.in \
+ libgomp_f.h
+omp_lib_kinds.mod: omp_lib.mod
+ :
+omp_lib.mod: omp_lib.f90
+ $(FC) $(FCFLAGS) -fsyntax-only omp_lib.f90
+fortran.lo: libgomp_f.h
+fortran.o: libgomp_f.h
+env.lo: libgomp_f.h
+env.o: libgomp_f.h
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
--- /dev/null
+Notes on the external ABI presented by libgomp. This ought to get
+transformed into proper documentation at some point.
+
+Implementing MASTER construct
+
+ if (omp_get_thread_num () == 0)
+ block
+
+ Alternately, we generate two copies of the parallel subfunction
+ and only include this in the version run by the master thread.
+ Surely that's not worthwhile though...
+
+Implementing CRITICAL construct
+
+ Without a specified name,
+
+ void GOMP_critical_start (void);
+ void GOMP_critical_end (void);
+
+ so that we don't get COPY relocations from libgomp to the main
+ application.
+
+ With a specified name, use omp_set_lock and omp_unset_lock with
+ name being transformed into a variable declared like
+
+ omp_lock_t gomp_critical_user_<name>
+ __attribute__((common))
+
+ Ideally the ABI would specify that all zero is a valid unlocked
+ state, and so we wouldn't actually need to initialize this at
+ startup.
+
+Implementing ATOMIC construct
+
+ The target should implement the __sync builtins.
+
+ Failing that we could add
+
+ void GOMP_atomic_enter (void)
+ void GOMP_atomic_exit (void)
+
+ which reuses the regular lock code, but with yet another lock
+ object private to the library.
+
+Implementing FLUSH construct
+
+ Expands to the __sync_synchronize builtin.
+
+Implementing BARRIER construct
+
+ void GOMP_barrier (void)
+
+Implementing THREADPRIVATE construct
+
+ In _most_ cases we can map this directly to __thread. Except
+ that OMP allows constructors for C++ objects. We can either
+ refuse to support this (how often is it used?) or we can
+ implement something akin to .ctors.
+
+ Even more ideally, this ctor feature is handled by extensions
+ to the main pthreads library. Failing that, we can have a set
+ of entry points to register ctor functions to be called.
+
+Implementing PRIVATE clause
+
+ In association with a PARALLEL, or within the lexical extent
+ of a PARALLEL block, the variable becomes a local variable in
+ the parallel subfunction.
+
+ In association with FOR or SECTIONS blocks, create a new
+ automatic variable within the current function. This preserves
+ the semantic of new variable creation.
+
+Implementing FIRSTPRIVATE, LASTPRIVATE, COPYIN, COPYPRIVATE clauses
+
+ Seems simple enough for PARALLEL blocks. Create a private
+ struct for communicating between parent and subfunction.
+ In the parent, copy in values for scalar and "small" structs;
+ copy in addresses for others TREE_ADDRESSABLE types. In the
+ subfunction, copy the value into the local variable.
+
+ Not clear at all what to do with bare FOR or SECTION blocks.
+ The only thing I can figure is that we do something like
+
+
+ #pragma omp for firstprivate(x) lastprivate(y)
+ for (int i = 0; i < n; ++i)
+ body;
+
+ =>
+
+ {
+ int x = x, y;
+
+ // for stuff
+
+ if (i == n)
+ y = y;
+ }
+
+ where the "x=x" and "y=y" assignments actually have different
+ uids for the two variables, i.e. not something you could write
+ directly in C. Presumably this only makes sense if the "outer"
+ x and y are global variables.
+
+ COPYPRIVATE would work the same way, except the structure
+ broadcast would have to happen via SINGLE machinery instead.
+
+Implementing REDUCTION clause
+
+ The private struct mentioned above should have a pointer to
+ an array of the type of the variable, indexed by the thread's
+ team_id. The thread stores its final value into the array,
+ and after the barrier the master thread iterates over the
+ array to collect the values.
+
+Implementing PARALLEL construct
+
+ #pragma omp parallel
+ {
+ body;
+ }
+
+ =>
+
+ void subfunction (void *data)
+ {
+ use data;
+ body;
+ }
+
+ setup data;
+ GOMP_parallel_start (subfunction, &data, num_threads);
+ subfunction (&data);
+ GOMP_parallel_end ();
+
+ void GOMP_parallel_start (void (*fn)(void *), void *data,
+ unsigned num_threads)
+
+ The FN argument is the subfunction to be run in parallel.
+
+ The DATA argument is a pointer to a structure used to
+ communicate data in and out of the subfunction, as discussed
+ above wrt FIRSTPRIVATE et al.
+
+ The NUM_THREADS argument is 1 if an IF clause is present
+ and false, or the value of the NUM_THREADS clause, if
+ present, or 0.
+
+ The function needs to create the appropriate number of
+ threads and/or launch them from the dock. It needs to
+ create the team structure and assign team ids.
+
+ void GOMP_parallel_end (void)
+
+ Tears down the team and return us to the previous
+ omp_in_parallel() state.
+
+Implementing FOR construct
+
+ #pragma omp parallel for
+ for (i = lb; i <= ub; i++)
+ body;
+
+ =>
+
+ void subfunction (void *data)
+ {
+ long _s0, _e0;
+ while (GOMP_loop_static_next (&_s0, &_e0))
+ {
+ long _e1 = _e0, i;
+ for (i = _s0; i < _e1; i++)
+ body;
+ }
+ GOMP_loop_end_nowait ();
+ }
+
+ GOMP_parallel_loop_static (subfunction, NULL, 0, lb, ub+1, 1, 0);
+ subfunction (NULL);
+ GOMP_parallel_end ();
+
+ #pragma omp for schedule(runtime)
+ for (i = 0; i < n; i++)
+ body;
+
+ =>
+
+ {
+ long i, _s0, _e0;
+ if (GOMP_loop_runtime_start (0, n, 1, &_s0, &_e0))
+ do {
+ long _e1 = _e0;
+ for (i = _s0, i < _e0; i++)
+ body;
+ } while (GOMP_loop_runtime_next (&_s0, _&e0));
+ GOMP_loop_end ();
+ }
+
+ Note that while it looks like there is trickyness to propagating
+ a non-constant STEP, there isn't really. We're explicitly allowed
+ to evaluate it as many times as we want, and any variables involved
+ should automatically be handled as PRIVATE or SHARED like any other
+ variables. So the expression should remain evaluable in the
+ subfunction. We can also pull it into a local variable if we like,
+ but since its supposed to remain unchanged, we can also not if we like.
+
+ If we have SCHEDULE(STATIC), and no ORDERED, then we ought to be
+ able to get away with no work-sharing context at all, since we can
+ simply perform the arithmetic directly in each thread to divide up
+ the iterations. Which would mean that we wouldn't need to call any
+ of these routines.
+
+ There are separate routines for handling loops with an ORDERED
+ clause. Bookkeeping for that is non-trivial...
+
+Implementing ORDERED construct
+
+ void GOMP_ordered_start (void)
+ void GOMP_ordered_end (void)
+
+Implementing SECTIONS construct
+
+ #pragma omp sections
+ {
+ #pragma omp section
+ stmt1;
+ #pragma omp section
+ stmt2;
+ #pragma omp section
+ stmt3;
+ }
+
+ =>
+
+ for (i = GOMP_sections_start (3); i != 0; i = GOMP_sections_next ())
+ switch (i)
+ {
+ case 1:
+ stmt1;
+ break;
+ case 2:
+ stmt2;
+ break;
+ case 3:
+ stmt3;
+ break;
+ }
+ GOMP_barrier ();
+
+Implementing SINGLE construct
+
+ #pragma omp single
+ {
+ body;
+ }
+
+ =>
+
+ if (GOMP_single_start ())
+ body;
+ GOMP_barrier ();
+
+
+ #pragma omp single copyprivate(x)
+ body;
+
+ =>
+
+ datap = GOMP_single_copy_start ();
+ if (datap == NULL)
+ {
+ body;
+ data.x = x;
+ GOMP_single_copy_end (&data);
+ }
+ else
+ x = datap->x;
+ GOMP_barrier ();
--- /dev/null
+dnl Check whether the target supports TLS.
+AC_DEFUN([LIBGOMP_CHECK_TLS], [
+ LIBGOMP_ENABLE(tls, yes, [Use thread-local storage])
+ AC_CACHE_CHECK([whether the target supports thread-local storage],
+ have_tls, [
+ AC_TRY_COMPILE([__thread int foo;],
+ [], have_tls=$enable_tls, have_tls=no)])
+ if test $have_tls = yes; then
+ AC_DEFINE(HAVE_TLS, 1,
+ [Define to 1 if the target supports thread-local storage.])
+ fi])
+
+dnl ----------------------------------------------------------------------
+dnl This whole bit snagged from libgfortran.
+
+dnl Check whether the target supports __sync_*_compare_and_swap.
+AC_DEFUN([LIBGOMP_CHECK_SYNC_BUILTINS], [
+ AC_CACHE_CHECK([whether the target supports __sync_*_compare_and_swap],
+ have_sync_builtins, [
+ AC_TRY_LINK([], [int foo, bar; bar = __sync_val_compare_and_swap(&foo, 0, 1);],
+ have_sync_builtins=yes, have_sync_builtins=no)])
+ if test $have_sync_builtins = yes; then
+ AC_DEFINE(HAVE_SYNC_BUILTINS, 1,
+ [Define to 1 if the target supports __sync_*_compare_and_swap])
+ fi])
+
+dnl Check whether the target supports hidden visibility.
+AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_VISIBILITY], [
+ AC_CACHE_CHECK([whether the target supports hidden visibility],
+ have_attribute_visibility, [
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror"
+ AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
+ [], have_attribute_visibility=yes,
+ have_attribute_visibility=no)
+ CFLAGS="$save_CFLAGS"])
+ if test $have_attribute_visibility = yes; then
+ AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
+ [Define to 1 if the target supports __attribute__((visibility(...))).])
+ fi])
+
+dnl Check whether the target supports dllexport
+AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_DLLEXPORT], [
+ AC_CACHE_CHECK([whether the target supports dllexport],
+ have_attribute_dllexport, [
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror"
+ AC_TRY_COMPILE([void __attribute__((dllexport)) foo(void) { }],
+ [], have_attribute_dllexport=yes,
+ have_attribute_dllexport=no)
+ CFLAGS="$save_CFLAGS"])
+ if test $have_attribute_dllexport = yes; then
+ AC_DEFINE(HAVE_ATTRIBUTE_DLLEXPORT, 1,
+ [Define to 1 if the target supports __attribute__((dllexport)).])
+ fi])
+
+dnl Check whether the target supports symbol aliases.
+AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_ALIAS], [
+ AC_CACHE_CHECK([whether the target supports symbol aliases],
+ have_attribute_alias, [
+ AC_TRY_LINK([
+#define ULP STR1(__USER_LABEL_PREFIX__)
+#define STR1(x) STR2(x)
+#define STR2(x) #x
+void foo(void) { }
+extern void bar(void) __attribute__((alias(ULP "foo")));],
+ [bar();], have_attribute_alias=yes, have_attribute_alias=no)])
+ if test $have_attribute_alias = yes; then
+ AC_DEFINE(HAVE_ATTRIBUTE_ALIAS, 1,
+ [Define to 1 if the target supports __attribute__((alias(...))).])
+ fi])
+
+sinclude(../libtool.m4)
+dnl The lines below arrange for aclocal not to bring an installed
+dnl libtool.m4 into aclocal.m4, while still arranging for automake to
+dnl add a definition of LIBTOOL to Makefile.in.
+ifelse(,,,[AC_SUBST(LIBTOOL)
+AC_DEFUN([AM_PROG_LIBTOOL])
+AC_DEFUN([AC_LIBTOOL_DLOPEN])
+AC_DEFUN([AC_PROG_LD])
+])
+
+dnl ----------------------------------------------------------------------
+dnl This whole bit snagged from libstdc++-v3.
+
+dnl
+dnl LIBGOMP_ENABLE
+dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
+dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
+dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
+dnl
+dnl See docs/html/17_intro/configury.html#enable for documentation.
+dnl
+m4_define([LIBGOMP_ENABLE],[dnl
+m4_define([_g_switch],[--enable-$1])dnl
+m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
+ AC_ARG_ENABLE($1,_g_help,
+ m4_bmatch([$5],
+ [^permit ],
+ [[
+ case "$enableval" in
+ m4_bpatsubst([$5],[permit ])) ;;
+ *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
+ dnl Idea for future: generate a URL pointing to
+ dnl "onlinedocs/configopts.html#whatever"
+ esac
+ ]],
+ [^$],
+ [[
+ case "$enableval" in
+ yes|no) ;;
+ *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
+ esac
+ ]],
+ [[$5]]),
+ [enable_]m4_bpatsubst([$1],-,_)[=][$2])
+m4_undefine([_g_switch])dnl
+m4_undefine([_g_help])dnl
+])
+
+
+dnl
+dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
+dnl the native linker is in use, all variables will be defined to something
+dnl safe (like an empty string).
+dnl
+dnl Defines:
+dnl SECTION_LDFLAGS='-Wl,--gc-sections' if possible
+dnl OPT_LDFLAGS='-Wl,-O1' if possible
+dnl LD (as a side effect of testing)
+dnl Sets:
+dnl with_gnu_ld
+dnl libgomp_gnu_ld_version (possibly)
+dnl
+dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
+dnl set libgomp_gnu_ld_version to 12345. Zeros cause problems.
+dnl
+AC_DEFUN([LIBGOMP_CHECK_LINKER_FEATURES], [
+ # If we're not using GNU ld, then there's no point in even trying these
+ # tests. Check for that first. We should have already tested for gld
+ # by now (in libtool), but require it now just to be safe...
+ test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
+ test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
+ AC_REQUIRE([AC_PROG_LD])
+ AC_REQUIRE([AC_PROG_AWK])
+
+ # The name set by libtool depends on the version of libtool. Shame on us
+ # for depending on an impl detail, but c'est la vie. Older versions used
+ # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
+ # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
+ # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
+ # set (hence we're using an older libtool), then set it.
+ if test x${with_gnu_ld+set} != xset; then
+ if test x${ac_cv_prog_gnu_ld+set} != xset; then
+ # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
+ with_gnu_ld=no
+ else
+ with_gnu_ld=$ac_cv_prog_gnu_ld
+ fi
+ fi
+
+ # Start by getting the version number. I think the libtool test already
+ # does some of this, but throws away the result.
+ changequote(,)
+ ldver=`$LD --version 2>/dev/null | head -1 | \
+ sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+ changequote([,])
+ libgomp_gnu_ld_version=`echo $ldver | \
+ $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
+
+ # Set --gc-sections.
+ if test "$with_gnu_ld" = "notbroken"; then
+ # GNU ld it is! Joy and bunny rabbits!
+
+ # All these tests are for C++; save the language and the compiler flags.
+ # Need to do this so that g++ won't try to link in libstdc++
+ ac_test_CFLAGS="${CFLAGS+set}"
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS='-x c++ -Wl,--gc-sections'
+
+ # Check for -Wl,--gc-sections
+ # XXX This test is broken at the moment, as symbols required for linking
+ # are now in libsupc++ (not built yet). In addition, this test has
+ # cored on solaris in the past. In addition, --gc-sections doesn't
+ # really work at the moment (keeps on discarding used sections, first
+ # .eh_frame and now some of the glibc sections for iconv).
+ # Bzzzzt. Thanks for playing, maybe next time.
+ AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
+ AC_TRY_RUN([
+ int main(void)
+ {
+ try { throw 1; }
+ catch (...) { };
+ return 0;
+ }
+ ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ else
+ # this is the suspicious part
+ CFLAGS=''
+ fi
+ if test "$ac_sectionLDflags" = "yes"; then
+ SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
+ fi
+ AC_MSG_RESULT($ac_sectionLDflags)
+ fi
+
+ # Set linker optimization flags.
+ if test x"$with_gnu_ld" = x"yes"; then
+ OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
+ fi
+
+ AC_SUBST(SECTION_LDFLAGS)
+ AC_SUBST(OPT_LDFLAGS)
+])
+
+
+dnl
+dnl Add version tags to symbols in shared library (or not), additionally
+dnl marking other symbols as private/local (or not).
+dnl
+dnl --enable-symvers=style adds a version script to the linker call when
+dnl creating the shared library. The choice of version script is
+dnl controlled by 'style'.
+dnl --disable-symvers does not.
+dnl + Usage: LIBGOMP_ENABLE_SYMVERS[(DEFAULT)]
+dnl Where DEFAULT is either 'yes' or 'no'. Passing `yes' tries to
+dnl choose a default style based on linker characteristics. Passing
+dnl 'no' disables versioning.
+dnl
+AC_DEFUN([LIBGOMP_ENABLE_SYMVERS], [
+
+LIBGOMP_ENABLE(symvers,yes,[=STYLE],
+ [enables symbol versioning of the shared library],
+ [permit yes|no|gnu])
+
+# If we never went through the LIBGOMP_CHECK_LINKER_FEATURES macro, then we
+# don't know enough about $LD to do tricks...
+AC_REQUIRE([LIBGOMP_CHECK_LINKER_FEATURES])
+# FIXME The following test is too strict, in theory.
+if test $enable_shared = no ||
+ test "x$LD" = x ||
+ test x$libgomp_gnu_ld_version = x; then
+ enable_symvers=no
+fi
+
+# Check to see if libgcc_s exists, indicating that shared libgcc is possible.
+if test $enable_symvers != no; then
+ AC_MSG_CHECKING([for shared libgcc])
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS=' -lgcc_s'
+ AC_TRY_LINK(, [return 0;], libgomp_shared_libgcc=yes, libgomp_shared_libgcc=no)
+ CFLAGS="$ac_save_CFLAGS"
+ if test $libgomp_shared_libgcc = no; then
+ cat > conftest.c <<EOF
+int main (void) { return 0; }
+EOF
+changequote(,)dnl
+ libgomp_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
+ -shared -shared-libgcc -o conftest.so \
+ conftest.c -v 2>&1 >/dev/null \
+ | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
+changequote([,])dnl
+ rm -f conftest.c conftest.so
+ if test x${libgomp_libgcc_s_suffix+set} = xset; then
+ CFLAGS=" -lgcc_s$libgomp_libgcc_s_suffix"
+ AC_TRY_LINK(, [return 0;], libgomp_shared_libgcc=yes)
+ CFLAGS="$ac_save_CFLAGS"
+ fi
+ fi
+ AC_MSG_RESULT($libgomp_shared_libgcc)
+fi
+
+# For GNU ld, we need at least this version. The format is described in
+# LIBGOMP_CHECK_LINKER_FEATURES above.
+libgomp_min_gnu_ld_version=21400
+# XXXXXXXXXXX libgomp_gnu_ld_version=21390
+
+# Check to see if unspecified "yes" value can win, given results above.
+# Change "yes" into either "no" or a style name.
+if test $enable_symvers = yes; then
+ if test $with_gnu_ld = yes &&
+ test $libgomp_shared_libgcc = yes;
+ then
+ if test $libgomp_gnu_ld_version -ge $libgomp_min_gnu_ld_version ; then
+ enable_symvers=gnu
+ else
+ # The right tools, the right setup, but too old. Fallbacks?
+ AC_MSG_WARN(=== Linker version $libgomp_gnu_ld_version is too old for)
+ AC_MSG_WARN(=== full symbol versioning support in this release of GCC.)
+ AC_MSG_WARN(=== You would need to upgrade your binutils to version)
+ AC_MSG_WARN(=== $libgomp_min_gnu_ld_version or later and rebuild GCC.)
+ if test $libgomp_gnu_ld_version -ge 21200 ; then
+ # Globbing fix is present, proper block support is not.
+ dnl AC_MSG_WARN([=== Dude, you are soooo close. Maybe we can fake it.])
+ dnl enable_symvers=???
+ AC_MSG_WARN([=== Symbol versioning will be disabled.])
+ enable_symvers=no
+ else
+ # 2.11 or older.
+ AC_MSG_WARN([=== Symbol versioning will be disabled.])
+ enable_symvers=no
+ fi
+ fi
+ else
+ # just fail for now
+ AC_MSG_WARN([=== You have requested some kind of symbol versioning, but])
+ AC_MSG_WARN([=== either you are not using a supported linker, or you are])
+ AC_MSG_WARN([=== not building a shared libgcc_s (which is required).])
+ AC_MSG_WARN([=== Symbol versioning will be disabled.])
+ enable_symvers=no
+ fi
+fi
+
+AM_CONDITIONAL(LIBGOMP_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
+AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
+])
--- /dev/null
+# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+ [AM_AUTOMAKE_VERSION([1.9.5])])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 7
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 12
+
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.58])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $1 | $1:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
+#
+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
+# created by `make install' are always world readable, even if the
+# installer happens to have an overly restrictive umask (e.g. 077).
+# This was a mistake. There are at least two reasons why we must not
+# use `-m 0755':
+# - it causes special bits like SGID to be ignored,
+# - it may be too restrictive (some setups expect 775 directories).
+#
+# Do not use -m 0755 and let people choose whatever they expect by
+# setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out. Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ # We used to keeping the `.' as first argument, in order to
+ # allow $(mkdir_p) to be used without argument. As in
+ # $(mkdir_p) $(somedir)
+ # where $(somedir) is conditionally defined. However this is wrong
+ # for two reasons:
+ # 1. if the package is installed by a user who cannot write `.'
+ # make install will fail,
+ # 2. the above comment should most certainly read
+ # $(mkdir_p) $(DESTDIR)$(somedir)
+ # so it does not work when $(somedir) is undefined and
+ # $(DESTDIR) is not.
+ # To support the latter case, we have to write
+ # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+ # so the `.' trick is pointless.
+ mkdir_p='mkdir -p --'
+else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ for d in ./-p ./--version;
+ do
+ test -d $d && rmdir $d
+ done
+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+ if test -f "$ac_aux_dir/mkinstalldirs"; then
+ mkdir_p='$(mkinstalldirs)'
+ else
+ mkdir_p='$(install_sh) -d'
+ fi
+fi
+AC_SUBST([mkdir_p])])
+
+# Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_ENABLE_MULTILIB([MAKEFILE], [REL-TO-TOP-SRCDIR])
+# ---------------------------------------------------
+# Add --enable-multilib to configure.
+AC_DEFUN([AM_ENABLE_MULTILIB],
+[# Default to --enable-multilib
+AC_ARG_ENABLE(multilib,
+[ --enable-multilib build many library versions (default)],
+[case "$enableval" in
+ yes) multilib=yes ;;
+ no) multilib=no ;;
+ *) AC_MSG_ERROR([bad value $enableval for multilib option]) ;;
+ esac],
+ [multilib=yes])
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+ if test "$with_target_subdir" != "."; then
+ multi_basedir="$srcdir/$with_multisrctop../$2"
+ else
+ multi_basedir="$srcdir/$with_multisrctop$2"
+ fi
+else
+ multi_basedir="$srcdir/$2"
+fi
+AC_SUBST(multi_basedir)
+
+AC_OUTPUT_COMMANDS([
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" ]m4_default([$1],Makefile)[ "*)
+ ac_file=]m4_default([$1],Makefile)[ . ${multi_basedir}/config-ml.in
+ ;;
+esac],
+ [
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"])])dnl
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+ [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+ [m4_case([$1], [ustar],, [pax],,
+ [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar;
+ do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([../config/depstand.m4])
+m4_include([../config/lead-dot.m4])
+m4_include([acinclude.m4])
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This file contains wrappers for the system allocation routines. Most
+ places in the OpenMP API do not make any provision for failure, so in
+ general we cannot allow memory allocation to fail. */
+
+#include "libgomp.h"
+#include <stdlib.h>
+
+
+void *
+gomp_malloc (size_t size)
+{
+ void *ret = malloc (size);
+ if (ret == NULL)
+ gomp_fatal ("Out of memory allocating %lu bytes", (unsigned long) size);
+ return ret;
+}
+
+void *
+gomp_malloc_cleared (size_t size)
+{
+ void *ret = calloc (1, size);
+ if (ret == NULL)
+ gomp_fatal ("Out of memory allocating %lu bytes", (unsigned long) size);
+ return ret;
+}
+
+void *
+gomp_realloc (void *old, size_t size)
+{
+ void *ret = realloc (old, size);
+ if (ret == NULL)
+ gomp_fatal ("Out of memory allocating %lu bytes", (unsigned long) size);
+ return ret;
+}
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This file handles the BARRIER construct. */
+
+#include "libgomp.h"
+
+
+void
+GOMP_barrier (void)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ struct gomp_team *team = thr->ts.team;
+
+ /* It is legal to have orphaned barriers. */
+ if (team == NULL)
+ return;
+
+ gomp_barrier_wait (&team->barrier);
+}
--- /dev/null
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if the target supports __attribute__((alias(...))). */
+#undef HAVE_ATTRIBUTE_ALIAS
+
+/* Define to 1 if the target supports __attribute__((dllexport)). */
+#undef HAVE_ATTRIBUTE_DLLEXPORT
+
+/* Define to 1 if the target supports __attribute__((visibility(...))). */
+#undef HAVE_ATTRIBUTE_VISIBILITY
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#undef HAVE_CLOCK_GETTIME
+
+/* Define to 1 if you have the `getloadavg' function. */
+#undef HAVE_GETLOADAVG
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <semaphore.h> header file. */
+#undef HAVE_SEMAPHORE_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if the target supports __sync_*_compare_and_swap */
+#undef HAVE_SYNC_BUILTINS
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if the target supports thread-local storage. */
+#undef HAVE_TLS
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Version number of package */
+#undef VERSION
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* Provide target-specific access to the futex system call. */
+
+#ifndef SYS_futex
+#define SYS_futex 394
+#endif
+#define FUTEX_WAIT 0
+#define FUTEX_WAKE 1
+
+
+static inline void
+futex_wait (int *addr, int val)
+{
+ register long sc_0 __asm__("$0");
+ register long sc_16 __asm__("$16");
+ register long sc_17 __asm__("$17");
+ register long sc_18 __asm__("$18");
+ register long sc_19 __asm__("$19");
+
+ sc_0 = SYS_futex;
+ sc_16 = (long) addr;
+ sc_17 = FUTEX_WAIT;
+ sc_18 = val;
+ sc_19 = 0;
+ __asm volatile ("callsys"
+ : "=r" (sc_0), "=r"(sc_19)
+ : "0"(sc_0), "r" (sc_16), "r"(sc_17), "r"(sc_18), "1"(sc_19)
+ : "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8",
+ "$22", "$23", "$24", "$25", "$27", "$28", "memory");
+}
+
+static inline void
+futex_wake (int *addr, int count)
+{
+ register long sc_0 __asm__("$0");
+ register long sc_16 __asm__("$16");
+ register long sc_17 __asm__("$17");
+ register long sc_18 __asm__("$18");
+ register long sc_19 __asm__("$19");
+
+ sc_0 = SYS_futex;
+ sc_16 = (long) addr;
+ sc_17 = FUTEX_WAKE;
+ sc_18 = count;
+ __asm volatile ("callsys"
+ : "=r" (sc_0), "=r"(sc_19)
+ : "0"(sc_0), "r" (sc_16), "r"(sc_17), "r"(sc_18)
+ : "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8",
+ "$22", "$23", "$24", "$25", "$27", "$28", "memory");
+}
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This is a Linux specific implementation of a barrier synchronization
+ mechanism for libgomp. This type is private to the library. This
+ implementation uses atomic instructions and the futex syscall. */
+
+#include "libgomp.h"
+#include "futex.h"
+#include <limits.h>
+
+
+void
+gomp_barrier_wait_end (gomp_barrier_t *bar, bool last)
+{
+ if (last)
+ {
+ bar->generation++;
+ futex_wake (&bar->generation, INT_MAX);
+ }
+ else
+ {
+ unsigned int generation = bar->generation;
+
+ gomp_mutex_unlock (&bar->mutex);
+
+ do
+ futex_wait (&bar->generation, generation);
+ while (bar->generation == generation);
+ }
+
+ if (__sync_add_and_fetch (&bar->arrived, -1) == 0)
+ gomp_mutex_unlock (&bar->mutex);
+}
+
+void
+gomp_barrier_wait (gomp_barrier_t *barrier)
+{
+ gomp_barrier_wait_end (barrier, gomp_barrier_wait_start (barrier));
+}
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This is a Linux specific implementation of a barrier synchronization
+ mechanism for libgomp. This type is private to the library. This
+ implementation uses atomic instructions and the futex syscall. */
+
+#ifndef GOMP_BARRIER_H
+#define GOMP_BARRIER_H 1
+
+#include "mutex.h"
+
+typedef struct
+{
+ gomp_mutex_t mutex;
+ unsigned total;
+ unsigned arrived;
+ int generation;
+} gomp_barrier_t;
+
+static inline void gomp_barrier_init (gomp_barrier_t *bar, unsigned count)
+{
+ gomp_mutex_init (&bar->mutex);
+ bar->total = count;
+ bar->arrived = 0;
+ bar->generation = 0;
+}
+
+static inline void gomp_barrier_reinit (gomp_barrier_t *bar, unsigned count)
+{
+ gomp_mutex_lock (&bar->mutex);
+ bar->total = count;
+ gomp_mutex_unlock (&bar->mutex);
+}
+
+static inline void gomp_barrier_destroy (gomp_barrier_t *bar)
+{
+ /* Before destroying, make sure all threads have left the barrier. */
+ gomp_mutex_lock (&bar->mutex);
+}
+
+extern void gomp_barrier_wait (gomp_barrier_t *);
+extern void gomp_barrier_wait_end (gomp_barrier_t *, bool);
+
+static inline bool gomp_barrier_wait_start (gomp_barrier_t *bar)
+{
+ gomp_mutex_lock (&bar->mutex);
+ return ++bar->arrived == bar->total;
+}
+
+#endif /* GOMP_BARRIER_H */
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* Provide target-specific access to the futex system call. */
+
+#include <sys/syscall.h>
+
+#define FUTEX_WAIT 0
+#define FUTEX_WAKE 1
+
+
+static inline void
+sys_futex0(int *addr, int op, int val)
+{
+ register long out0 asm ("out0") = (long) addr;
+ register long out1 asm ("out1") = op;
+ register long out2 asm ("out2") = val;
+ register long out3 asm ("out3") = 0;
+ register long r15 asm ("r15") = SYS_futex;
+
+ __asm __volatile ("break 0x100000"
+ : "=r"(r15), "=r"(out0), "=r"(out1), "=r"(out2), "=r"(out3)
+ : "r"(r15), "r"(out0), "r"(out1), "r"(out2), "r"(out3)
+ : "memory", "r8", "r10", "out4", "out5", "out6", "out7",
+ /* Non-stacked integer registers, minus r8, r10, r15. */
+ "r2", "r3", "r9", "r11", "r12", "r13", "r14", "r16", "r17", "r18",
+ "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27",
+ "r28", "r29", "r30", "r31",
+ /* Predicate registers. */
+ "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15",
+ /* Non-rotating fp registers. */
+ "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
+ /* Branch registers. */
+ "b6");
+}
+
+static inline void
+futex_wait (int *addr, int val)
+{
+ sys_futex0 (addr, FUTEX_WAIT, val);
+}
+
+static inline void
+futex_wake (int *addr, int count)
+{
+ sys_futex0 (addr, FUTEX_WAKE, count);
+}
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This is a Linux specific implementation of the public OpenMP locking
+ primitives. This implementation uses atomic instructions and the futex
+ syscall. */
+
+#include "libgomp.h"
+#include <string.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+#include "futex.h"
+
+
+/* The internal gomp_mutex_t and the external non-recursive omp_lock_t
+ have the same form. Re-use it. */
+
+void
+omp_init_lock (omp_lock_t *lock)
+{
+ gomp_mutex_init (lock);
+}
+
+void
+omp_destroy_lock (omp_lock_t *lock)
+{
+ gomp_mutex_destroy (lock);
+}
+
+void
+omp_set_lock (omp_lock_t *lock)
+{
+ gomp_mutex_lock (lock);
+}
+
+void
+omp_unset_lock (omp_lock_t *lock)
+{
+ gomp_mutex_unlock (lock);
+}
+
+int
+omp_test_lock (omp_lock_t *lock)
+{
+ return __sync_bool_compare_and_swap (lock, 0, 1);
+}
+
+/* The external recursive omp_nest_lock_t form requires additional work. */
+
+/* We need an integer to uniquely identify this thread. Most generally
+ this is the thread's TID, which ideally we'd get this straight from
+ the TLS block where glibc keeps it. Unfortunately, we can't get at
+ that directly.
+
+ If we don't support (or have disabled) TLS, one function call is as
+ good (or bad) as any other. Use the syscall all the time.
+
+ On an ILP32 system (defined here as not LP64), we can make do with
+ any thread-local pointer. Ideally we'd use the TLS base address,
+ since that requires the least amount of arithmetic, but that's not
+ always available directly. Make do with the gomp_thread pointer
+ since it's handy. */
+
+#if !defined (HAVE_TLS)
+static inline int gomp_tid (void)
+{
+ return syscall (SYS_gettid);
+}
+#elif !defined(__LP64__)
+static inline int gomp_tid (void)
+{
+ return (int) gomp_thread ();
+}
+#else
+static __thread int tid_cache;
+static inline int gomp_tid (void)
+{
+ int tid = tid_cache;
+ if (__builtin_expect (tid == 0, 0))
+ tid_cache = tid = syscall (SYS_gettid);
+ return tid;
+}
+#endif
+
+
+void
+omp_init_nest_lock (omp_nest_lock_t *lock)
+{
+ memset (lock, 0, sizeof (lock));
+}
+
+void
+omp_destroy_nest_lock (omp_nest_lock_t *lock)
+{
+}
+
+void
+omp_set_nest_lock (omp_nest_lock_t *lock)
+{
+ int otid, tid = gomp_tid ();
+
+ while (1)
+ {
+ otid = __sync_val_compare_and_swap (&lock->owner, 0, tid);
+ if (otid == 0)
+ {
+ lock->count = 1;
+ return;
+ }
+ if (otid == tid)
+ {
+ lock->count++;
+ return;
+ }
+
+ futex_wait (&lock->owner, otid);
+ }
+}
+
+void
+omp_unset_nest_lock (omp_nest_lock_t *lock)
+{
+ /* ??? Validate that we own the lock here. */
+
+ if (--lock->count == 0)
+ {
+ __sync_lock_release (&lock->owner);
+ futex_wake (&lock->owner, 1);
+ }
+}
+
+int
+omp_test_nest_lock (omp_nest_lock_t *lock)
+{
+ int otid, tid = gomp_tid ();
+
+ otid = __sync_val_compare_and_swap (&lock->owner, 0, tid);
+ if (otid == 0)
+ {
+ lock->count = 1;
+ return 1;
+ }
+ if (otid == tid)
+ return ++lock->count;
+
+ return 0;
+}
+
+ialias (omp_init_lock)
+ialias (omp_init_nest_lock)
+ialias (omp_destroy_lock)
+ialias (omp_destroy_nest_lock)
+ialias (omp_set_lock)
+ialias (omp_set_nest_lock)
+ialias (omp_unset_lock)
+ialias (omp_unset_nest_lock)
+ialias (omp_test_lock)
+ialias (omp_test_nest_lock)
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This is a Linux specific implementation of a mutex synchronization
+ mechanism for libgomp. This type is private to the library. This
+ implementation uses atomic instructions and the futex syscall. */
+
+#include "libgomp.h"
+#include "futex.h"
+
+
+void
+gomp_mutex_lock_slow (gomp_mutex_t *mutex)
+{
+ do
+ {
+ int oldval = __sync_val_compare_and_swap (mutex, 1, 2);
+ if (oldval != 0)
+ futex_wait (mutex, 2);
+ }
+ while (!__sync_bool_compare_and_swap (mutex, 0, 2));
+}
+
+void
+gomp_mutex_unlock_slow (gomp_mutex_t *mutex)
+{
+ futex_wake (mutex, 1);
+}
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This is a Linux specific implementation of a mutex synchronization
+ mechanism for libgomp. This type is private to the library. This
+ implementation uses atomic instructions and the futex syscall. */
+
+#ifndef GOMP_MUTEX_H
+#define GOMP_MUTEX_H 1
+
+typedef int gomp_mutex_t;
+
+#define GOMP_MUTEX_INIT_0 1
+
+static inline void gomp_mutex_init (gomp_mutex_t *mutex)
+{
+ *mutex = 0;
+}
+
+extern void gomp_mutex_lock_slow (gomp_mutex_t *mutex);
+static inline void gomp_mutex_lock (gomp_mutex_t *mutex)
+{
+ if (!__sync_bool_compare_and_swap (mutex, 0, 1))
+ gomp_mutex_lock_slow (mutex);
+}
+
+extern void gomp_mutex_unlock_slow (gomp_mutex_t *mutex);
+static inline void gomp_mutex_unlock (gomp_mutex_t *mutex)
+{
+ int val = __sync_lock_test_and_set (mutex, 0);
+ if (__builtin_expect (val > 1, 0))
+ gomp_mutex_unlock_slow (mutex);
+}
+
+static inline void gomp_mutex_destroy (gomp_mutex_t *mutex)
+{
+}
+
+#endif /* GOMP_MUTEX_H */
--- /dev/null
+/* This header is used during the build process to find the size and
+ alignment of the public OpenMP locks, so that we can export data
+ structures without polluting the namespace.
+
+ When using the Linux futex primitive, non-recursive locks require
+ only one int. Recursive locks require we identify the owning thread
+ and so require two ints. */
+
+typedef int omp_lock_t;
+typedef struct { int owner, count; } omp_nest_lock_t;
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* Provide target-specific access to the futex system call. */
+
+#include <sys/syscall.h>
+#define FUTEX_WAIT 0
+#define FUTEX_WAKE 1
+
+static inline void
+sys_futex0 (int *addr, int op, int val)
+{
+ register long int r0 __asm__ ("r0");
+ register long int r3 __asm__ ("r3");
+ register long int r4 __asm__ ("r4");
+ register long int r5 __asm__ ("r5");
+ register long int r6 __asm__ ("r6");
+
+ r0 = SYS_futex;
+ r3 = (long) addr;
+ r4 = op;
+ r5 = val;
+ r6 = 0;
+
+ /* ??? The powerpc64 sysdep.h file clobbers ctr; the powerpc32 sysdep.h
+ doesn't. It doesn't much matter for us. In the interest of unity,
+ go ahead and clobber it always. */
+
+ __asm volatile ("sc"
+ : "=r"(r0), "=r"(r3), "=r"(r4), "=r"(r5), "=r"(r6)
+ : "r"(r0), "r"(r3), "r"(r4), "r"(r5), "r"(r6)
+ : "r7", "r8", "r9", "r10", "r11", "r12",
+ "cr0", "ctr", "memory");
+}
+
+static inline void
+futex_wait (int *addr, int val)
+{
+ sys_futex0 (addr, FUTEX_WAIT, val);
+}
+
+static inline void
+futex_wake (int *addr, int count)
+{
+ sys_futex0 (addr, FUTEX_WAKE, count);
+}
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Jakub Jelinek <jakub@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* Provide target-specific access to the futex system call. */
+
+#include <sys/syscall.h>
+#define FUTEX_WAIT 0
+#define FUTEX_WAKE 1
+
+static inline void
+sys_futex0 (int *addr, int op, int val)
+{
+ register long int gpr2 __asm__ ("2");
+ register long int gpr3 __asm__ ("3");
+ register long int gpr4 __asm__ ("4");
+ register long int gpr5 __asm__ ("5");
+
+ gpr2 = (long) addr;
+ gpr3 = op;
+ gpr4 = val;
+ gpr5 = 0;
+
+ __asm volatile ("svc %b1"
+ : "=d" (gpr2)
+ : "i" (SYS_futex),
+ "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5)
+ : "memory");
+}
+
+static inline void
+futex_wait (int *addr, int val)
+{
+ sys_futex0 (addr, FUTEX_WAIT, val);
+}
+
+static inline void
+futex_wake (int *addr, int count)
+{
+ sys_futex0 (addr, FUTEX_WAKE, count);
+}
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This is a Linux specific implementation of a semaphore synchronization
+ mechanism for libgomp. This type is private to the library. This
+ implementation uses atomic instructions and the futex syscall. */
+
+#include "libgomp.h"
+#include "futex.h"
+
+
+void
+gomp_sem_wait_slow (gomp_sem_t *sem)
+{
+ while (1)
+ {
+ int val = __sync_val_compare_and_swap (sem, 0, -1);
+ if (val > 0)
+ {
+ if (__sync_bool_compare_and_swap (sem, val, val - 1))
+ return;
+ }
+ futex_wait (sem, -1);
+ }
+}
+
+void
+gomp_sem_post_slow (gomp_sem_t *sem)
+{
+ int old, tmp = *sem, wake;
+
+ do
+ {
+ old = tmp;
+ wake = old > 0 ? old + 1 : 1;
+ tmp = __sync_val_compare_and_swap (sem, old, wake);
+ }
+ while (old != tmp);
+
+ futex_wake (sem, wake);
+}
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This is a Linux specific implementation of a semaphore synchronization
+ mechanism for libgomp. This type is private to the library. This
+ implementation uses atomic instructions and the futex syscall. */
+
+#ifndef GOMP_SEM_H
+#define GOMP_SEM_H 1
+
+typedef int gomp_sem_t;
+
+static inline void gomp_sem_init (gomp_sem_t *sem, int value)
+{
+ *sem = value;
+}
+
+extern void gomp_sem_wait_slow (gomp_sem_t *);
+static inline void gomp_sem_wait (gomp_sem_t *sem)
+{
+ if (!__sync_bool_compare_and_swap (sem, 1, 0))
+ gomp_sem_wait_slow (sem);
+}
+
+extern void gomp_sem_post_slow (gomp_sem_t *);
+static inline void gomp_sem_post (gomp_sem_t *sem)
+{
+ if (!__sync_bool_compare_and_swap (sem, 0, 1))
+ gomp_sem_post_slow (sem);
+}
+
+static inline void gomp_sem_destroy (gomp_sem_t *sem)
+{
+}
+
+#endif /* GOMP_SEM_H */
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Jakub Jelinek <jakub@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* Provide target-specific access to the futex system call. */
+
+#include <sys/syscall.h>
+#define FUTEX_WAIT 0
+#define FUTEX_WAKE 1
+
+static inline void
+sys_futex0 (int *addr, int op, int val)
+{
+ register long int g1 __asm__ ("g1");
+ register long int o0 __asm__ ("o0");
+ register long int o1 __asm__ ("o1");
+ register long int o2 __asm__ ("o2");
+ register long int o3 __asm__ ("o3");
+
+ g1 = SYS_futex;
+ o0 = (long) addr;
+ o1 = op;
+ o2 = val;
+ o3 = 0;
+
+#ifdef __arch64__
+# define SYSCALL_STRING "ta\t0x6d"
+#else
+# define SYSCALL_STRING "ta\t0x10"
+#endif
+
+ __asm volatile (SYSCALL_STRING
+ : "=r" (g1), "=r" (o0)
+ : "0" (g1), "1" (o0), "r" (o1), "r" (o2), "r" (o3)
+ : "g2", "g3", "g4", "g5", "g6",
+ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
+ "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
+ "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
+ "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",
+#ifdef __arch64__
+ "f32", "f34", "f36", "f38", "f40", "f42", "f44", "f46",
+ "f48", "f50", "f52", "f54", "f56", "f58", "f60", "f62",
+#endif
+ "cc", "memory");
+}
+
+static inline void
+futex_wait (int *addr, int val)
+{
+ sys_futex0 (addr, FUTEX_WAIT, val);
+}
+
+static inline void
+futex_wake (int *addr, int count)
+{
+ sys_futex0 (addr, FUTEX_WAKE, count);
+}
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* Provide target-specific access to the futex system call. */
+
+#define FUTEX_WAIT 0
+#define FUTEX_WAKE 1
+
+#ifdef __LP64__
+# ifndef SYS_futex
+# define SYS_futex 202
+# endif
+
+static inline void
+futex_wait (int *addr, int val)
+{
+ register long r10 __asm__("%r10") = 0;
+ long res;
+
+ __asm volatile ("syscall"
+ : "=a" (res)
+ : "0"(SYS_futex), "D" (addr), "S"(FUTEX_WAIT),
+ "d"(val), "r"(r10)
+ : "r11", "rcx", "memory");
+}
+
+static inline void
+futex_wake (int *addr, int count)
+{
+ long res;
+
+ __asm volatile ("syscall"
+ : "=a" (res)
+ : "0"(SYS_futex), "D" (addr), "S"(FUTEX_WAKE), "d"(count)
+ : "r11", "rcx", "memory");
+}
+#else
+# ifndef SYS_futex
+# define SYS_futex 240
+# endif
+
+# ifdef __PIC__
+
+static inline void
+sys_futex0 (int *addr, int op, int val)
+{
+ long res;
+
+ __asm volatile ("xchgl\t%%ebx, %2\n\t"
+ "int\t$0x80\n\t"
+ "xchgl\t%%ebx, %2"
+ : "=a" (res)
+ : "0"(SYS_futex), "r" (addr), "c"(op),
+ "d"(val), "S"(0)
+ : "memory");
+}
+
+# else
+
+static inline void
+sys_futex0 (int *addr, int op, int val)
+{
+ long res;
+
+ __asm volatile ("int $0x80"
+ : "=a" (res)
+ : "0"(SYS_futex), "b" (addr), "c"(op),
+ "d"(val), "S"(0)
+ : "memory");
+}
+
+# endif /* __PIC__ */
+
+static inline void
+futex_wait (int *addr, int val)
+{
+ sys_futex0 (addr, FUTEX_WAIT, val);
+}
+
+static inline void
+futex_wake (int *addr, int count)
+{
+ sys_futex0 (addr, FUTEX_WAKE, count);
+}
+
+#endif /* __LP64__ */
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This is the default implementation of a barrier synchronization mechanism
+ for libgomp. This type is private to the library. Note that we rely on
+ being able to adjust the barrier count while threads are blocked, so the
+ POSIX pthread_barrier_t won't work. */
+
+#include "libgomp.h"
+
+
+void
+gomp_barrier_init (gomp_barrier_t *bar, unsigned count)
+{
+ gomp_mutex_init (&bar->mutex1);
+#ifndef HAVE_SYNC_BUILTINS
+ gomp_mutex_init (&bar->mutex2);
+#endif
+ gomp_sem_init (&bar->sem1, 0);
+ gomp_sem_init (&bar->sem2, 0);
+ bar->total = count;
+ bar->arrived = 0;
+}
+
+void
+gomp_barrier_destroy (gomp_barrier_t *bar)
+{
+ /* Before destroying, make sure all threads have left the barrier. */
+ gomp_mutex_lock (&bar->mutex1);
+ gomp_mutex_unlock (&bar->mutex1);
+
+ gomp_mutex_destroy (&bar->mutex1);
+#ifndef HAVE_SYNC_BUILTINS
+ gomp_mutex_destroy (&bar->mutex2);
+#endif
+ gomp_sem_destroy (&bar->sem1);
+ gomp_sem_destroy (&bar->sem2);
+}
+
+void
+gomp_barrier_reinit (gomp_barrier_t *bar, unsigned count)
+{
+ gomp_mutex_lock (&bar->mutex1);
+ bar->total = count;
+ gomp_mutex_unlock (&bar->mutex1);
+}
+
+void
+gomp_barrier_wait_end (gomp_barrier_t *bar, bool last)
+{
+ unsigned int n;
+
+ if (last)
+ {
+ n = --bar->arrived;
+ if (n > 0)
+ {
+ do
+ gomp_sem_post (&bar->sem1);
+ while (--n != 0);
+ gomp_sem_wait (&bar->sem2);
+ }
+ gomp_mutex_unlock (&bar->mutex1);
+ }
+ else
+ {
+ gomp_mutex_unlock (&bar->mutex1);
+ gomp_sem_wait (&bar->sem1);
+
+#ifdef HAVE_SYNC_BUILTINS
+ n = __sync_add_and_fetch (&bar->arrived, -1);
+#else
+ gomp_mutex_lock (&bar->mutex2);
+ n = --bar->arrived;
+ gomp_mutex_unlock (&bar->mutex2);
+#endif
+
+ if (n == 0)
+ gomp_sem_post (&bar->sem2);
+ }
+}
+
+void
+gomp_barrier_wait (gomp_barrier_t *barrier)
+{
+ gomp_barrier_wait_end (barrier, gomp_barrier_wait_start (barrier));
+}
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This is the default implementation of a barrier synchronization mechanism
+ for libgomp. This type is private to the library. Note that we rely on
+ being able to adjust the barrier count while threads are blocked, so the
+ POSIX pthread_barrier_t won't work. */
+
+#ifndef GOMP_BARRIER_H
+#define GOMP_BARRIER_H 1
+
+#include <pthread.h>
+
+typedef struct
+{
+ gomp_mutex_t mutex1;
+#ifndef HAVE_SYNC_BUILTINS
+ gomp_mutex_t mutex2;
+#endif
+ gomp_sem_t sem1;
+ gomp_sem_t sem2;
+ unsigned total;
+ unsigned arrived;
+} gomp_barrier_t;
+
+extern void gomp_barrier_init (gomp_barrier_t *, unsigned);
+extern void gomp_barrier_reinit (gomp_barrier_t *, unsigned);
+extern void gomp_barrier_destroy (gomp_barrier_t *);
+
+extern void gomp_barrier_wait (gomp_barrier_t *);
+extern void gomp_barrier_wait_end (gomp_barrier_t *, bool);
+
+static inline bool gomp_barrier_wait_start (gomp_barrier_t *bar)
+{
+ gomp_mutex_lock (&bar->mutex1);
+ return ++bar->arrived == bar->total;
+}
+
+#endif /* GOMP_BARRIER_H */
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This is the default PTHREADS implementation of the public OpenMP
+ locking primitives.
+
+ Because OpenMP uses different entry points for normal and recursive
+ locks, and pthreads uses only one entry point, a system may be able
+ to do better and streamline the locking as well as reduce the size
+ of the types exported. */
+
+/* We need Unix98 extensions to get recursive locks. */
+#define _XOPEN_SOURCE 500
+
+#include "libgomp.h"
+
+
+void
+omp_init_lock (omp_lock_t *lock)
+{
+ pthread_mutex_init (lock, NULL);
+}
+
+void
+omp_destroy_lock (omp_lock_t *lock)
+{
+ pthread_mutex_destroy (lock);
+}
+
+void
+omp_set_lock (omp_lock_t *lock)
+{
+ pthread_mutex_lock (lock);
+}
+
+void
+omp_unset_lock (omp_lock_t *lock)
+{
+ pthread_mutex_unlock (lock);
+}
+
+int
+omp_test_lock (omp_lock_t *lock)
+{
+ return pthread_mutex_trylock (lock) == 0;
+}
+
+void
+omp_init_nest_lock (omp_nest_lock_t *lock)
+{
+ pthread_mutexattr_t attr;
+
+ pthread_mutexattr_init (&attr);
+ pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init (&lock->lock, &attr);
+ lock->count = 0;
+ pthread_mutexattr_destroy (&attr);
+}
+
+void
+omp_destroy_nest_lock (omp_nest_lock_t *lock)
+{
+ pthread_mutex_destroy (&lock->lock);
+}
+
+void
+omp_set_nest_lock (omp_nest_lock_t *lock)
+{
+ pthread_mutex_lock (&lock->lock);
+ lock->count++;
+}
+
+void
+omp_unset_nest_lock (omp_nest_lock_t *lock)
+{
+ lock->count--;
+ pthread_mutex_unlock (&lock->lock);
+}
+
+int
+omp_test_nest_lock (omp_nest_lock_t *lock)
+{
+ if (pthread_mutex_trylock (&lock->lock) == 0)
+ return ++lock->count;
+ return 0;
+}
+
+ialias (omp_init_lock)
+ialias (omp_init_nest_lock)
+ialias (omp_destroy_lock)
+ialias (omp_destroy_nest_lock)
+ialias (omp_set_lock)
+ialias (omp_set_nest_lock)
+ialias (omp_unset_lock)
+ialias (omp_unset_nest_lock)
+ialias (omp_test_lock)
+ialias (omp_test_nest_lock)
--- /dev/null
+/* Everything is in the header. */
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This is the default PTHREADS implementation of a mutex synchronization
+ mechanism for libgomp. This type is private to the library. */
+
+#ifndef GOMP_MUTEX_H
+#define GOMP_MUTEX_H 1
+
+#include <pthread.h>
+
+typedef pthread_mutex_t gomp_mutex_t;
+
+#define GOMP_MUTEX_INIT_0 0
+
+static inline void gomp_mutex_init (gomp_mutex_t *mutex)
+{
+ pthread_mutex_init (mutex, NULL);
+}
+
+static inline void gomp_mutex_lock (gomp_mutex_t *mutex)
+{
+ pthread_mutex_lock (mutex);
+}
+
+static inline void gomp_mutex_unlock (gomp_mutex_t *mutex)
+{
+ pthread_mutex_unlock (mutex);
+}
+
+static inline void gomp_mutex_destroy (gomp_mutex_t *mutex)
+{
+ pthread_mutex_destroy (mutex);
+}
+
+#endif /* GOMP_MUTEX_H */
--- /dev/null
+/* This header is used during the build process to find the size and
+ alignment of the public OpenMP locks, so that we can export data
+ structures without polluting the namespace.
+
+ In this default POSIX implementation, we map the two locks to the
+ same PTHREADS primitive. */
+
+#include <pthread.h>
+
+typedef pthread_mutex_t omp_lock_t;
+typedef struct { pthread_mutex_t lock; int count; } omp_nest_lock_t;
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This file contains system specific routines related to counting
+ online processors and dynamic load balancing. It is expected that
+ a system may well want to write special versions of each of these.
+
+ The following implementation uses a mix of POSIX and BSD routines. */
+
+#include "libgomp.h"
+#include <unistd.h>
+#include <stdlib.h>
+
+
+/* At startup, determine the default number of threads. It would seem
+ this should be related to the number of cpus online. */
+
+void
+gomp_init_num_threads (void)
+{
+#ifdef _SC_NPROCESSORS_ONLN
+ gomp_nthreads_var = sysconf (_SC_NPROCESSORS_ONLN);
+#endif
+}
+
+/* When OMP_DYNAMIC is set, at thread launch determine the number of
+ threads we should spawn for this team. */
+/* ??? I have no idea what best practice for this is. Surely some
+ function of the number of processors that are *still* online and
+ the load average. Here I use the number of processors online
+ minus the 15 minute load average. */
+
+unsigned
+gomp_dynamic_max_threads (void)
+{
+ unsigned n_onln, loadavg;
+
+#ifdef _SC_NPROCESSORS_ONLN
+ n_onln = sysconf (_SC_NPROCESSORS_ONLN);
+ if (n_onln > gomp_nthreads_var)
+ n_onln = gomp_nthreads_var;
+#else
+ n_onln = gomp_nthreads_var;
+#endif
+
+ loadavg = 0;
+#ifdef HAVE_GETLOADAVG
+ {
+ double dloadavg[3];
+ if (getloadavg (dloadavg, 3) == 3)
+ {
+ /* Add 0.1 to get a kind of biased rounding. */
+ loadavg = dloadavg[2] + 0.1;
+ }
+ }
+#endif
+
+ if (loadavg >= n_onln)
+ return 1;
+ else
+ return n_onln - loadavg;
+}
+
+int
+omp_get_num_procs (void)
+{
+#ifdef _SC_NPROCESSORS_ONLN
+ return sysconf (_SC_NPROCESSORS_ONLN);
+#else
+ return gomp_nthreads_var;
+#endif
+}
+
+ialias (omp_get_num_procs)
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This is the default POSIX 1003.1b implementation of a semaphore
+ synchronization mechanism for libgomp. This type is private to
+ the library.
+
+ This is a bit heavy weight for what we need, in that we're not
+ interested in sem_wait as a cancelation point, but it's not too
+ bad for a default. */
+
+#include "libgomp.h"
+
+
+void
+gomp_sem_wait (gomp_sem_t *sem)
+{
+ /* With POSIX, the wait can be canceled by signals. We don't want that.
+ It is expected that the return value here is -1 and errno is EINTR. */
+ while (sem_wait (sem) != 0)
+ continue;
+}
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This is the default POSIX 1003.1b implementation of a semaphore
+ synchronization mechanism for libgomp. This type is private to
+ the library.
+
+ This is a bit heavy weight for what we need, in that we're not
+ interested in sem_wait as a cancelation point, but it's not too
+ bad for a default. */
+
+#ifndef GOMP_SEM_H
+#define GOMP_SEM_H 1
+
+#ifdef HAVE_ATTRIBUTE_VISIBILITY
+# pragma GCC visibility push(default)
+#endif
+
+#include <semaphore.h>
+
+#ifdef HAVE_ATTRIBUTE_VISIBILITY
+# pragma GCC visibility pop
+#endif
+
+typedef sem_t gomp_sem_t;
+
+static inline void gomp_sem_init (gomp_sem_t *sem, int value)
+{
+ sem_init (sem, 0, value);
+}
+
+extern void gomp_sem_wait (gomp_sem_t *sem);
+
+static inline void gomp_sem_post (gomp_sem_t *sem)
+{
+ sem_post (sem);
+}
+
+static inline void gomp_sem_destroy (gomp_sem_t *sem)
+{
+ sem_destroy (sem);
+}
+
+#endif /* GOMP_SEM_H */
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This file contains system specific timer routines. It is expected that
+ a system may well want to write special versions of each of these.
+
+ The following implementation uses the most simple POSIX routines.
+ If present, POSIX 4 clocks should be used instead. */
+
+#include "libgomp.h"
+#include <unistd.h>
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+
+double
+omp_get_wtime (void)
+{
+#ifdef HAVE_CLOCK_GETTIME
+ struct timespec ts;
+# ifdef CLOCK_MONOTONIC
+ if (clock_gettime (CLOCK_MONOTONIC, &ts) < 0)
+# endif
+ clock_gettime (CLOCK_REALTIME, &ts);
+ return ts.tv_sec + ts.tv_nsec / 1e9;
+#else
+ struct timeval tv;
+ gettimeofday (&tv, NULL);
+ return tv.tv_sec + tv.tv_usec / 1e6;
+#endif
+}
+
+double
+omp_get_wtick (void)
+{
+#ifdef HAVE_CLOCK_GETTIME
+ struct timespec ts;
+# ifdef CLOCK_MONOTONIC
+ if (clock_getres (CLOCK_MONOTONIC, &ts) < 0)
+# endif
+ clock_getres (CLOCK_REALTIME, &ts);
+ return ts.tv_sec + ts.tv_nsec / 1e9;
+#else
+ return 1.0 / sysconf(_SC_CLK_TCK);
+#endif
+}
+
+ialias (omp_get_wtime)
+ialias (omp_get_wtick)
--- /dev/null
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.59 for GNU OpenMP Runtime Library 1.0.
+#
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete. It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME='GNU OpenMP Runtime Library'
+PACKAGE_TARNAME='libgomp'
+PACKAGE_VERSION='1.0'
+PACKAGE_STRING='GNU OpenMP Runtime Library 1.0'
+PACKAGE_BUGREPORT=''
+
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar multi_basedir toolexecdir toolexeclibdir CC ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CFLAGS AR ac_ct_AR RANLIB ac_ct_RANLIB PERL LN_S LIBTOOL enable_shared enable_static FC FCFLAGS LDFLAGS ac_ct_FC libtool_VERSION CPP CPPFLAGS EGREP SECTION_LDFLAGS OPT_LDFLAGS LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE LIBGOMP_BUILD_VERSIONED_SHLIB_FALSE config_path XCFLAGS XLDFLAGS link_gomp USE_FORTRAN_TRUE USE_FORTRAN_FALSE LIBOBJS LTLIBOBJS'
+ac_subst_files=''
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+ac_prev=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_option in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval "enable_$ac_feature=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_$ac_feature='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_$ac_package='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/-/_/g'`
+ eval "with_$ac_package=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+ localstatedir libdir includedir oldincludedir infodir mandir
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+ { (exit 1); exit 1; }; }
+ else
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
+ fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+ { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_FC_set=${FC+set}
+ac_env_FC_value=$FC
+ac_cv_env_FC_set=${FC+set}
+ac_cv_env_FC_value=$FC
+ac_env_FCFLAGS_set=${FCFLAGS+set}
+ac_env_FCFLAGS_value=$FCFLAGS
+ac_cv_env_FCFLAGS_set=${FCFLAGS+set}
+ac_cv_env_FCFLAGS_value=$FCFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures GNU OpenMP Runtime Library 1.0 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+ cat <<_ACEOF
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --infodir=DIR info documentation [PREFIX/info]
+ --mandir=DIR man documentation [PREFIX/man]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+ --target=TARGET configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of GNU OpenMP Runtime Library 1.0:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-version-specific-runtime-libs
+ Specify that runtime libraries should be installed
+ in a compiler-specific directory [default=no]
+ _g_switchUse the Linux futex system call
+ permit yes|no [default=yes]
+ --enable-multilib build many library versions (default)
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+ --enable-shared=PKGS build shared libraries default=yes
+ --enable-static=PKGS build static libraries default=yes
+ --enable-fast-install=PKGS optimize for fast installation default=yes
+ --disable-libtool-lock avoid locking (might break parallel builds)
+ _g_switchUse thread-local storage
+ [default=yes]
+ --enable-symvers=STYLE enables symbol versioning of the shared library
+ [default=yes]
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-gnu-ld assume the C compiler uses GNU ld default=no
+ --with-pic try to use only PIC/non-PIC objects default=use both
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
+ headers in a nonstandard directory <include dir>
+ FC Fortran compiler command
+ FCFLAGS Fortran compiler flags
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ ac_popdir=`pwd`
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d $ac_dir || continue
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+ cd $ac_dir
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f $ac_srcdir/configure.gnu; then
+ echo
+ $SHELL $ac_srcdir/configure.gnu --help=recursive
+ elif test -f $ac_srcdir/configure; then
+ echo
+ $SHELL $ac_srcdir/configure --help=recursive
+ elif test -f $ac_srcdir/configure.ac ||
+ test -f $ac_srcdir/configure.in; then
+ echo
+ $ac_configure --help
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi
+ cd $ac_popdir
+ done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+ cat <<\_ACEOF
+GNU OpenMP Runtime Library configure 1.0
+generated by GNU Autoconf 2.59
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by GNU OpenMP Runtime Library $as_me 1.0, which was
+generated by GNU Autoconf 2.59. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+ # Get rid of the leading space.
+ ac_sep=" "
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+{
+ (set) 2>&1 |
+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ sed -n \
+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+ ;;
+ *)
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+}
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ sed "/^$/d" confdefs.h | sort
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core &&
+ rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+ ' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . $cache_file;;
+ *) . ./$cache_file;;
+ esac
+ fi
+else
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+ eval ac_new_val="\$ac_env_${ac_var}_value"
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ac_config_headers="$ac_config_headers config.h"
+
+
+# -------
+# Options
+# -------
+
+echo "$as_me:$LINENO: checking for --enable-version-specific-runtime-libs" >&5
+echo $ECHO_N "checking for --enable-version-specific-runtime-libs... $ECHO_C" >&6
+ # Check whether --enable-version-specific-runtime-libs or --disable-version-specific-runtime-libs was given.
+if test "${enable_version_specific_runtime_libs+set}" = set; then
+ enableval="$enable_version_specific_runtime_libs"
+
+ case "$enableval" in
+ yes|no) ;;
+ *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable version-specific-runtime-libs" >&5
+echo "$as_me: error: Unknown argument to enable/disable version-specific-runtime-libs" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+
+else
+ enable_version_specific_runtime_libs=no
+fi;
+
+echo "$as_me:$LINENO: result: $enable_version_specific_runtime_libs" >&5
+echo "${ECHO_T}$enable_version_specific_runtime_libs" >&6
+
+echo "$as_me:$LINENO: checking for --enable-linux-futex" >&5
+echo $ECHO_N "checking for --enable-linux-futex... $ECHO_C" >&6
+ # Check whether --enable-linux-futex or --disable-linux-futex was given.
+if test "${enable_linux_futex+set}" = set; then
+ enableval="$enable_linux_futex"
+
+ case "$enableval" in
+ yes|no) ;;
+ *) { { echo "$as_me:$LINENO: error: Argument to enable/disable linux-futex must be yes or no" >&5
+echo "$as_me: error: Argument to enable/disable linux-futex must be yes or no" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+
+else
+ enable_linux_futex=yes
+fi;
+
+echo "$as_me:$LINENO: result: $enable_linux_futex" >&5
+echo "${ECHO_T}$enable_linux_futex" >&6
+
+# -------
+# -------
+
+# Gets build, host, target, *_vendor, *_cpu, *_os, etc.
+#
+# You will slowly go insane if you do not grok the following fact: when
+# building this library, the top-level /target/ becomes the library's /host/.
+#
+# configure then causes --target to default to --host, exactly like any
+# other package using autoconf. Therefore, 'target' and 'host' will
+# always be the same. This makes sense both for native and cross compilers
+# just think about it for a little while. :-)
+#
+# Also, if this library is being configured as part of a cross compiler, the
+# top-level configure script will pass the "real" host as $with_cross_host.
+#
+# Do not delete or change the following two lines. For why, see
+# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f $ac_dir/shtool; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+# Make sure we can run config.sub.
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+ { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+ { (exit 1); exit 1; }; }
+
+echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
+if test "${ac_cv_build+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+ ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
+ { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+ { (exit 1); exit 1; }; }
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+ { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
+build=$ac_cv_build
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
+if test "${ac_cv_host+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+ ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+ { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
+host=$ac_cv_host
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking target system type" >&5
+echo $ECHO_N "checking target system type... $ECHO_C" >&6
+if test "${ac_cv_target+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_target_alias=$target_alias
+test "x$ac_cv_target_alias" = "x" &&
+ ac_cv_target_alias=$ac_cv_host_alias
+ac_cv_target=`$ac_config_sub $ac_cv_target_alias` ||
+ { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_target" >&5
+echo "${ECHO_T}$ac_cv_target" >&6
+target=$ac_cv_target
+target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+target_alias=${target_alias-$host_alias}
+
+# Sets up automake. Must come after AC_CANONICAL_SYSTEM. Each of the
+# following is magically included in AUTOMAKE_OPTIONS in each Makefile.am.
+# 1.9.0: minimum required version
+# no-define: PACKAGE and VERSION will not be #define'd in config.h (a bunch
+# of other PACKAGE_* variables will, however, and there's nothing
+# we can do about that; they come from AC_INIT).
+# foreign: we don't follow the normal rules for GNU packages (no COPYING
+# file in the top srcdir, etc, etc), so stop complaining.
+# no-dependencies: turns off auto dependency generation (just for now)
+# -Wall: turns on all automake warnings...
+# -Wno-portability: ...except this one, since GNU make is required.
+# -Wno-override: ... and this one, since we do want this in testsuite.
+am__api_version="1.9"
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+done
+
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL=$ac_install_sh
+ fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+test "$program_prefix" != NONE &&
+ program_transform_name="s,^,$program_prefix,;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s,\$,$program_suffix,;$program_transform_name"
+# Double any \ or $. echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm conftest.sed
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ # We used to keeping the `.' as first argument, in order to
+ # allow $(mkdir_p) to be used without argument. As in
+ # $(mkdir_p) $(somedir)
+ # where $(somedir) is conditionally defined. However this is wrong
+ # for two reasons:
+ # 1. if the package is installed by a user who cannot write `.'
+ # make install will fail,
+ # 2. the above comment should most certainly read
+ # $(mkdir_p) $(DESTDIR)$(somedir)
+ # so it does not work when $(somedir) is undefined and
+ # $(DESTDIR) is not.
+ # To support the latter case, we have to write
+ # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+ # so the `.' trick is pointless.
+ mkdir_p='mkdir -p --'
+else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ for d in ./-p ./--version;
+ do
+ test -d $d && rmdir $d
+ done
+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+ if test -f "$ac_aux_dir/mkinstalldirs"; then
+ mkdir_p='$(mkinstalldirs)'
+ else
+ mkdir_p='$(install_sh) -d'
+ fi
+fi
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AWK+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AWK="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$AWK" && break
+done
+
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.make <<\_ACEOF
+all:
+ @echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftest.make
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ SET_MAKE=
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='libgomp'
+ VERSION='1.0'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ STRIP=$ac_ct_STRIP
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+# Default to --enable-multilib
+# Check whether --enable-multilib or --disable-multilib was given.
+if test "${enable_multilib+set}" = set; then
+ enableval="$enable_multilib"
+ case "$enableval" in
+ yes) multilib=yes ;;
+ no) multilib=no ;;
+ *) { { echo "$as_me:$LINENO: error: bad value $enableval for multilib option" >&5
+echo "$as_me: error: bad value $enableval for multilib option" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+else
+ multilib=yes
+fi;
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+ if test "$with_target_subdir" != "."; then
+ multi_basedir="$srcdir/$with_multisrctop../.."
+ else
+ multi_basedir="$srcdir/$with_multisrctop.."
+ fi
+else
+ multi_basedir="$srcdir/.."
+fi
+
+
+ ac_config_commands="$ac_config_commands default-1"
+
+
+# Calculate toolexeclibdir
+# Also toolexecdir, though it's only used in toolexeclibdir
+case ${enable_version_specific_runtime_libs} in
+ yes)
+ # Need the gcc compiler version to know where to install libraries
+ # and header files if --enable-version-specific-runtime-libs option
+ # is selected.
+ toolexecdir='$(libdir)/gcc/$(target_alias)'
+ toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
+ ;;
+ no)
+ if test -n "$with_cross_host" &&
+ test x"$with_cross_host" != x"no"; then
+ # Install a library built with a cross compiler in tooldir, not libdir.
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+ toolexeclibdir='$(toolexecdir)/lib'
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+ toolexeclibdir='$(libdir)'
+ fi
+ multi_os_directory=`$CC -print-multi-os-directory`
+ case $multi_os_directory in
+ .) ;; # Avoid trailing /.
+ *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
+ esac
+ ;;
+esac
+
+
+
+# Check the compiler.
+# The same as in boehm-gc and libstdc++. Have to borrow it from there.
+# We must force CC to /not/ be precious variables; otherwise
+# the wrong, non-multilib-adjusted value will be used in multilibs.
+# As a side effect, we have to subst CFLAGS ourselves.
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$ac_ct_CC" && break
+done
+
+ CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+ "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+ ;;
+ conftest.$ac_ext )
+ # This is the source file.
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool,
+ # but it would be cool to find out if it's true. Does anybody
+ # maintain Libtool? --akim.
+ export ac_cv_exeext
+ break;;
+ * )
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std1 is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std1. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ '' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+ ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+
+
+echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+ enableval="$enable_dependency_tracking"
+
+fi;
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+
+
+if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+
+depcc="$CC" am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+
+
+
+
+# In order to override CFLAGS_FOR_TARGET, all of our special flags go
+# in XCFLAGS. But we need them in CFLAGS during configury. So put them
+# in both places for now and restore CFLAGS at the end of config.
+save_CFLAGS="$CFLAGS"
+
+# Add -Wall -Werror if we are using GCC.
+if test "x$GCC" = "xyes"; then
+ XCFLAGS="$XCFLAGS -Wall -Werror"
+fi
+
+# Find other programs we need.
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_AR="ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ AR=$ac_ct_AR
+else
+ AR="$ac_cv_prog_AR"
+fi
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB="ranlib-not-found-in-path-error"
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ RANLIB=$ac_ct_RANLIB
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+# Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_PERL+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $PERL in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_path_PERL" && ac_cv_path_PERL="perl-not-found-in-path-error"
+ ;;
+esac
+fi
+PERL=$ac_cv_path_PERL
+
+if test -n "$PERL"; then
+ echo "$as_me:$LINENO: result: $PERL" >&5
+echo "${ECHO_T}$PERL" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.make <<\_ACEOF
+all:
+ @echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftest.make
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ SET_MAKE=
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+done
+
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL=$ac_install_sh
+ fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+# Configure libtool
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_shared=yes
+fi;
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+ enableval="$enable_static"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_static=yes
+fi;
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+ enableval="$enable_fast_install"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_fast_install=yes
+fi;
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+ withval="$with_gnu_ld"
+ test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi;
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ echo "$as_me:$LINENO: checking for ld used by GCC" >&5
+echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
+else
+ echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+ { (exit 1); exit 1; }; }
+echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ lt_cv_prog_gnu_ld=yes
+else
+ lt_cv_prog_gnu_ld=no
+fi
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6
+if test "${lt_cv_ld_reload_flag+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_ld_reload_flag='-r'
+fi
+echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6
+reload_flag=$lt_cv_ld_reload_flag
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+
+echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
+echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6
+if test "${lt_cv_path_NM+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm=$ac_dir/${ac_tool_prefix}nm
+ if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ else
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi
+fi
+
+NM="$lt_cv_path_NM"
+echo "$as_me:$LINENO: result: $NM" >&5
+echo "${ECHO_T}$NM" >&6
+
+echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+ echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6
+fi
+
+echo "$as_me:$LINENO: checking how to recognise dependant libraries" >&5
+echo $ECHO_N "checking how to recognise dependant libraries... $ECHO_C" >&6
+if test "${lt_cv_deplibs_check_method+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [regex]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi4*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin* | mingw* |pw32*)
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ # this will be overwritten by pass_all, but leave it in just in case
+ lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ case "$host_os" in
+ rhapsody* | darwin1.012)
+ lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System'
+ ;;
+ *) # Darwin 1.3 on
+ lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
+ ;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | kfreebsd*-gnu)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20*|hpux11*)
+ case $host_cpu in
+ hppa*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ esac
+ ;;
+
+irix5* | irix6*)
+ case $host_os in
+ irix5*)
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+ ;;
+ *)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"
+ ;;
+ esac
+ lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd* | knetbsd*-gnu)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'
+ fi
+ ;;
+
+newsos6)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+osf3* | osf4* | osf5*)
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sco3.2v5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+
+sysv5uw[78]* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ case $host_vendor in
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ esac
+ ;;
+esac
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+
+
+
+
+
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+
+# find the maximum length of command line arguments
+echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ cygwin* | mingw*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for *BSD
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+ esac
+
+fi
+
+if test -n "$lt_cv_sys_max_cmd_len" ; then
+ echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6
+else
+ echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6
+fi
+
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $MAGIC_CMD in
+ /*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+ ;;
+ *)
+ ac_save_MAGIC_CMD="$MAGIC_CMD"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="/usr/bin:$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/${ac_tool_prefix}file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ egrep "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ MAGIC_CMD="$ac_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ echo "$as_me:$LINENO: checking for file" >&5
+echo $ECHO_N "checking for file... $ECHO_C" >&6
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $MAGIC_CMD in
+ /*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+ ;;
+ *)
+ ac_save_MAGIC_CMD="$MAGIC_CMD"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="/usr/bin:$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ egrep "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ MAGIC_CMD="$ac_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ else
+ MAGIC_CMD=:
+ fi
+fi
+
+ fi
+ ;;
+esac
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ RANLIB=$ac_ct_RANLIB
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ STRIP=$ac_ct_STRIP
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+
+# Check for any special flags to pass to ltconfig.
+libtool_flags="--cache-file=$cache_file"
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
+test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+ enableval="$enable_libtool_lock"
+
+fi;
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
+
+
+# Check whether --with-pic or --without-pic was given.
+if test "${with_pic+set}" = set; then
+ withval="$with_pic"
+ pic_mode="$withval"
+else
+ pic_mode=default
+fi;
+test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
+test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line 4229 "configure"' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case "`/usr/bin/file conftest.o`" in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case "`/usr/bin/file conftest.o`" in
+ *32-bit*)
+ case $host in
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6
+if test "${lt_cv_cc_needs_belf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ lt_cv_cc_needs_belf=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+lt_cv_cc_needs_belf=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+
+
+esac
+
+
+# Save cache, so that ltconfig can load it
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+ (set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+ if test -w $cache_file; then
+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+ cat confcache >$cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
+|| { { echo "$as_me:$LINENO: error: libtool configure failed" >&5
+echo "$as_me: error: libtool configure failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+# Reload cache, that may have been modified by ltconfig
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . $cache_file;;
+ *) . ./$cache_file;;
+ esac
+ fi
+else
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+
+
+
+
+
+
+
+
+
+# We need gfortran to compile parts of the library
+# We can't use AC_PROG_FC because it expects a fully working gfortran.
+#AC_PROG_FC(gfortran)
+FC="$GFORTRAN"
+ac_ext=${FC_SRCEXT-f}
+ac_compile='$FC -c $FCFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext >&5'
+ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_fc_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ for ac_prog in gfortran
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_FC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$FC"; then
+ ac_cv_prog_FC="$FC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_FC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+FC=$ac_cv_prog_FC
+if test -n "$FC"; then
+ echo "$as_me:$LINENO: result: $FC" >&5
+echo "${ECHO_T}$FC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$FC" && break
+ done
+fi
+if test -z "$FC"; then
+ ac_ct_FC=$FC
+ for ac_prog in gfortran
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_FC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_FC"; then
+ ac_cv_prog_ac_ct_FC="$ac_ct_FC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_FC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_FC=$ac_cv_prog_ac_ct_FC
+if test -n "$ac_ct_FC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_FC" >&5
+echo "${ECHO_T}$ac_ct_FC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$ac_ct_FC" && break
+done
+
+ FC=$ac_ct_FC
+fi
+
+
+# Provide some information about the compiler.
+echo "$as_me:4614:" \
+ "checking for Fortran compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+rm -f a.out
+
+# If we don't use `.F' as extension, the preprocessor is not run on the
+# input file. (Note that this only needs to work for GNU compilers.)
+ac_save_ext=$ac_ext
+ac_ext=F
+echo "$as_me:$LINENO: checking whether we are using the GNU Fortran compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU Fortran compiler... $ECHO_C" >&6
+if test "${ac_cv_fc_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+ program main
+#ifndef __GNUC__
+ choke me
+#endif
+
+ end
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_fc_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_fc_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_fc_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_fc_compiler_gnu" >&6
+ac_ext=$ac_save_ext
+ac_test_FFLAGS=${FCFLAGS+set}
+ac_save_FFLAGS=$FCFLAGS
+FCFLAGS=
+echo "$as_me:$LINENO: checking whether $FC accepts -g" >&5
+echo $ECHO_N "checking whether $FC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_fc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ FCFLAGS=-g
+cat >conftest.$ac_ext <<_ACEOF
+ program main
+
+ end
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_fc_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_fc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_fc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_fc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_fc_g" >&6
+if test "$ac_test_FFLAGS" = set; then
+ FCFLAGS=$ac_save_FFLAGS
+elif test $ac_cv_prog_fc_g = yes; then
+ if test "x$ac_cv_fc_compiler_gnu" = xyes; then
+ FCFLAGS="-g -O2"
+ else
+ FCFLAGS="-g"
+ fi
+else
+ if test "x$ac_cv_fc_compiler_gnu" = xyes; then
+ FCFLAGS="-O2"
+ else
+ FCFLAGS=
+ fi
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+FCFLAGS="$FCFLAGS -Wall"
+
+# For libtool versioning info, format is CURRENT:REVISION:AGE
+libtool_VERSION=1:0:0
+
+
+# Check header files.
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ exit(2);
+ exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
+if test "${ac_cv_header_time+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_time=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_time=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6
+if test $ac_cv_header_time = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TIME_WITH_SYS_TIME 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+for ac_header in unistd.h semaphore.h sys/time.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ----------------------------------------------------- ##
+## Report this to the GNU OpenMP Runtime Library lists. ##
+## ----------------------------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+if test "${ac_cv_header_pthread_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for pthread.h" >&5
+echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6
+if test "${ac_cv_header_pthread_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5
+echo "${ECHO_T}$ac_cv_header_pthread_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking pthread.h usability" >&5
+echo $ECHO_N "checking pthread.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <pthread.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking pthread.h presence" >&5
+echo $ECHO_N "checking pthread.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <pthread.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: pthread.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: pthread.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: pthread.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: pthread.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: pthread.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: pthread.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: pthread.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: pthread.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: pthread.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: pthread.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: pthread.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: pthread.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ----------------------------------------------------- ##
+## Report this to the GNU OpenMP Runtime Library lists. ##
+## ----------------------------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for pthread.h" >&5
+echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6
+if test "${ac_cv_header_pthread_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_pthread_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5
+echo "${ECHO_T}$ac_cv_header_pthread_h" >&6
+
+fi
+if test $ac_cv_header_pthread_h = yes; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: Pthreads are required to build libgomp" >&5
+echo "$as_me: error: Pthreads are required to build libgomp" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
+
+# Check to see if -pthread or -lpthread is needed. Prefer the former.
+XPCFLAGS=""
+CFLAGS="$CFLAGS -pthread"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <pthread.h>
+ void *g(void *d) { return NULL; }
+int
+main ()
+{
+pthread_t t; pthread_create(&t,NULL,g,NULL);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ XPCFLAGS=" -Wc,-pthread"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <pthread.h>
+ void *g(void *d) { return NULL; }
+int
+main ()
+{
+pthread_t t; pthread_create(&t,NULL,g,NULL);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: Pthreads are required to build libgomp" >&5
+echo "$as_me: error: Pthreads are required to build libgomp" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+# Check for functions needed.
+
+
+for ac_func in getloadavg clock_gettime
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+# At least for glibc, clock_gettime is in librt. But don't pull that
+# in if it still doesn't give us the function we want.
+if test $ac_cv_func_clock_gettime = no; then
+ echo "$as_me:$LINENO: checking for clock_gettime in -lrt" >&5
+echo $ECHO_N "checking for clock_gettime in -lrt... $ECHO_C" >&6
+if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lrt $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char clock_gettime ();
+int
+main ()
+{
+clock_gettime ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_rt_clock_gettime=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_rt_clock_gettime=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_rt_clock_gettime" >&5
+echo "${ECHO_T}$ac_cv_lib_rt_clock_gettime" >&6
+if test $ac_cv_lib_rt_clock_gettime = yes; then
+ LIBS="-lrt $LIBS"
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_CLOCK_GETTIME Define to 1 if you have the `clock_gettime' function.
+_ACEOF
+
+fi
+
+fi
+
+# See if we support thread-local storage.
+
+ # Check whether --enable-tls or --disable-tls was given.
+if test "${enable_tls+set}" = set; then
+ enableval="$enable_tls"
+
+ case "$enableval" in
+ yes|no) ;;
+ *) { { echo "$as_me:$LINENO: error: Argument to enable/disable tls must be yes or no" >&5
+echo "$as_me: error: Argument to enable/disable tls must be yes or no" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+
+else
+ enable_tls=yes
+fi;
+
+ echo "$as_me:$LINENO: checking whether the target supports thread-local storage" >&5
+echo $ECHO_N "checking whether the target supports thread-local storage... $ECHO_C" >&6
+if test "${have_tls+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+__thread int foo;
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ have_tls=$enable_tls
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+have_tls=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $have_tls" >&5
+echo "${ECHO_T}$have_tls" >&6
+ if test $have_tls = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_TLS 1
+_ACEOF
+
+ fi
+
+# See what sort of export controls are availible.
+
+ echo "$as_me:$LINENO: checking whether the target supports hidden visibility" >&5
+echo $ECHO_N "checking whether the target supports hidden visibility... $ECHO_C" >&6
+if test "${have_attribute_visibility+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+void __attribute__((visibility("hidden"))) foo(void) { }
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ have_attribute_visibility=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+have_attribute_visibility=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$save_CFLAGS"
+fi
+echo "$as_me:$LINENO: result: $have_attribute_visibility" >&5
+echo "${ECHO_T}$have_attribute_visibility" >&6
+ if test $have_attribute_visibility = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ATTRIBUTE_VISIBILITY 1
+_ACEOF
+
+ fi
+
+ echo "$as_me:$LINENO: checking whether the target supports dllexport" >&5
+echo $ECHO_N "checking whether the target supports dllexport... $ECHO_C" >&6
+if test "${have_attribute_dllexport+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+void __attribute__((dllexport)) foo(void) { }
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ have_attribute_dllexport=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+have_attribute_dllexport=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$save_CFLAGS"
+fi
+echo "$as_me:$LINENO: result: $have_attribute_dllexport" >&5
+echo "${ECHO_T}$have_attribute_dllexport" >&6
+ if test $have_attribute_dllexport = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ATTRIBUTE_DLLEXPORT 1
+_ACEOF
+
+ fi
+
+ echo "$as_me:$LINENO: checking whether the target supports symbol aliases" >&5
+echo $ECHO_N "checking whether the target supports symbol aliases... $ECHO_C" >&6
+if test "${have_attribute_alias+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#define ULP STR1(__USER_LABEL_PREFIX__)
+#define STR1(x) STR2(x)
+#define STR2(x) #x
+void foo(void) { }
+extern void bar(void) __attribute__((alias(ULP "foo")));
+int
+main ()
+{
+bar();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ have_attribute_alias=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+have_attribute_alias=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $have_attribute_alias" >&5
+echo "${ECHO_T}$have_attribute_alias" >&6
+ if test $have_attribute_alias = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ATTRIBUTE_ALIAS 1
+_ACEOF
+
+ fi
+
+ # If we're not using GNU ld, then there's no point in even trying these
+ # tests. Check for that first. We should have already tested for gld
+ # by now (in libtool), but require it now just to be safe...
+ test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
+ test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
+
+
+
+ # The name set by libtool depends on the version of libtool. Shame on us
+ # for depending on an impl detail, but c'est la vie. Older versions used
+ # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
+ # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
+ # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
+ # set (hence we're using an older libtool), then set it.
+ if test x${with_gnu_ld+set} != xset; then
+ if test x${ac_cv_prog_gnu_ld+set} != xset; then
+ # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
+ with_gnu_ld=no
+ else
+ with_gnu_ld=$ac_cv_prog_gnu_ld
+ fi
+ fi
+
+ # Start by getting the version number. I think the libtool test already
+ # does some of this, but throws away the result.
+
+ ldver=`$LD --version 2>/dev/null | head -1 | \
+ sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+
+ libgomp_gnu_ld_version=`echo $ldver | \
+ $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
+
+ # Set --gc-sections.
+ if test "$with_gnu_ld" = "notbroken"; then
+ # GNU ld it is! Joy and bunny rabbits!
+
+ # All these tests are for C++; save the language and the compiler flags.
+ # Need to do this so that g++ won't try to link in libstdc++
+ ac_test_CFLAGS="${CFLAGS+set}"
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS='-x c++ -Wl,--gc-sections'
+
+ # Check for -Wl,--gc-sections
+ # XXX This test is broken at the moment, as symbols required for linking
+ # are now in libsupc++ (not built yet). In addition, this test has
+ # cored on solaris in the past. In addition, --gc-sections doesn't
+ # really work at the moment (keeps on discarding used sections, first
+ # .eh_frame and now some of the glibc sections for iconv).
+ # Bzzzzt. Thanks for playing, maybe next time.
+ echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
+echo $ECHO_N "checking for ld that supports -Wl,--gc-sections... $ECHO_C" >&6
+ if test "$cross_compiling" = yes; then
+ ac_sectionLDflags=yes
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ int main(void)
+ {
+ try { throw 1; }
+ catch (...) { };
+ return 0;
+ }
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_sectionLDflags=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_sectionLDflags=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ else
+ # this is the suspicious part
+ CFLAGS=''
+ fi
+ if test "$ac_sectionLDflags" = "yes"; then
+ SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
+ fi
+ echo "$as_me:$LINENO: result: $ac_sectionLDflags" >&5
+echo "${ECHO_T}$ac_sectionLDflags" >&6
+ fi
+
+ # Set linker optimization flags.
+ if test x"$with_gnu_ld" = x"yes"; then
+ OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
+ fi
+
+
+
+
+
+
+ # Check whether --enable-symvers or --disable-symvers was given.
+if test "${enable_symvers+set}" = set; then
+ enableval="$enable_symvers"
+
+ case "$enableval" in
+ yes|no|gnu) ;;
+ *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable symvers" >&5
+echo "$as_me: error: Unknown argument to enable/disable symvers" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+
+else
+ enable_symvers=yes
+fi;
+
+
+# If we never went through the LIBGOMP_CHECK_LINKER_FEATURES macro, then we
+# don't know enough about $LD to do tricks...
+
+# FIXME The following test is too strict, in theory.
+if test $enable_shared = no ||
+ test "x$LD" = x ||
+ test x$libgomp_gnu_ld_version = x; then
+ enable_symvers=no
+fi
+
+# Check to see if libgcc_s exists, indicating that shared libgcc is possible.
+if test $enable_symvers != no; then
+ echo "$as_me:$LINENO: checking for shared libgcc" >&5
+echo $ECHO_N "checking for shared libgcc... $ECHO_C" >&6
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS=' -lgcc_s'
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ libgomp_shared_libgcc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+libgomp_shared_libgcc=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS="$ac_save_CFLAGS"
+ if test $libgomp_shared_libgcc = no; then
+ cat > conftest.c <<EOF
+int main (void) { return 0; }
+EOF
+ libgomp_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
+ -shared -shared-libgcc -o conftest.so \
+ conftest.c -v 2>&1 >/dev/null \
+ | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
+ rm -f conftest.c conftest.so
+ if test x${libgomp_libgcc_s_suffix+set} = xset; then
+ CFLAGS=" -lgcc_s$libgomp_libgcc_s_suffix"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ libgomp_shared_libgcc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS="$ac_save_CFLAGS"
+ fi
+ fi
+ echo "$as_me:$LINENO: result: $libgomp_shared_libgcc" >&5
+echo "${ECHO_T}$libgomp_shared_libgcc" >&6
+fi
+
+# For GNU ld, we need at least this version. The format is described in
+# LIBGOMP_CHECK_LINKER_FEATURES above.
+libgomp_min_gnu_ld_version=21400
+# XXXXXXXXXXX libgomp_gnu_ld_version=21390
+
+# Check to see if unspecified "yes" value can win, given results above.
+# Change "yes" into either "no" or a style name.
+if test $enable_symvers = yes; then
+ if test $with_gnu_ld = yes &&
+ test $libgomp_shared_libgcc = yes;
+ then
+ if test $libgomp_gnu_ld_version -ge $libgomp_min_gnu_ld_version ; then
+ enable_symvers=gnu
+ else
+ # The right tools, the right setup, but too old. Fallbacks?
+ { echo "$as_me:$LINENO: WARNING: === Linker version $libgomp_gnu_ld_version is too old for" >&5
+echo "$as_me: WARNING: === Linker version $libgomp_gnu_ld_version is too old for" >&2;}
+ { echo "$as_me:$LINENO: WARNING: === full symbol versioning support in this release of GCC." >&5
+echo "$as_me: WARNING: === full symbol versioning support in this release of GCC." >&2;}
+ { echo "$as_me:$LINENO: WARNING: === You would need to upgrade your binutils to version" >&5
+echo "$as_me: WARNING: === You would need to upgrade your binutils to version" >&2;}
+ { echo "$as_me:$LINENO: WARNING: === $libgomp_min_gnu_ld_version or later and rebuild GCC." >&5
+echo "$as_me: WARNING: === $libgomp_min_gnu_ld_version or later and rebuild GCC." >&2;}
+ if test $libgomp_gnu_ld_version -ge 21200 ; then
+ # Globbing fix is present, proper block support is not.
+ { echo "$as_me:$LINENO: WARNING: === Symbol versioning will be disabled." >&5
+echo "$as_me: WARNING: === Symbol versioning will be disabled." >&2;}
+ enable_symvers=no
+ else
+ # 2.11 or older.
+ { echo "$as_me:$LINENO: WARNING: === Symbol versioning will be disabled." >&5
+echo "$as_me: WARNING: === Symbol versioning will be disabled." >&2;}
+ enable_symvers=no
+ fi
+ fi
+ else
+ # just fail for now
+ { echo "$as_me:$LINENO: WARNING: === You have requested some kind of symbol versioning, but" >&5
+echo "$as_me: WARNING: === You have requested some kind of symbol versioning, but" >&2;}
+ { echo "$as_me:$LINENO: WARNING: === either you are not using a supported linker, or you are" >&5
+echo "$as_me: WARNING: === either you are not using a supported linker, or you are" >&2;}
+ { echo "$as_me:$LINENO: WARNING: === not building a shared libgcc_s (which is required)." >&5
+echo "$as_me: WARNING: === not building a shared libgcc_s (which is required)." >&2;}
+ { echo "$as_me:$LINENO: WARNING: === Symbol versioning will be disabled." >&5
+echo "$as_me: WARNING: === Symbol versioning will be disabled." >&2;}
+ enable_symvers=no
+ fi
+fi
+
+
+
+if test $enable_symvers != no; then
+ LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE=
+ LIBGOMP_BUILD_VERSIONED_SHLIB_FALSE='#'
+else
+ LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE='#'
+ LIBGOMP_BUILD_VERSIONED_SHLIB_FALSE=
+fi
+
+{ echo "$as_me:$LINENO: versioning on shared library symbols is $enable_symvers" >&5
+echo "$as_me: versioning on shared library symbols is $enable_symvers" >&6;}
+
+
+# Get target configury.
+. ${srcdir}/configure.tgt
+CFLAGS="$save_CFLAGS $XCFLAGS"
+
+# Check for __sync_val_compare_and_swap, but only after the target has
+# had a chance to set XCFLAGS.
+
+ echo "$as_me:$LINENO: checking whether the target supports __sync_*_compare_and_swap" >&5
+echo $ECHO_N "checking whether the target supports __sync_*_compare_and_swap... $ECHO_C" >&6
+if test "${have_sync_builtins+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+int foo, bar; bar = __sync_val_compare_and_swap(&foo, 0, 1);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ have_sync_builtins=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+have_sync_builtins=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $have_sync_builtins" >&5
+echo "${ECHO_T}$have_sync_builtins" >&6
+ if test $have_sync_builtins = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SYNC_BUILTINS 1
+_ACEOF
+
+ fi
+
+XCFLAGS="$XCFLAGS$XPCFLAGS"
+
+
+
+
+
+# Cleanup and exit.
+CFLAGS="$save_CFLAGS"
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+ (set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+ if test -w $cache_file; then
+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+ cat confcache >$cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+if test ${multilib} = yes; then
+ multilib_arg="--enable-multilib"
+else
+ multilib_arg=
+fi
+
+# Set up the set of libraries that we need to link against for libgomp.
+# Note that the GOMP_DRIVER_SPEC in gcc.c will force -pthread for -fopenmp,
+# which will force linkage against -lpthread (or equivalent for the system).
+# That's not 100% ideal, but about the best we can do easily.
+if test $enable_shared = yes; then
+ link_gomp="-lgomp %{static: $LIBS}"
+else
+ link_gomp="-lgomp $LIBS"
+fi
+
+
+
+
+if test "$ac_cv_fc_compiler_gnu" = yes; then
+ USE_FORTRAN_TRUE=
+ USE_FORTRAN_FALSE='#'
+else
+ USE_FORTRAN_TRUE='#'
+ USE_FORTRAN_FALSE=
+fi
+
+
+ ac_config_files="$ac_config_files Makefile testsuite/Makefile libgomp.spec"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+ (set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+ if test -w $cache_file; then
+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+ cat confcache >$cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[ ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[ ]*$//;
+}'
+fi
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_i=`echo "$ac_i" |
+ sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+ # 2. Add them.
+ ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE}" && test -z "${LIBGOMP_BUILD_VERSIONED_SHLIB_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"LIBGOMP_BUILD_VERSIONED_SHLIB\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"LIBGOMP_BUILD_VERSIONED_SHLIB\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${USE_FORTRAN_TRUE}" && test -z "${USE_FORTRAN_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"USE_FORTRAN\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"USE_FORTRAN\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling. Logging --version etc. is OK.
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by GNU OpenMP Runtime Library $as_me 1.0, which was
+generated by GNU Autoconf 2.59. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+GNU OpenMP Runtime Library config.status 1.0
+configured by $0, generated by GNU Autoconf 2.59,
+ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "x$1" : 'x\([^=]*\)='`
+ ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ -*)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ *) # This is not an option, so the user has probably given explicit
+ # arguments.
+ ac_option=$1
+ ac_need_defaults=false;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --vers* | -V )
+ echo "$ac_cs_version"; exit 0 ;;
+ --he | --h)
+ # Conflict between --help and --header
+ { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ ac_need_defaults=false;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1" ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+ echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS section.
+#
+
+
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+ case "$ac_config_target" in
+ # Handling of arguments.
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "testsuite/Makefile" ) CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;;
+ "libgomp.spec" ) CONFIG_FILES="$CONFIG_FILES libgomp.spec" ;;
+ "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
+ "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./confstat$$-$RANDOM
+ (umask 077 && mkdir $tmp)
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+ # Protect against being on the right side of a sed subst in config.status.
+ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@build@,$build,;t t
+s,@build_cpu@,$build_cpu,;t t
+s,@build_vendor@,$build_vendor,;t t
+s,@build_os@,$build_os,;t t
+s,@host@,$host,;t t
+s,@host_cpu@,$host_cpu,;t t
+s,@host_vendor@,$host_vendor,;t t
+s,@host_os@,$host_os,;t t
+s,@target@,$target,;t t
+s,@target_cpu@,$target_cpu,;t t
+s,@target_vendor@,$target_vendor,;t t
+s,@target_os@,$target_os,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@CYGPATH_W@,$CYGPATH_W,;t t
+s,@PACKAGE@,$PACKAGE,;t t
+s,@VERSION@,$VERSION,;t t
+s,@ACLOCAL@,$ACLOCAL,;t t
+s,@AUTOCONF@,$AUTOCONF,;t t
+s,@AUTOMAKE@,$AUTOMAKE,;t t
+s,@AUTOHEADER@,$AUTOHEADER,;t t
+s,@MAKEINFO@,$MAKEINFO,;t t
+s,@install_sh@,$install_sh,;t t
+s,@STRIP@,$STRIP,;t t
+s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
+s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
+s,@mkdir_p@,$mkdir_p,;t t
+s,@AWK@,$AWK,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@am__leading_dot@,$am__leading_dot,;t t
+s,@AMTAR@,$AMTAR,;t t
+s,@am__tar@,$am__tar,;t t
+s,@am__untar@,$am__untar,;t t
+s,@multi_basedir@,$multi_basedir,;t t
+s,@toolexecdir@,$toolexecdir,;t t
+s,@toolexeclibdir@,$toolexeclibdir,;t t
+s,@CC@,$CC,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@DEPDIR@,$DEPDIR,;t t
+s,@am__include@,$am__include,;t t
+s,@am__quote@,$am__quote,;t t
+s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t
+s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
+s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
+s,@CCDEPMODE@,$CCDEPMODE,;t t
+s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
+s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@AR@,$AR,;t t
+s,@ac_ct_AR@,$ac_ct_AR,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@PERL@,$PERL,;t t
+s,@LN_S@,$LN_S,;t t
+s,@LIBTOOL@,$LIBTOOL,;t t
+s,@enable_shared@,$enable_shared,;t t
+s,@enable_static@,$enable_static,;t t
+s,@FC@,$FC,;t t
+s,@FCFLAGS@,$FCFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@ac_ct_FC@,$ac_ct_FC,;t t
+s,@libtool_VERSION@,$libtool_VERSION,;t t
+s,@CPP@,$CPP,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@EGREP@,$EGREP,;t t
+s,@SECTION_LDFLAGS@,$SECTION_LDFLAGS,;t t
+s,@OPT_LDFLAGS@,$OPT_LDFLAGS,;t t
+s,@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@,$LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE,;t t
+s,@LIBGOMP_BUILD_VERSIONED_SHLIB_FALSE@,$LIBGOMP_BUILD_VERSIONED_SHLIB_FALSE,;t t
+s,@config_path@,$config_path,;t t
+s,@XCFLAGS@,$XCFLAGS,;t t
+s,@XLDFLAGS@,$XLDFLAGS,;t t
+s,@link_gomp@,$link_gomp,;t t
+s,@USE_FORTRAN_TRUE@,$USE_FORTRAN_TRUE,;t t
+s,@USE_FORTRAN_FALSE@,$USE_FORTRAN_FALSE,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+ cat >>$CONFIG_STATUS <<\_ACEOF
+ # Split the substitutions into bite-sized pieces for seds with
+ # small command number limits, like on Digital OSF/1 and HP-UX.
+ ac_max_sed_lines=48
+ ac_sed_frag=1 # Number of current file.
+ ac_beg=1 # First line for current file.
+ ac_end=$ac_max_sed_lines # Line after last line for current file.
+ ac_more_lines=:
+ ac_sed_cmds=
+ while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ else
+ sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ fi
+ if test ! -s $tmp/subs.frag; then
+ ac_more_lines=false
+ else
+ # The purpose of the label and of the branching condition is to
+ # speed up the sed processing (if there are no `@' at all, there
+ # is no need to browse any of the substitutions).
+ # These are the two extra sed commands mentioned above.
+ (echo ':t
+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+ fi
+ ac_sed_frag=`expr $ac_sed_frag + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_lines`
+ fi
+ done
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+ fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
+ esac
+
+ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+ esac
+
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ if test x"$ac_file" = x-; then
+ configure_input=
+ else
+ configure_input="$ac_file. "
+ fi
+ configure_input=$configure_input"Generated from `echo $ac_file_in |
+ sed 's,.*/,,'` by configure."
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo "$f";;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo "$f"
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo "$srcdir/$f"
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+ rm -f $tmp/stdin
+ if test x"$ac_file" != x-; then
+ mv $tmp/out $ac_file
+ else
+ cat $tmp/out
+ rm -f $tmp/out
+ fi
+
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_HEADER section.
+#
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='[ ].*$,\1#\2'
+ac_dC=' '
+ac_dD=',;t'
+# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='$,\1#\2define\3'
+ac_uC=' '
+ac_uD=',;t'
+
+for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
+ esac
+
+ test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ # Do quote $f, to prevent DOS paths from being IFS'd.
+ echo "$f";;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo "$f"
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo "$srcdir/$f"
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+ # Remove the trailing spaces.
+ sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
+
+_ACEOF
+
+# Transform confdefs.h into two sed scripts, `conftest.defines' and
+# `conftest.undefs', that substitutes the proper values into
+# config.h.in to produce config.h. The first handles `#define'
+# templates, and the second `#undef' templates.
+# And first: Protect against being on the right side of a sed subst in
+# config.status. Protect against being in an unquoted here document
+# in config.status.
+rm -f conftest.defines conftest.undefs
+# Using a here document instead of a string reduces the quoting nightmare.
+# Putting comments in sed scripts is not portable.
+#
+# `end' is used to avoid that the second main sed command (meant for
+# 0-ary CPP macros) applies to n-ary macro definitions.
+# See the Autoconf documentation for `clear'.
+cat >confdef2sed.sed <<\_ACEOF
+s/[\\&,]/\\&/g
+s,[\\$`],\\&,g
+t clear
+: clear
+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
+t end
+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
+: end
+_ACEOF
+# If some macros were called several times there might be several times
+# the same #defines, which is useless. Nevertheless, we may not want to
+# sort them, since we want the *last* AC-DEFINE to be honored.
+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
+rm -f confdef2sed.sed
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >>conftest.undefs <<\_ACEOF
+s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
+_ACEOF
+
+# Break up conftest.defines because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
+echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
+echo ' :' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.defines >/dev/null
+do
+ # Write a limited-size here document to $tmp/defines.sed.
+ echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
+ # Speed up: don't consider the non `#define' lines.
+ echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
+ # Work around the forget-to-reset-the-flag bug.
+ echo 't clr' >>$CONFIG_STATUS
+ echo ': clr' >>$CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f $tmp/defines.sed $tmp/in >$tmp/out
+ rm -f $tmp/in
+ mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+ rm -f conftest.defines
+ mv conftest.tail conftest.defines
+done
+rm -f conftest.defines
+echo ' fi # grep' >>$CONFIG_STATUS
+echo >>$CONFIG_STATUS
+
+# Break up conftest.undefs because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.undefs >/dev/null
+do
+ # Write a limited-size here document to $tmp/undefs.sed.
+ echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
+ # Speed up: don't consider the non `#undef'
+ echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
+ # Work around the forget-to-reset-the-flag bug.
+ echo 't clr' >>$CONFIG_STATUS
+ echo ': clr' >>$CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f $tmp/undefs.sed $tmp/in >$tmp/out
+ rm -f $tmp/in
+ mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
+ rm -f conftest.undefs
+ mv conftest.tail conftest.undefs
+done
+rm -f conftest.undefs
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ if test x"$ac_file" = x-; then
+ echo "/* Generated by configure. */" >$tmp/config.h
+ else
+ echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
+ fi
+ cat $tmp/in >>$tmp/config.h
+ rm -f $tmp/in
+ if test x"$ac_file" != x-; then
+ if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+ { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ rm -f $ac_file
+ mv $tmp/config.h $ac_file
+ fi
+ else
+ cat $tmp/config.h
+ rm -f $tmp/config.h
+ fi
+# Compute $ac_file's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $ac_file | $ac_file:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null ||
+$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X$ac_file : 'X\(//\)[^/]' \| \
+ X$ac_file : 'X\(//\)$' \| \
+ X$ac_file : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X$ac_file |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+ ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+ ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_dest" : 'X\(//\)[^/]' \| \
+ X"$ac_dest" : 'X\(//\)$' \| \
+ X"$ac_dest" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_dest" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+
+ { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
+echo "$as_me: executing $ac_dest commands" >&6;}
+ case $ac_dest in
+ default-1 )
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+ ac_file=Makefile . ${multi_basedir}/config-ml.in
+ ;;
+esac ;;
+ depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`(dirname "$mf") 2>/dev/null ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`(dirname "$file") 2>/dev/null ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p $dirpart/$fdir
+ else
+ as_dir=$dirpart/$fdir
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
+echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+ ;;
+ esac
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+
--- /dev/null
+# Process this file with autoconf to produce a configure script, like so:
+# aclocal -I ../config && autoconf && autoheader && automake
+
+AC_PREREQ(2.59)
+AC_INIT([GNU OpenMP Runtime Library], 1.0,,[libgomp])
+AC_CONFIG_HEADER(config.h)
+
+# -------
+# Options
+# -------
+
+AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
+LIBGOMP_ENABLE(version-specific-runtime-libs, no, ,
+ [Specify that runtime libraries should be installed in a compiler-specific directory],
+ permit yes|no)
+AC_MSG_RESULT($enable_version_specific_runtime_libs)
+
+AC_MSG_CHECKING([for --enable-linux-futex])
+LIBGOMP_ENABLE(linux-futex, yes,
+ [Use the Linux futex system call],
+ permit yes|no)
+AC_MSG_RESULT($enable_linux_futex)
+
+# -------
+# -------
+
+# Gets build, host, target, *_vendor, *_cpu, *_os, etc.
+#
+# You will slowly go insane if you do not grok the following fact: when
+# building this library, the top-level /target/ becomes the library's /host/.
+#
+# configure then causes --target to default to --host, exactly like any
+# other package using autoconf. Therefore, 'target' and 'host' will
+# always be the same. This makes sense both for native and cross compilers
+# just think about it for a little while. :-)
+#
+# Also, if this library is being configured as part of a cross compiler, the
+# top-level configure script will pass the "real" host as $with_cross_host.
+#
+# Do not delete or change the following two lines. For why, see
+# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
+AC_CANONICAL_SYSTEM
+target_alias=${target_alias-$host_alias}
+
+# Sets up automake. Must come after AC_CANONICAL_SYSTEM. Each of the
+# following is magically included in AUTOMAKE_OPTIONS in each Makefile.am.
+# 1.9.0: minimum required version
+# no-define: PACKAGE and VERSION will not be #define'd in config.h (a bunch
+# of other PACKAGE_* variables will, however, and there's nothing
+# we can do about that; they come from AC_INIT).
+# foreign: we don't follow the normal rules for GNU packages (no COPYING
+# file in the top srcdir, etc, etc), so stop complaining.
+# no-dependencies: turns off auto dependency generation (just for now)
+# -Wall: turns on all automake warnings...
+# -Wno-portability: ...except this one, since GNU make is required.
+# -Wno-override: ... and this one, since we do want this in testsuite.
+AM_INIT_AUTOMAKE([1.9.0 foreign -Wall -Wno-portability -Wno-override])
+AM_ENABLE_MULTILIB(, ..)
+
+# Calculate toolexeclibdir
+# Also toolexecdir, though it's only used in toolexeclibdir
+case ${enable_version_specific_runtime_libs} in
+ yes)
+ # Need the gcc compiler version to know where to install libraries
+ # and header files if --enable-version-specific-runtime-libs option
+ # is selected.
+ toolexecdir='$(libdir)/gcc/$(target_alias)'
+ toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
+ ;;
+ no)
+ if test -n "$with_cross_host" &&
+ test x"$with_cross_host" != x"no"; then
+ # Install a library built with a cross compiler in tooldir, not libdir.
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+ toolexeclibdir='$(toolexecdir)/lib'
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+ toolexeclibdir='$(libdir)'
+ fi
+ multi_os_directory=`$CC -print-multi-os-directory`
+ case $multi_os_directory in
+ .) ;; # Avoid trailing /.
+ *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
+ esac
+ ;;
+esac
+AC_SUBST(toolexecdir)
+AC_SUBST(toolexeclibdir)
+
+# Check the compiler.
+# The same as in boehm-gc and libstdc++. Have to borrow it from there.
+# We must force CC to /not/ be precious variables; otherwise
+# the wrong, non-multilib-adjusted value will be used in multilibs.
+# As a side effect, we have to subst CFLAGS ourselves.
+
+m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
+m4_define([_AC_ARG_VAR_PRECIOUS],[])
+AC_PROG_CC
+m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+
+AC_SUBST(CFLAGS)
+
+# In order to override CFLAGS_FOR_TARGET, all of our special flags go
+# in XCFLAGS. But we need them in CFLAGS during configury. So put them
+# in both places for now and restore CFLAGS at the end of config.
+save_CFLAGS="$CFLAGS"
+
+# Add -Wall -Werror if we are using GCC.
+if test "x$GCC" = "xyes"; then
+ XCFLAGS="$XCFLAGS -Wall -Werror"
+fi
+
+# Find other programs we need.
+AC_CHECK_TOOL(AR, ar)
+AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
+AC_PATH_PROG(PERL, perl, perl-not-found-in-path-error)
+AC_PROG_MAKE_SET
+AC_PROG_INSTALL
+
+# Configure libtool
+AM_PROG_LIBTOOL
+AC_SUBST(enable_shared)
+AC_SUBST(enable_static)
+
+# We need gfortran to compile parts of the library
+# We can't use AC_PROG_FC because it expects a fully working gfortran.
+#AC_PROG_FC(gfortran)
+FC="$GFORTRAN"
+AC_PROG_FC(gfortran)
+FCFLAGS="$FCFLAGS -Wall"
+
+# For libtool versioning info, format is CURRENT:REVISION:AGE
+libtool_VERSION=1:0:0
+AC_SUBST(libtool_VERSION)
+
+# Check header files.
+AC_STDC_HEADERS
+AC_HEADER_TIME
+AC_CHECK_HEADERS(unistd.h semaphore.h sys/time.h)
+AC_CHECK_HEADER([pthread.h],[],
+ [AC_MSG_ERROR([Pthreads are required to build libgomp])])
+
+# Check to see if -pthread or -lpthread is needed. Prefer the former.
+XPCFLAGS=""
+CFLAGS="$CFLAGS -pthread"
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <pthread.h>
+ void *g(void *d) { return NULL; }],
+ [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
+ [XPCFLAGS=" -Wc,-pthread"],
+ [CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <pthread.h>
+ void *g(void *d) { return NULL; }],
+ [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
+ [],
+ [AC_MSG_ERROR([Pthreads are required to build libgomp])])])
+
+# Check for functions needed.
+AC_CHECK_FUNCS(getloadavg clock_gettime)
+
+# At least for glibc, clock_gettime is in librt. But don't pull that
+# in if it still doesn't give us the function we want.
+if test $ac_cv_func_clock_gettime = no; then
+ AC_CHECK_LIB(rt, clock_gettime,
+ [LIBS="-lrt $LIBS"
+ AC_DEFINE(HAVE_CLOCK_GETTIME,
+ [Define to 1 if you have the `clock_gettime' function.])])
+fi
+
+# See if we support thread-local storage.
+LIBGOMP_CHECK_TLS
+
+# See what sort of export controls are availible.
+LIBGOMP_CHECK_ATTRIBUTE_VISIBILITY
+LIBGOMP_CHECK_ATTRIBUTE_DLLEXPORT
+LIBGOMP_CHECK_ATTRIBUTE_ALIAS
+LIBGOMP_ENABLE_SYMVERS
+
+# Get target configury.
+. ${srcdir}/configure.tgt
+CFLAGS="$save_CFLAGS $XCFLAGS"
+
+# Check for __sync_val_compare_and_swap, but only after the target has
+# had a chance to set XCFLAGS.
+LIBGOMP_CHECK_SYNC_BUILTINS
+
+XCFLAGS="$XCFLAGS$XPCFLAGS"
+
+AC_SUBST(config_path)
+AC_SUBST(XCFLAGS)
+AC_SUBST(XLDFLAGS)
+
+# Cleanup and exit.
+CFLAGS="$save_CFLAGS"
+AC_CACHE_SAVE
+
+if test ${multilib} = yes; then
+ multilib_arg="--enable-multilib"
+else
+ multilib_arg=
+fi
+
+# Set up the set of libraries that we need to link against for libgomp.
+# Note that the GOMP_DRIVER_SPEC in gcc.c will force -pthread for -fopenmp,
+# which will force linkage against -lpthread (or equivalent for the system).
+# That's not 100% ideal, but about the best we can do easily.
+if test $enable_shared = yes; then
+ link_gomp="-lgomp %{static: $LIBS}"
+else
+ link_gomp="-lgomp $LIBS"
+fi
+AC_SUBST(link_gomp)
+
+AM_CONDITIONAL([USE_FORTRAN], [test "$ac_cv_fc_compiler_gnu" = yes])
+
+AC_CONFIG_FILES(Makefile testsuite/Makefile libgomp.spec)
+AC_OUTPUT
--- /dev/null
+# This is the target specific configuration file. This is invoked by the
+# autoconf generated configure script. Putting it in a separate shell file
+# lets us skip running autoconf when modifying target specific information.
+
+# This file switches on the shell variable ${target}, and sets the
+# following shell variables:
+# config_path An ordered list of directories to search for
+# sources and headers. This is relative to the
+# config subdirectory of the source tree.
+# XCFLAGS Add extra compile flags to use.
+# XLDFLAGS Add extra link flags to use.
+
+# Optimize TLS usage by avoiding the overhead of dynamic allocation.
+# This does require that the library be present during process
+# startup, so mark the library as not to be dlopened.
+if test $have_tls = yes && test "$with_gnu_ld" = "yes"; then
+ XCFLAGS="${XCFLAGS} -ftls-model=initial-exec"
+ XLDFLAGS="${XLDFLAGS} -Wl,-z,nodlopen"
+fi
+
+# Since we require POSIX threads, assume a POSIX system by default.
+config_path="posix"
+
+# Check for futex enabled all at once.
+if test $enable_linux_futex = yes; then
+ case "${target}" in
+
+ alpha*-*-linux*)
+ config_path="linux/alpha linux posix"
+ ;;
+
+ ia64*-*-linux*)
+ config_path="linux/ia64 linux posix"
+ ;;
+
+ powerpc*-*-linux*)
+ config_path="linux/powerpc linux posix"
+ ;;
+
+ s390*-*-linux*)
+ config_path="linux/s390 linux posix"
+ ;;
+
+ # Note that bare i386 is not included here. We need cmpxchg.
+ i[456]86-*-linux*)
+ config_path="linux/x86 linux posix"
+ if test -z "$with_arch"; then
+ XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
+ fi
+ ;;
+
+ # Similar jiggery-pokery for x86_64 multilibs, except here we
+ # can't rely on the --with-arch configure option, since that
+ # applies to the 64-bit side.
+ x86_64-*-linux*)
+ config_path="linux/x86 linux posix"
+ case " ${CC} ${CFLAGS} " in
+ *" -m32 "*)
+ XCFLAGS="${XCFLAGS} -march=i486 -mtune=i686"
+ ;;
+ esac
+ ;;
+
+ # Note that sparcv7 and sparcv8 is not included here. We need cas.
+ sparcv9-*-linux* | sparc64-*-linux*)
+ echo "int i;" > conftestx.c
+ if ${CC} ${CFLAGS} -c -o conftestx.o conftestx.c > /dev/null 2>&1; then
+ config_path="linux/sparc linux posix"
+ case "`/usr/bin/file conftestx.o`" in
+ *32-bit*)
+ case " ${CC} ${CFLAGS}" in
+ *" -mcpu=ultrasparc"*)
+ ;;
+ *)
+ XCFLAGS="${XCFLAGS} -mcpu=v9"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -f conftestx.c conftestx.o
+ ;;
+ esac
+fi
+
+# Other system configury
+case "${target}" in
+
+ *)
+ ;;
+
+esac
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This file handles the CRITICAL construct. */
+
+#include "libgomp.h"
+#include <stdlib.h>
+
+
+static gomp_mutex_t default_lock;
+
+void
+GOMP_critical_start (void)
+{
+ gomp_mutex_lock (&default_lock);
+}
+
+void
+GOMP_critical_end (void)
+{
+ gomp_mutex_unlock (&default_lock);
+}
+
+#ifndef HAVE_SYNC_BUILTINS
+static gomp_mutex_t create_lock_lock;
+#endif
+
+void
+GOMP_critical_name_start (void **pptr)
+{
+ gomp_mutex_t *plock;
+
+ /* If a mutex fits within the space for a pointer, and is zero initialized,
+ then use the pointer space directly. */
+ if (GOMP_MUTEX_INIT_0
+ && sizeof (gomp_mutex_t) <= sizeof (void *)
+ && __alignof (gomp_mutex_t) <= sizeof (void *))
+ plock = (gomp_mutex_t *)pptr;
+
+ /* Otherwise we have to be prepared to malloc storage. */
+ else
+ {
+ plock = *pptr;
+
+ if (plock == NULL)
+ {
+#ifdef HAVE_SYNC_BUILTINS
+ gomp_mutex_t *nlock = gomp_malloc (sizeof (gomp_mutex_t));
+ gomp_mutex_init (nlock);
+
+ plock = __sync_val_compare_and_swap (pptr, plock, nlock);
+ if (plock != nlock)
+ {
+ gomp_mutex_destroy (nlock);
+ free (nlock);
+ }
+#else
+ gomp_mutex_lock (&create_lock_lock);
+ plock = *pptr;
+ if (plock == NULL)
+ {
+ plock = gomp_malloc (sizeof (gomp_mutex_t));
+ gomp_mutex_init (plock);
+ __sync_synchronize ();
+ *pptr = plock;
+ }
+ gomp_mutex_unlock (&create_lock_lock);
+#endif
+ }
+ }
+
+ gomp_mutex_lock (plock);
+}
+
+void
+GOMP_critical_name_end (void **pptr)
+{
+ gomp_mutex_t *plock;
+
+ /* If a mutex fits within the space for a pointer, and is zero initialized,
+ then use the pointer space directly. */
+ if (GOMP_MUTEX_INIT_0
+ && sizeof (gomp_mutex_t) <= sizeof (void *)
+ && __alignof (gomp_mutex_t) <= sizeof (void *))
+ plock = (gomp_mutex_t *)pptr;
+ else
+ plock = *pptr;
+
+ gomp_mutex_unlock (plock);
+}
+
+/* This mutex is used when atomic operations don't exist for the target
+ in the mode requested. The result is not globally atomic, but works so
+ long as all parallel references are within #pragma omp atomic directives.
+ According to responses received from omp@openmp.org, appears to be within
+ spec. Which makes sense, since that's how several other compilers
+ handle this situation as well. */
+
+static gomp_mutex_t atomic_lock;
+
+void
+GOMP_atomic_start (void)
+{
+ gomp_mutex_lock (&atomic_lock);
+}
+
+void
+GOMP_atomic_end (void)
+{
+ gomp_mutex_unlock (&atomic_lock);
+}
+
+#if !GOMP_MUTEX_INIT_0
+static void __attribute__((constructor))
+initialize_critical (void)
+{
+ gomp_mutex_init (&default_lock);
+ gomp_mutex_init (&atomic_lock);
+#ifndef HAVE_SYNC_BUILTINS
+ gomp_mutex_init (&create_lock_lock);
+#endif
+}
+#endif
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This file defines the OpenMP internal control variables, and arranges
+ for them to be initialized from environment variables at startup. */
+
+#include "libgomp.h"
+#include "libgomp_f.h"
+#include <stdlib.h>
+#include <string.h>
+
+
+unsigned gomp_nthreads_var = 1;
+bool gomp_dyn_var = false;
+bool gomp_nest_var = false;
+enum gomp_schedule_type gomp_run_sched_var = GFS_DYNAMIC;
+unsigned gomp_run_sched_chunk = 1;
+
+/* Parse the OMP_SCHEDULE environment variable. */
+
+static void
+parse_schedule (void)
+{
+ char *env, *end;
+
+ env = getenv ("OMP_SCHEDULE");
+ if (env == NULL)
+ return;
+
+ if (strncmp (env, "static", 6) == 0)
+ {
+ gomp_run_sched_var = GFS_STATIC;
+ env += 6;
+ }
+ else if (strncmp (env, "dynamic", 7) == 0)
+ {
+ gomp_run_sched_var = GFS_DYNAMIC;
+ env += 7;
+ }
+ else if (strncmp (env, "guided", 6) == 0)
+ {
+ gomp_run_sched_var = GFS_GUIDED;
+ env += 6;
+ }
+ else
+ goto unknown;
+
+ if (*env == '\0')
+ return;
+ if (*env != ' ' && *env != ',')
+ goto unknown;
+ while (*env == ' ')
+ env++;
+ if (*env == '\0')
+ return;
+ if (*env != ',')
+ goto unknown;
+ if (*++env == '\0')
+ goto invalid;
+
+ gomp_run_sched_chunk = strtoul (env, &end, 10);
+ if (*end != '\0')
+ goto invalid;
+ return;
+
+ unknown:
+ gomp_error ("Unknown value for environment variable OMP_SCHEDULE");
+ return;
+
+ invalid:
+ gomp_error ("Invalid value for chunk size in "
+ "environment variable OMP_SCHEDULE");
+ gomp_run_sched_chunk = 1;
+ return;
+}
+
+/* Parse the OMP_NUM_THREADS environment varible. Return true if one was
+ present and it was successfully parsed. */
+
+static bool
+parse_num_threads (void)
+{
+ char *env, *end;
+
+ env = getenv ("OMP_NUM_THREADS");
+ if (env == NULL)
+ return false;
+
+ if (*env == '\0')
+ goto invalid;
+
+ gomp_nthreads_var = strtoul (env, &end, 10);
+ if (*end != '\0')
+ goto invalid;
+ return true;
+
+ invalid:
+ gomp_error ("Invalid value for enviroment variable OMP_NUM_THREADS");
+ gomp_nthreads_var = 1;
+ return false;
+}
+
+/* Parse a boolean value for environement variable NAME and store the
+ result in VALUE. */
+
+static void
+parse_boolean (const char *name, bool *value)
+{
+ const char *env;
+
+ env = getenv (name);
+ if (env == NULL)
+ return;
+
+ if (strcmp (env, "true") == 0)
+ *value = true;
+ else if (strcmp (env, "false") == 0)
+ *value = false;
+ else
+ gomp_error ("Invalid value for environement variable %s", name);
+}
+
+static void __attribute__((constructor))
+initialize_env (void)
+{
+ /* Do a compile time check that mkomp_h.pl did good job. */
+ omp_check_defines ();
+
+ parse_schedule ();
+ parse_boolean ("OMP_DYNAMIC", &gomp_dyn_var);
+ parse_boolean ("OMP_NESTED", &gomp_nest_var);
+ if (!parse_num_threads ())
+ gomp_init_num_threads ();
+}
+
+\f
+/* The public OpenMP API routines that access these variables. */
+
+void
+omp_set_num_threads (int n)
+{
+ gomp_nthreads_var = n;
+}
+
+void
+omp_set_dynamic (int val)
+{
+ gomp_dyn_var = val;
+}
+
+int
+omp_get_dynamic (void)
+{
+ return gomp_dyn_var;
+}
+
+void
+omp_set_nested (int val)
+{
+ gomp_nest_var = val;
+}
+
+int
+omp_get_nested (void)
+{
+ return gomp_nest_var;
+}
+
+ialias (omp_set_dynamic)
+ialias (omp_set_nested)
+ialias (omp_set_num_threads)
+ialias (omp_get_dynamic)
+ialias (omp_get_nested)
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This file contains routines used to signal errors. Most places in the
+ OpenMP API do not make any provision for failure, so we can't just
+ defer the decision on reporting the problem to the user; we must do it
+ ourselves or not at all. */
+/* ??? Is this about what other implementations do? Assume stderr hasn't
+ been pointed somewhere unsafe? */
+
+#include "libgomp.h"
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static void
+gomp_verror (const char *fmt, va_list list)
+{
+ fputs ("\nlibgomp: ", stderr);
+ vfprintf (stderr, fmt, list);
+ fputc ('\n', stderr);
+}
+
+void
+gomp_error (const char *fmt, ...)
+{
+ va_list list;
+
+ va_start (list, fmt);
+ gomp_verror (fmt, list);
+ va_end (list);
+}
+
+void
+gomp_fatal (const char *fmt, ...)
+{
+ va_list list;
+
+ va_start (list, fmt);
+ gomp_verror (fmt, list);
+ va_end (list);
+
+ exit (EXIT_FAILURE);
+}
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Jakub Jelinek <jakub@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This file contains Fortran wrapper routines. */
+
+#include "libgomp.h"
+#include "libgomp_f.h"
+#include <stdlib.h>
+
+#ifdef HAVE_ATTRIBUTE_ALIAS
+/* Use internal aliases if possible. */
+# define ialias_redirect(fn) \
+ extern __typeof (fn) fn __asm__ ("gomp_ialias_" #fn) attribute_hidden;
+ialias_redirect (omp_init_lock)
+ialias_redirect (omp_init_nest_lock)
+ialias_redirect (omp_destroy_lock)
+ialias_redirect (omp_destroy_nest_lock)
+ialias_redirect (omp_set_lock)
+ialias_redirect (omp_set_nest_lock)
+ialias_redirect (omp_unset_lock)
+ialias_redirect (omp_unset_nest_lock)
+ialias_redirect (omp_test_lock)
+ialias_redirect (omp_test_nest_lock)
+ialias_redirect (omp_set_dynamic)
+ialias_redirect (omp_set_nested)
+ialias_redirect (omp_set_num_threads)
+ialias_redirect (omp_get_dynamic)
+ialias_redirect (omp_get_nested)
+ialias_redirect (omp_in_parallel)
+ialias_redirect (omp_get_max_threads)
+ialias_redirect (omp_get_num_procs)
+ialias_redirect (omp_get_num_threads)
+ialias_redirect (omp_get_thread_num)
+ialias_redirect (omp_get_wtick)
+ialias_redirect (omp_get_wtime)
+#endif
+
+void
+omp_init_lock_ (omp_lock_arg_t lock)
+{
+#ifndef OMP_LOCK_DIRECT
+ omp_lock_arg (lock) = malloc (sizeof (omp_lock_t));
+#endif
+ omp_init_lock (omp_lock_arg (lock));
+}
+
+void
+omp_init_nest_lock_ (omp_nest_lock_arg_t lock)
+{
+#ifndef OMP_NEST_LOCK_DIRECT
+ omp_nest_lock_arg (lock) = malloc (sizeof (omp_nest_lock_t));
+#endif
+ omp_init_nest_lock (omp_nest_lock_arg (lock));
+}
+
+void
+omp_destroy_lock_ (omp_lock_arg_t lock)
+{
+ omp_destroy_lock (omp_lock_arg (lock));
+#ifndef OMP_LOCK_DIRECT
+ free (omp_lock_arg (lock));
+ omp_lock_arg (lock) = NULL;
+#endif
+}
+
+void
+omp_destroy_nest_lock_ (omp_nest_lock_arg_t lock)
+{
+ omp_destroy_nest_lock (omp_nest_lock_arg (lock));
+#ifndef OMP_NEST_LOCK_DIRECT
+ free (omp_nest_lock_arg (lock));
+ omp_nest_lock_arg (lock) = NULL;
+#endif
+}
+
+void
+omp_set_lock_ (omp_lock_arg_t lock)
+{
+ omp_set_lock (omp_lock_arg (lock));
+}
+
+void
+omp_set_nest_lock_ (omp_nest_lock_arg_t lock)
+{
+ omp_set_nest_lock (omp_nest_lock_arg (lock));
+}
+
+void
+omp_unset_lock_ (omp_lock_arg_t lock)
+{
+ omp_unset_lock (omp_lock_arg (lock));
+}
+
+void
+omp_unset_nest_lock_ (omp_nest_lock_arg_t lock)
+{
+ omp_unset_nest_lock (omp_nest_lock_arg (lock));
+}
+
+void
+omp_set_dynamic_ (const int32_t *set)
+{
+ omp_set_dynamic (*set);
+}
+
+void
+omp_set_dynamic_8_ (const int64_t *set)
+{
+ omp_set_dynamic (*set);
+}
+
+void
+omp_set_nested_ (const int32_t *set)
+{
+ omp_set_nested (*set);
+}
+
+void
+omp_set_nested_8_ (const int64_t *set)
+{
+ omp_set_nested (*set);
+}
+
+void
+omp_set_num_threads_ (const int32_t *set)
+{
+ omp_set_num_threads (*set);
+}
+
+void
+omp_set_num_threads_8_ (const int64_t *set)
+{
+ omp_set_num_threads (*set);
+}
+
+int32_t
+omp_get_dynamic_ (void)
+{
+ return omp_get_dynamic ();
+}
+
+int32_t
+omp_get_nested_ (void)
+{
+ return omp_get_nested ();
+}
+
+int32_t
+omp_in_parallel_ (void)
+{
+ return omp_in_parallel ();
+}
+
+int32_t
+omp_test_lock_ (omp_lock_arg_t lock)
+{
+ return omp_test_lock (omp_lock_arg (lock));
+}
+
+int32_t
+omp_get_max_threads_ (void)
+{
+ return omp_get_max_threads ();
+}
+
+int32_t
+omp_get_num_procs_ (void)
+{
+ return omp_get_num_procs ();
+}
+
+int32_t
+omp_get_num_threads_ (void)
+{
+ return omp_get_num_threads ();
+}
+
+int32_t
+omp_get_thread_num_ (void)
+{
+ return omp_get_thread_num ();
+}
+
+int32_t
+omp_test_nest_lock_ (omp_nest_lock_arg_t lock)
+{
+ return omp_test_nest_lock (omp_nest_lock_arg (lock));
+}
+
+double
+omp_get_wtick_ (void)
+{
+ return omp_get_wtick ();
+}
+
+double
+omp_get_wtime_ (void)
+{
+ return omp_get_wtime ();
+}
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This file contains routines for managing work-share iteration, both
+ for loops and sections. */
+
+#include "libgomp.h"
+#include <stdlib.h>
+
+
+/* This function implements the STATIC scheduling method. The caller should
+ iterate *pstart <= x < *pend. Return zero if there are more iterations
+ to perform; nonzero if not. Return less than 0 if this thread had
+ received the absolutely last iteration. */
+
+int
+gomp_iter_static_next (long *pstart, long *pend)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ struct gomp_team *team = thr->ts.team;
+ struct gomp_work_share *ws = thr->ts.work_share;
+ unsigned long nthreads = team ? team->nthreads : 1;
+
+ if (thr->ts.static_trip == -1)
+ return -1;
+
+ /* Quick test for degenerate teams and orphaned constructs. */
+ if (nthreads == 1)
+ {
+ *pstart = ws->next;
+ *pend = ws->end;
+ thr->ts.static_trip = -1;
+ return ws->next == ws->end;
+ }
+
+ /* We interpret chunk_size zero as "unspecified", which means that we
+ should break up the iterations such that each thread makes only one
+ trip through the outer loop. */
+ if (ws->chunk_size == 0)
+ {
+ unsigned long n, q, i;
+ unsigned long s0, e0;
+ long s, e;
+
+ if (thr->ts.static_trip > 0)
+ return 1;
+
+ /* Compute the total number of iterations. */
+ s = ws->incr + (ws->incr > 0 ? -1 : 1);
+ n = (ws->end - ws->next + s) / ws->incr;
+ i = thr->ts.team_id;
+
+ /* Compute the "zero-based" start and end points. That is, as
+ if the loop began at zero and incremented by one. */
+ q = n / nthreads;
+ q += (q * nthreads != n);
+ s0 = q * i;
+ e0 = s0 + q;
+ if (e0 > n)
+ e0 = n;
+
+ /* Notice when no iterations allocated for this thread. */
+ if (s0 >= e0)
+ {
+ thr->ts.static_trip = 1;
+ return 1;
+ }
+
+ /* Transform these to the actual start and end numbers. */
+ s = (long)s0 * ws->incr + ws->next;
+ e = (long)e0 * ws->incr + ws->next;
+
+ *pstart = s;
+ *pend = e;
+ thr->ts.static_trip = (e0 == n ? -1 : 1);
+ return 0;
+ }
+ else
+ {
+ unsigned long n, s0, e0, i, c;
+ long s, e;
+
+ /* Otherwise, each thread gets exactly chunk_size iterations
+ (if available) each time through the loop. */
+
+ s = ws->incr + (ws->incr > 0 ? -1 : 1);
+ n = (ws->end - ws->next + s) / ws->incr;
+ i = thr->ts.team_id;
+ c = ws->chunk_size;
+
+ /* Initial guess is a C sized chunk positioned nthreads iterations
+ in, offset by our thread number. */
+ s0 = (thr->ts.static_trip * nthreads + i) * c;
+ e0 = s0 + c;
+
+ /* Detect overflow. */
+ if (s0 >= n)
+ return 1;
+ if (e0 > n)
+ e0 = n;
+
+ /* Transform these to the actual start and end numbers. */
+ s = (long)s0 * ws->incr + ws->next;
+ e = (long)e0 * ws->incr + ws->next;
+
+ *pstart = s;
+ *pend = e;
+
+ if (e0 == n)
+ thr->ts.static_trip = -1;
+ else
+ thr->ts.static_trip++;
+ return 0;
+ }
+}
+
+
+/* This function implements the DYNAMIC scheduling method. Arguments are
+ as for gomp_iter_static_next. This function must be called with ws->lock
+ held. */
+
+bool
+gomp_iter_dynamic_next_locked (long *pstart, long *pend)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ struct gomp_work_share *ws = thr->ts.work_share;
+ long start, end, chunk, left;
+
+ start = ws->next;
+ if (start == ws->end)
+ return false;
+
+ chunk = ws->chunk_size * ws->incr;
+ left = ws->end - start;
+ if (ws->incr < 0)
+ {
+ if (chunk < left)
+ chunk = left;
+ }
+ else
+ {
+ if (chunk > left)
+ chunk = left;
+ }
+ end = start + chunk;
+
+ ws->next = end;
+ *pstart = start;
+ *pend = end;
+ return true;
+}
+
+
+#ifdef HAVE_SYNC_BUILTINS
+/* Similar, but doesn't require the lock held, and uses compare-and-swap
+ instead. Note that the only memory value that changes is ws->next. */
+
+bool
+gomp_iter_dynamic_next (long *pstart, long *pend)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ struct gomp_work_share *ws = thr->ts.work_share;
+ long start, end, nend, chunk, incr;
+
+ start = ws->next;
+ end = ws->end;
+ incr = ws->incr;
+ chunk = ws->chunk_size * incr;
+
+ while (1)
+ {
+ long left = end - start;
+ long tmp;
+
+ if (start == end)
+ return false;
+
+ if (incr < 0)
+ {
+ if (chunk < left)
+ chunk = left;
+ }
+ else
+ {
+ if (chunk > left)
+ chunk = left;
+ }
+ nend = start + chunk;
+
+ tmp = __sync_val_compare_and_swap (&ws->next, start, nend);
+ if (__builtin_expect (tmp == start, 1))
+ break;
+
+ start = tmp;
+ }
+
+ *pstart = start;
+ *pend = nend;
+ return true;
+}
+#endif /* HAVE_SYNC_BUILTINS */
+
+
+/* This function implements the GUIDED scheduling method. Arguments are
+ as for gomp_iter_static_next. This function must be called with the
+ work share lock held. */
+
+bool
+gomp_iter_guided_next_locked (long *pstart, long *pend)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ struct gomp_work_share *ws = thr->ts.work_share;
+ struct gomp_team *team = thr->ts.team;
+ unsigned long nthreads = team ? team->nthreads : 1;
+ unsigned long n, q;
+ long start, end;
+
+ if (ws->next == ws->end)
+ return false;
+
+ n = (ws->end - ws->next) / ws->incr;
+ q = (n + nthreads - 1) / nthreads;
+
+ if (q < ws->chunk_size)
+ q = ws->chunk_size;
+ if (q > n)
+ q = n;
+
+ start = ws->next;
+ end = start + q * ws->incr;
+
+ ws->next = end;
+ *pstart = start;
+ *pend = end;
+ return true;
+}
+
+#ifdef HAVE_SYNC_BUILTINS
+/* Similar, but doesn't require the lock held, and uses compare-and-swap
+ instead. Note that the only memory value that changes is ws->next. */
+
+bool
+gomp_iter_guided_next (long *pstart, long *pend)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ struct gomp_work_share *ws = thr->ts.work_share;
+ struct gomp_team *team = thr->ts.team;
+ unsigned long nthreads = team ? team->nthreads : 1;
+ long start, end, nend, incr;
+ unsigned long chunk_size;
+
+ start = ws->next;
+ end = ws->end;
+ incr = ws->incr;
+ chunk_size = ws->chunk_size;
+
+ while (1)
+ {
+ unsigned long n, q;
+ long tmp;
+
+ if (start == end)
+ return false;
+
+ n = (end - start) / ws->incr;
+ q = (n + nthreads - 1) / nthreads;
+
+ if (q < chunk_size)
+ q = chunk_size;
+ if (q > n)
+ q = n;
+
+ nend = start + q * incr;
+
+ tmp = __sync_val_compare_and_swap (&ws->next, start, nend);
+ if (__builtin_expect (tmp == start, 1))
+ break;
+
+ start = tmp;
+ }
+
+ *pstart = start;
+ *pend = nend;
+ return true;
+}
+#endif /* HAVE_SYNC_BUILTINS */
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This file contains data types and function declarations that are not
+ part of the official OpenMP user interface. There are declarations
+ in here that are part of the GNU OpenMP ABI, in that the compiler is
+ required to know about them and use them.
+
+ The convention is that the all caps prefix "GOMP" is used group items
+ that are part of the external ABI, and the lower case prefix "gomp"
+ is used group items that are completely private to the library. */
+
+#ifndef LIBGOMP_H
+#define LIBGOMP_H 1
+
+#include "config.h"
+
+#include <pthread.h>
+#include <stdbool.h>
+
+#ifdef HAVE_ATTRIBUTE_VISIBILITY
+# pragma GCC visibility push(hidden)
+#endif
+
+#include "sem.h"
+#include "mutex.h"
+#include "bar.h"
+
+
+/* This structure contains the data to control one work-sharing construct,
+ either a LOOP (FOR/DO) or a SECTIONS. */
+
+enum gomp_schedule_type
+{
+ GFS_STATIC,
+ GFS_DYNAMIC,
+ GFS_GUIDED,
+ GFS_RUNTIME
+};
+
+struct gomp_work_share
+{
+ /* This member records the SCHEDULE clause to be used for this construct.
+ The user specification of "runtime" will already have been resolved.
+ If this is a SECTIONS construct, this value will always be DYNAMIC. */
+ enum gomp_schedule_type sched;
+
+ /* This is the chunk_size argument to the SCHEDULE clause. */
+ long chunk_size;
+
+ /* This is the iteration end point. If this is a SECTIONS construct,
+ this is the number of contained sections. */
+ long end;
+
+ /* This is the iteration step. If this is a SECTIONS construct, this
+ is always 1. */
+ long incr;
+
+ /* This lock protects the update of the following members. */
+ gomp_mutex_t lock;
+
+ union {
+ /* This is the next iteration value to be allocated. In the case of
+ GFS_STATIC loops, this the iteration start point and never changes. */
+ long next;
+
+ /* This is the returned data structure for SINGLE COPYPRIVATE. */
+ void *copyprivate;
+ };
+
+ /* This is the count of the number of threads that have exited the work
+ share construct. If the construct was marked nowait, they have moved on
+ to other work; otherwise they're blocked on a barrier. The last member
+ of the team to exit the work share construct must deallocate it. */
+ unsigned threads_completed;
+
+ /* This is the index into the circular queue ordered_team_ids of the
+ current thread that's allowed into the ordered reason. */
+ unsigned ordered_cur;
+
+ /* This is the number of threads that have registered themselves in
+ the circular queue ordered_team_ids. */
+ unsigned ordered_num_used;
+
+ /* This is the team_id of the currently acknoledged owner of the ordered
+ section, or -1u if the ordered section has not been acknowledged by
+ any thread. This is distinguished from the thread that is *allowed*
+ to take the section next. */
+ unsigned ordered_owner;
+
+ /* This is a circular queue that details which threads will be allowed
+ into the ordered region and in which order. When a thread allocates
+ iterations on which it is going to work, it also registers itself at
+ the end of the array. When a thread reaches the ordered region, it
+ checks to see if it is the one at the head of the queue. If not, it
+ blocks on its RELEASE semaphore. */
+ unsigned ordered_team_ids[];
+};
+
+/* This structure contains all of the thread-local data associated with
+ a thread team. This is the data that must be saved when a thread
+ encounters a nested PARALLEL construct. */
+
+struct gomp_team_state
+{
+ /* This is the team of which the thread is currently a member. */
+ struct gomp_team *team;
+
+ /* This is the work share construct which this thread is currently
+ processing. Recall that with NOWAIT, not all threads may be
+ processing the same construct. This value is NULL when there
+ is no construct being processed. */
+ struct gomp_work_share *work_share;
+
+ /* This is the ID of this thread within the team. This value is
+ guaranteed to be between 0 and N-1, where N is the number of
+ threads in the team. */
+ unsigned team_id;
+
+ /* The work share "generation" is a number that increases by one for
+ each work share construct encountered in the dynamic flow of the
+ program. It is used to find the control data for the work share
+ when encountering it for the first time. This particular number
+ reflects the generation of the work_share member of this struct. */
+ unsigned work_share_generation;
+
+ /* For GFS_RUNTIME loops that resolved to GFS_STATIC, this is the
+ trip number through the loop. So first time a particular loop
+ is encountered this number is 0, the second time through the loop
+ is 1, etc. This is unused when the compiler knows in advance that
+ the loop is statically scheduled. */
+ unsigned long static_trip;
+};
+
+/* This structure describes a "team" of threads. These are the threads
+ that are spawned by a PARALLEL constructs, as well as the work sharing
+ constructs that the team encounters. */
+
+struct gomp_team
+{
+ /* This lock protects access to the following work shares data structures. */
+ gomp_mutex_t work_share_lock;
+
+ /* This is a dynamically sized array containing pointers to the control
+ structs for all "live" work share constructs. Here "live" means that
+ the construct has been encountered by at least one thread, and not
+ completed by all threads. */
+ struct gomp_work_share **work_shares;
+
+ /* The work_shares array is indexed by "generation & generation_mask".
+ The mask will be 2**N - 1, where 2**N is the size of the array. */
+ unsigned generation_mask;
+
+ /* These two values define the bounds of the elements of the work_shares
+ array that are currently in use. */
+ unsigned oldest_live_gen;
+ unsigned num_live_gen;
+
+ /* This is the number of threads in the current team. */
+ unsigned nthreads;
+
+ /* This is the saved team state that applied to a master thread before
+ the current thread was created. */
+ struct gomp_team_state prev_ts;
+
+ /* This barrier is used for most synchronization of the team. */
+ gomp_barrier_t barrier;
+
+ /* This semaphore should be used by the master thread instead of its
+ "native" semaphore in the thread structure. Required for nested
+ parallels, as the master is a member of two teams. */
+ gomp_sem_t master_release;
+
+ /* This array contains pointers to the release semaphore of the threads
+ in the team. */
+ gomp_sem_t *ordered_release[];
+};
+
+/* This structure contains all data that is private to libgomp and is
+ allocated per thread. */
+
+struct gomp_thread
+{
+ /* This is the function that the thread should run upon launch. */
+ void (*fn) (void *data);
+ void *data;
+
+ /* This is the current team state for this thread. The ts.team member
+ is NULL only if the thread is idle. */
+ struct gomp_team_state ts;
+
+ /* This semaphore is used for ordered loops. */
+ gomp_sem_t release;
+};
+
+/* ... and here is that TLS data. */
+
+#ifdef HAVE_TLS
+extern __thread struct gomp_thread gomp_tls_data;
+static inline struct gomp_thread *gomp_thread (void)
+{
+ return &gomp_tls_data;
+}
+#else
+extern pthread_key_t gomp_tls_key;
+static inline struct gomp_thread *gomp_thread (void)
+{
+ return pthread_getspecific (gomp_tls_key);
+}
+#endif
+
+/* These are the OpenMP 2.5 internal control variables described in
+ section 2.3. At least those that correspond to environment variables. */
+
+extern unsigned gomp_nthreads_var;
+extern bool gomp_dyn_var;
+extern bool gomp_nest_var;
+extern enum gomp_schedule_type gomp_run_sched_var;
+extern unsigned gomp_run_sched_chunk;
+
+/* Function prototypes. */
+
+/* alloc.c */
+
+extern void *gomp_malloc (size_t) __attribute__((malloc));
+extern void *gomp_malloc_cleared (size_t) __attribute__((malloc));
+extern void *gomp_realloc (void *, size_t);
+
+/* error.c */
+
+extern void gomp_error (const char *, ...)
+ __attribute__((format (printf, 1, 2)));
+extern void gomp_fatal (const char *, ...)
+ __attribute__((noreturn, format (printf, 1, 2)));
+
+/* iter.c */
+
+extern int gomp_iter_static_next (long *, long *);
+extern bool gomp_iter_dynamic_next_locked (long *, long *);
+extern bool gomp_iter_guided_next_locked (long *, long *);
+
+#ifdef HAVE_SYNC_BUILTINS
+extern bool gomp_iter_dynamic_next (long *, long *);
+extern bool gomp_iter_guided_next (long *, long *);
+#endif
+
+/* ordered.c */
+
+extern void gomp_ordered_first (void);
+extern void gomp_ordered_last (void);
+extern void gomp_ordered_next (void);
+extern void gomp_ordered_static_init (void);
+extern void gomp_ordered_static_next (void);
+extern void gomp_ordered_sync (void);
+
+/* parallel.c */
+
+extern unsigned gomp_resolve_num_threads (unsigned);
+
+/* proc.c (in config/) */
+
+extern void gomp_init_num_threads (void);
+extern unsigned gomp_dynamic_max_threads (void);
+
+/* team.c */
+
+extern void gomp_team_start (void (*) (void *), void *, unsigned,
+ struct gomp_work_share *);
+extern void gomp_team_end (void);
+
+/* work.c */
+
+extern struct gomp_work_share * gomp_new_work_share (bool, unsigned);
+extern bool gomp_work_share_start (bool);
+extern void gomp_work_share_end (void);
+extern void gomp_work_share_end_nowait (void);
+
+#ifdef HAVE_ATTRIBUTE_VISIBILITY
+# pragma GCC visibility pop
+#endif
+
+/* Now that we're back to default visibility, include the globals. */
+#include "libgomp_g.h"
+
+/* Include omp.h by parts. */
+#include "omp-lock.h"
+#define _LIBGOMP_OMP_LOCK_DEFINED 1
+#include "omp.h.in"
+
+#ifdef HAVE_ATTRIBUTE_VISIBILITY
+# define attribute_hidden __attribute__ ((visibility ("hidden")))
+#else
+# define attribute_hidden
+#endif
+
+#ifdef HAVE_ATTRIBUTE_ALIAS
+# define ialias(fn) \
+ extern __typeof (fn) gomp_ialias_##fn \
+ __attribute__ ((alias (#fn))) attribute_hidden;
+#else
+# define ialias(fn)
+#endif
+
+#endif /* LIBGOMP_H */
--- /dev/null
+OMP_1.0 {
+ global:
+ omp_set_num_threads;
+ omp_get_num_threads;
+ omp_get_max_threads;
+ omp_get_thread_num;
+ omp_get_num_procs;
+ omp_in_parallel;
+ omp_set_dynamic;
+ omp_get_dynamic;
+ omp_set_nested;
+ omp_get_nested;
+ omp_init_lock;
+ omp_init_nest_lock;
+ omp_destroy_lock;
+ omp_destroy_nest_lock;
+ omp_set_lock;
+ omp_set_nest_lock;
+ omp_unset_lock;
+ omp_unset_nest_lock;
+ omp_test_lock;
+ omp_test_nest_lock;
+ omp_destroy_lock_;
+ omp_destroy_nest_lock_;
+ omp_get_dynamic_;
+ omp_get_max_threads_;
+ omp_get_nested_;
+ omp_get_num_procs_;
+ omp_get_num_threads_;
+ omp_get_thread_num_;
+ omp_in_parallel_;
+ omp_init_lock_;
+ omp_init_nest_lock_;
+ omp_set_dynamic_;
+ omp_set_dynamic_8_;
+ omp_set_lock_;
+ omp_set_nest_lock_;
+ omp_set_nested_;
+ omp_set_nested_8_;
+ omp_set_num_threads_;
+ omp_set_num_threads_8_;
+ omp_test_lock_;
+ omp_test_nest_lock_;
+ omp_unset_lock_;
+ omp_unset_nest_lock_;
+ local:
+ *;
+};
+
+OMP_2.0 {
+ global:
+ omp_get_wtick;
+ omp_get_wtime;
+ omp_get_wtick_;
+ omp_get_wtime_;
+} OMP_1.0;
+
+GOMP_1.0 {
+ global:
+ GOMP_atomic_end;
+ GOMP_atomic_start;
+ GOMP_barrier;
+ GOMP_critical_end;
+ GOMP_critical_name_end;
+ GOMP_critical_name_start;
+ GOMP_critical_start;
+ GOMP_loop_dynamic_next;
+ GOMP_loop_dynamic_start;
+ GOMP_loop_end;
+ GOMP_loop_end_nowait;
+ GOMP_loop_guided_next;
+ GOMP_loop_guided_start;
+ GOMP_loop_ordered_dynamic_first;
+ GOMP_loop_ordered_dynamic_next;
+ GOMP_loop_ordered_dynamic_start;
+ GOMP_loop_ordered_guided_first;
+ GOMP_loop_ordered_guided_next;
+ GOMP_loop_ordered_guided_start;
+ GOMP_loop_ordered_runtime_first;
+ GOMP_loop_ordered_runtime_next;
+ GOMP_loop_ordered_runtime_start;
+ GOMP_loop_ordered_static_first;
+ GOMP_loop_ordered_static_next;
+ GOMP_loop_ordered_static_start;
+ GOMP_loop_runtime_next;
+ GOMP_loop_runtime_start;
+ GOMP_loop_static_next;
+ GOMP_loop_static_start;
+ GOMP_ordered_end;
+ GOMP_ordered_start;
+ GOMP_parallel_end;
+ GOMP_parallel_loop_dynamic_start;
+ GOMP_parallel_loop_guided_start;
+ GOMP_parallel_loop_runtime_start;
+ GOMP_parallel_loop_static_start;
+ GOMP_parallel_sections_start;
+ GOMP_parallel_start;
+ GOMP_sections_end;
+ GOMP_sections_end_nowait;
+ GOMP_sections_next;
+ GOMP_sections_start;
+ GOMP_single_copy_end;
+ GOMP_single_copy_start;
+ GOMP_single_start;
+};
--- /dev/null
+# This spec file is read by gcc when linking. It is used to specify the
+# standard libraries we need in order to link with -fopenmp.
+*link_gomp: @link_gomp@
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Jakub Jelinek <jakub@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This file contains prototypes of functions in the external ABI.
+ This file is included by files in the testsuite. */
+
+#ifndef LIBGOMP_F_H
+#define LIBGOMP_F_H 1
+
+#include "libgomp.h"
+#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#if HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+
+#if (OMP_LOCK_SIZE == OMP_LOCK_KIND) \
+ && (OMP_LOCK_ALIGN <= OMP_LOCK_SIZE)
+# define OMP_LOCK_DIRECT
+typedef omp_lock_t *omp_lock_arg_t;
+# define omp_lock_arg(arg) (arg)
+#else
+typedef union { omp_lock_t *lock; uint64_t u; } *omp_lock_arg_t;
+# define omp_lock_arg(arg) ((arg)->lock)
+# endif
+
+#if (OMP_NEST_LOCK_SIZE == OMP_NEST_LOCK_KIND) \
+ && (OMP_NEST_LOCK_ALIGN <= OMP_NEST_LOCK_SIZE)
+# define OMP_NEST_LOCK_DIRECT
+typedef omp_nest_lock_t *omp_nest_lock_arg_t;
+# define omp_nest_lock_arg(arg) (arg)
+#else
+typedef union { omp_nest_lock_t *lock; uint64_t u; } *omp_nest_lock_arg_t;
+# define omp_nest_lock_arg(arg) ((arg)->lock)
+# endif
+
+static inline void
+omp_check_defines (void)
+{
+ char test[(OMP_LOCK_SIZE != sizeof (omp_lock_t)
+ || OMP_LOCK_ALIGN != __alignof (omp_lock_t)
+ || OMP_NEST_LOCK_SIZE != sizeof (omp_nest_lock_t)
+ || OMP_NEST_LOCK_ALIGN != __alignof (omp_nest_lock_t)
+ || OMP_LOCK_KIND != sizeof (*(omp_lock_arg_t) 0)
+ || OMP_NEST_LOCK_KIND != sizeof (*(omp_nest_lock_arg_t) 0))
+ ? -1 : 1] __attribute__ ((__unused__));
+}
+
+#endif /* LIBGOMP_F_H */
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This file contains prototypes of functions in the external ABI.
+ This file is included by files in the testsuite. */
+
+#ifndef LIBGOMP_G_H
+#define LIBGOMP_G_H 1
+
+#include <stdbool.h>
+
+/* barrier.c */
+
+extern void GOMP_barrier (void);
+
+/* critical.c */
+
+extern void GOMP_critical_start (void);
+extern void GOMP_critical_end (void);
+extern void GOMP_critical_name_start (void **);
+extern void GOMP_critical_name_end (void **);
+extern void GOMP_atomic_start (void);
+extern void GOMP_atomic_end (void);
+
+/* loop.c */
+
+extern bool GOMP_loop_static_start (long, long, long, long, long *, long *);
+extern bool GOMP_loop_dynamic_start (long, long, long, long, long *, long *);
+extern bool GOMP_loop_guided_start (long, long, long, long, long *, long *);
+extern bool GOMP_loop_runtime_start (long, long, long, long *, long *);
+
+extern bool GOMP_loop_ordered_static_start (long, long, long, long,
+ long *, long *);
+extern bool GOMP_loop_ordered_dynamic_start (long, long, long, long,
+ long *, long *);
+extern bool GOMP_loop_ordered_guided_start (long, long, long, long,
+ long *, long *);
+extern bool GOMP_loop_ordered_runtime_start (long, long, long, long *, long *);
+
+extern bool GOMP_loop_static_next (long *, long *);
+extern bool GOMP_loop_dynamic_next (long *, long *);
+extern bool GOMP_loop_guided_next (long *, long *);
+extern bool GOMP_loop_runtime_next (long *, long *);
+
+extern bool GOMP_loop_ordered_static_next (long *, long *);
+extern bool GOMP_loop_ordered_dynamic_next (long *, long *);
+extern bool GOMP_loop_ordered_guided_next (long *, long *);
+extern bool GOMP_loop_ordered_runtime_next (long *, long *);
+
+extern void GOMP_parallel_loop_static_start (void (*)(void *), void *,
+ unsigned, long, long, long, long);
+extern void GOMP_parallel_loop_dynamic_start (void (*)(void *), void *,
+ unsigned, long, long, long, long);
+extern void GOMP_parallel_loop_guided_start (void (*)(void *), void *,
+ unsigned, long, long, long, long);
+extern void GOMP_parallel_loop_runtime_start (void (*)(void *), void *,
+ unsigned, long, long, long);
+
+extern void GOMP_loop_end (void);
+extern void GOMP_loop_end_nowait (void);
+
+/* ordered.c */
+
+extern void GOMP_ordered_start (void);
+extern void GOMP_ordered_end (void);
+
+/* parallel.c */
+
+extern void GOMP_parallel_start (void (*) (void *), void *, unsigned);
+extern void GOMP_parallel_end (void);
+
+/* sections.c */
+
+extern unsigned GOMP_sections_start (unsigned);
+extern unsigned GOMP_sections_next (void);
+extern void GOMP_parallel_sections_start (void (*) (void *), void *,
+ unsigned, unsigned);
+extern void GOMP_sections_end (void);
+extern void GOMP_sections_end_nowait (void);
+
+/* single.c */
+
+extern bool GOMP_single_start (void);
+extern void *GOMP_single_copy_start (void);
+extern void GOMP_single_copy_end (void *);
+
+#endif /* LIBGOMP_G_H */
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This file handles the LOOP (FOR/DO) construct. */
+
+#include "libgomp.h"
+#include <stdlib.h>
+
+
+/* Initialize the given work share construct from the given arguments. */
+
+static inline void
+gomp_loop_init (struct gomp_work_share *ws, unsigned long start,
+ unsigned long end, unsigned long incr,
+ enum gomp_schedule_type sched, unsigned long chunk_size)
+{
+ ws->sched = sched;
+ ws->chunk_size = chunk_size;
+ ws->end = end;
+ ws->incr = incr;
+ ws->next = start;
+}
+
+/* The *_start routines are called when first encountering a loop construct
+ that is not bound directly to a parallel construct. The first thread
+ that arrives will create the work-share construct; subsequent threads
+ will see the construct exists and allocate work from it.
+
+ START, END, INCR are the bounds of the loop; due to the restrictions of
+ OpenMP, these values must be the same in every thread. This is not
+ verified (nor is it entirely verifiable, since START is not necessarily
+ retained intact in the work-share data structure). CHUNK_SIZE is the
+ scheduling parameter; again this must be identical in all threads.
+
+ Returns true if there's any work for this thread to perform. If so,
+ *ISTART and *IEND are filled with the bounds of the iteration block
+ allocated to this thread. Returns false if all work was assigned to
+ other threads prior to this thread's arrival. */
+
+static bool
+gomp_loop_static_start (long start, long end, long incr, long chunk_size,
+ long *istart, long *iend)
+{
+ struct gomp_thread *thr = gomp_thread ();
+
+ if (gomp_work_share_start (false))
+ gomp_loop_init (thr->ts.work_share, start, end, incr,
+ GFS_STATIC, chunk_size);
+ gomp_mutex_unlock (&thr->ts.work_share->lock);
+
+ return !gomp_iter_static_next (istart, iend);
+}
+
+static bool
+gomp_loop_dynamic_start (long start, long end, long incr, long chunk_size,
+ long *istart, long *iend)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ bool ret;
+
+ if (gomp_work_share_start (false))
+ gomp_loop_init (thr->ts.work_share, start, end, incr,
+ GFS_DYNAMIC, chunk_size);
+
+#ifdef HAVE_SYNC_BUILTINS
+ gomp_mutex_unlock (&thr->ts.work_share->lock);
+ ret = gomp_iter_dynamic_next (istart, iend);
+#else
+ ret = gomp_iter_dynamic_next_locked (istart, iend);
+ gomp_mutex_unlock (&thr->ts.work_share->lock);
+#endif
+
+ return ret;
+}
+
+static bool
+gomp_loop_guided_start (long start, long end, long incr, long chunk_size,
+ long *istart, long *iend)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ bool ret;
+
+ if (gomp_work_share_start (false))
+ gomp_loop_init (thr->ts.work_share, start, end, incr,
+ GFS_GUIDED, chunk_size);
+
+#ifdef HAVE_SYNC_BUILTINS
+ gomp_mutex_unlock (&thr->ts.work_share->lock);
+ ret = gomp_iter_guided_next (istart, iend);
+#else
+ ret = gomp_iter_guided_next_locked (istart, iend);
+ gomp_mutex_unlock (&thr->ts.work_share->lock);
+#endif
+
+ return ret;
+}
+
+bool
+GOMP_loop_runtime_start (long start, long end, long incr,
+ long *istart, long *iend)
+{
+ switch (gomp_run_sched_var)
+ {
+ case GFS_STATIC:
+ return gomp_loop_static_start (start, end, incr, gomp_run_sched_chunk,
+ istart, iend);
+ case GFS_DYNAMIC:
+ return gomp_loop_dynamic_start (start, end, incr, gomp_run_sched_chunk,
+ istart, iend);
+ case GFS_GUIDED:
+ return gomp_loop_guided_start (start, end, incr, gomp_run_sched_chunk,
+ istart, iend);
+ default:
+ abort ();
+ }
+}
+
+/* The *_ordered_*_start routines are similar. The only difference is that
+ this work-share construct is initialized to expect an ORDERED section. */
+
+static bool
+gomp_loop_ordered_static_start (long start, long end, long incr,
+ long chunk_size, long *istart, long *iend)
+{
+ struct gomp_thread *thr = gomp_thread ();
+
+ if (start == end)
+ return false;
+
+ if (gomp_work_share_start (true))
+ {
+ gomp_loop_init (thr->ts.work_share, start, end, incr,
+ GFS_STATIC, chunk_size);
+ gomp_ordered_static_init ();
+ }
+ gomp_mutex_unlock (&thr->ts.work_share->lock);
+
+ return !gomp_iter_static_next (istart, iend);
+}
+
+static bool
+gomp_loop_ordered_dynamic_start (long start, long end, long incr,
+ long chunk_size, long *istart, long *iend)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ bool ret;
+
+ if (gomp_work_share_start (true))
+ gomp_loop_init (thr->ts.work_share, start, end, incr,
+ GFS_DYNAMIC, chunk_size);
+
+ ret = gomp_iter_dynamic_next_locked (istart, iend);
+ if (ret)
+ gomp_ordered_first ();
+ gomp_mutex_unlock (&thr->ts.work_share->lock);
+
+ return ret;
+}
+
+static bool
+gomp_loop_ordered_guided_start (long start, long end, long incr,
+ long chunk_size, long *istart, long *iend)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ bool ret;
+
+ if (gomp_work_share_start (true))
+ gomp_loop_init (thr->ts.work_share, start, end, incr,
+ GFS_GUIDED, chunk_size);
+
+ ret = gomp_iter_guided_next_locked (istart, iend);
+ if (ret)
+ gomp_ordered_first ();
+ gomp_mutex_unlock (&thr->ts.work_share->lock);
+
+ return ret;
+}
+
+bool
+GOMP_loop_ordered_runtime_start (long start, long end, long incr,
+ long *istart, long *iend)
+{
+ switch (gomp_run_sched_var)
+ {
+ case GFS_STATIC:
+ return gomp_loop_ordered_static_start (start, end, incr,
+ gomp_run_sched_chunk,
+ istart, iend);
+ case GFS_DYNAMIC:
+ return gomp_loop_ordered_dynamic_start (start, end, incr,
+ gomp_run_sched_chunk,
+ istart, iend);
+ case GFS_GUIDED:
+ return gomp_loop_ordered_guided_start (start, end, incr,
+ gomp_run_sched_chunk,
+ istart, iend);
+ default:
+ abort ();
+ }
+}
+
+/* The *_next routines are called when the thread completes processing of
+ the iteration block currently assigned to it. If the work-share
+ construct is bound directly to a parallel construct, then the iteration
+ bounds may have been set up before the parallel. In which case, this
+ may be the first iteration for the thread.
+
+ Returns true if there is work remaining to be performed; *ISTART and
+ *IEND are filled with a new iteration block. Returns false if all work
+ has been assigned. */
+
+static bool
+gomp_loop_static_next (long *istart, long *iend)
+{
+ return !gomp_iter_static_next (istart, iend);
+}
+
+static bool
+gomp_loop_dynamic_next (long *istart, long *iend)
+{
+ bool ret;
+
+#ifdef HAVE_SYNC_BUILTINS
+ ret = gomp_iter_dynamic_next (istart, iend);
+#else
+ struct gomp_thread *thr = gomp_thread ();
+ gomp_mutex_lock (&thr->ts.work_share->lock);
+ ret = gomp_iter_dynamic_next_locked (istart, iend);
+ gomp_mutex_unlock (&thr->ts.work_share->lock);
+#endif
+
+ return ret;
+}
+
+static bool
+gomp_loop_guided_next (long *istart, long *iend)
+{
+ bool ret;
+
+#ifdef HAVE_SYNC_BUILTINS
+ ret = gomp_iter_guided_next (istart, iend);
+#else
+ struct gomp_thread *thr = gomp_thread ();
+ gomp_mutex_lock (&thr->ts.work_share->lock);
+ ret = gomp_iter_guided_next_locked (istart, iend);
+ gomp_mutex_unlock (&thr->ts.work_share->lock);
+#endif
+
+ return ret;
+}
+
+bool
+GOMP_loop_runtime_next (long *istart, long *iend)
+{
+ struct gomp_thread *thr = gomp_thread ();
+
+ switch (thr->ts.work_share->sched)
+ {
+ case GFS_STATIC:
+ return gomp_loop_static_next (istart, iend);
+ case GFS_DYNAMIC:
+ return gomp_loop_dynamic_next (istart, iend);
+ case GFS_GUIDED:
+ return gomp_loop_guided_next (istart, iend);
+ default:
+ abort ();
+ }
+}
+
+/* The *_ordered_*_next routines are called when the thread completes
+ processing of the iteration block currently assigned to it.
+
+ Returns true if there is work remaining to be performed; *ISTART and
+ *IEND are filled with a new iteration block. Returns false if all work
+ has been assigned. */
+
+static bool
+gomp_loop_ordered_static_next (long *istart, long *iend)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ int test;
+
+ gomp_ordered_sync ();
+ gomp_mutex_lock (&thr->ts.work_share->lock);
+ test = gomp_iter_static_next (istart, iend);
+ if (test >= 0)
+ gomp_ordered_static_next ();
+ gomp_mutex_unlock (&thr->ts.work_share->lock);
+
+ return test == 0;
+}
+
+static bool
+gomp_loop_ordered_dynamic_next (long *istart, long *iend)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ bool ret;
+
+ gomp_ordered_sync ();
+ gomp_mutex_lock (&thr->ts.work_share->lock);
+ ret = gomp_iter_dynamic_next_locked (istart, iend);
+ if (ret)
+ gomp_ordered_next ();
+ else
+ gomp_ordered_last ();
+ gomp_mutex_unlock (&thr->ts.work_share->lock);
+
+ return ret;
+}
+
+static bool
+gomp_loop_ordered_guided_next (long *istart, long *iend)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ bool ret;
+
+ gomp_ordered_sync ();
+ gomp_mutex_lock (&thr->ts.work_share->lock);
+ ret = gomp_iter_guided_next_locked (istart, iend);
+ if (ret)
+ gomp_ordered_next ();
+ else
+ gomp_ordered_last ();
+ gomp_mutex_unlock (&thr->ts.work_share->lock);
+
+ return ret;
+}
+
+bool
+GOMP_loop_ordered_runtime_next (long *istart, long *iend)
+{
+ struct gomp_thread *thr = gomp_thread ();
+
+ switch (thr->ts.work_share->sched)
+ {
+ case GFS_STATIC:
+ return gomp_loop_ordered_static_next (istart, iend);
+ case GFS_DYNAMIC:
+ return gomp_loop_ordered_dynamic_next (istart, iend);
+ case GFS_GUIDED:
+ return gomp_loop_ordered_guided_next (istart, iend);
+ default:
+ abort ();
+ }
+}
+
+/* The GOMP_parallel_loop_* routines pre-initialize a work-share construct
+ to avoid one synchronization once we get into the loop. */
+
+static void
+gomp_parallel_loop_start (void (*fn) (void *), void *data,
+ unsigned num_threads, long start, long end,
+ long incr, enum gomp_schedule_type sched,
+ long chunk_size)
+{
+ struct gomp_work_share *ws;
+
+ num_threads = gomp_resolve_num_threads (num_threads);
+ ws = gomp_new_work_share (false, num_threads);
+ gomp_loop_init (ws, start, end, incr, sched, chunk_size);
+ gomp_team_start (fn, data, num_threads, ws);
+}
+
+void
+GOMP_parallel_loop_static_start (void (*fn) (void *), void *data,
+ unsigned num_threads, long start, long end,
+ long incr, long chunk_size)
+{
+ gomp_parallel_loop_start (fn, data, num_threads, start, end, incr,
+ GFS_STATIC, chunk_size);
+}
+
+void
+GOMP_parallel_loop_dynamic_start (void (*fn) (void *), void *data,
+ unsigned num_threads, long start, long end,
+ long incr, long chunk_size)
+{
+ gomp_parallel_loop_start (fn, data, num_threads, start, end, incr,
+ GFS_DYNAMIC, chunk_size);
+}
+
+void
+GOMP_parallel_loop_guided_start (void (*fn) (void *), void *data,
+ unsigned num_threads, long start, long end,
+ long incr, long chunk_size)
+{
+ gomp_parallel_loop_start (fn, data, num_threads, start, end, incr,
+ GFS_GUIDED, chunk_size);
+}
+
+void
+GOMP_parallel_loop_runtime_start (void (*fn) (void *), void *data,
+ unsigned num_threads, long start, long end,
+ long incr)
+{
+ gomp_parallel_loop_start (fn, data, num_threads, start, end, incr,
+ gomp_run_sched_var, gomp_run_sched_chunk);
+}
+
+/* The GOMP_loop_end* routines are called after the thread is told that
+ all loop iterations are complete. This first version synchronizes
+ all threads; the nowait version does not. */
+
+void
+GOMP_loop_end (void)
+{
+ gomp_work_share_end ();
+}
+
+void
+GOMP_loop_end_nowait (void)
+{
+ gomp_work_share_end_nowait ();
+}
+
+
+/* We use static functions above so that we're sure that the "runtime"
+ function can defer to the proper routine without interposition. We
+ export the static function with a strong alias when possible, or with
+ a wrapper function otherwise. */
+
+#ifdef HAVE_ATTRIBUTE_ALIAS
+extern __typeof(gomp_loop_static_start) GOMP_loop_static_start
+ __attribute__((alias ("gomp_loop_static_start")));
+extern __typeof(gomp_loop_dynamic_start) GOMP_loop_dynamic_start
+ __attribute__((alias ("gomp_loop_dynamic_start")));
+extern __typeof(gomp_loop_guided_start) GOMP_loop_guided_start
+ __attribute__((alias ("gomp_loop_guided_start")));
+
+extern __typeof(gomp_loop_ordered_static_start) GOMP_loop_ordered_static_start
+ __attribute__((alias ("gomp_loop_ordered_static_start")));
+extern __typeof(gomp_loop_ordered_dynamic_start) GOMP_loop_ordered_dynamic_start
+ __attribute__((alias ("gomp_loop_ordered_dynamic_start")));
+extern __typeof(gomp_loop_ordered_guided_start) GOMP_loop_ordered_guided_start
+ __attribute__((alias ("gomp_loop_ordered_guided_start")));
+
+extern __typeof(gomp_loop_static_next) GOMP_loop_static_next
+ __attribute__((alias ("gomp_loop_static_next")));
+extern __typeof(gomp_loop_dynamic_next) GOMP_loop_dynamic_next
+ __attribute__((alias ("gomp_loop_dynamic_next")));
+extern __typeof(gomp_loop_guided_next) GOMP_loop_guided_next
+ __attribute__((alias ("gomp_loop_guided_next")));
+
+extern __typeof(gomp_loop_ordered_static_next) GOMP_loop_ordered_static_next
+ __attribute__((alias ("gomp_loop_ordered_static_next")));
+extern __typeof(gomp_loop_ordered_dynamic_next) GOMP_loop_ordered_dynamic_next
+ __attribute__((alias ("gomp_loop_ordered_dynamic_next")));
+extern __typeof(gomp_loop_ordered_guided_next) GOMP_loop_ordered_guided_next
+ __attribute__((alias ("gomp_loop_ordered_guided_next")));
+#else
+bool
+GOMP_loop_static_start (long start, long end, long incr, long chunk_size,
+ long *istart, long *iend)
+{
+ return gomp_loop_static_start (start, end, incr, chunk_size, istart, iend);
+}
+
+bool
+GOMP_loop_dynamic_start (long start, long end, long incr, long chunk_size,
+ long *istart, long *iend)
+{
+ return gomp_loop_dynamic_start (start, end, incr, chunk_size, istart, iend);
+}
+
+bool
+GOMP_loop_guided_start (long start, long end, long incr, long chunk_size,
+ long *istart, long *iend)
+{
+ return gomp_loop_guided_start (start, end, incr, chunk_size, istart, iend);
+}
+
+bool
+GOMP_loop_ordered_static_start (long start, long end, long incr,
+ long chunk_size, long *istart, long *iend)
+{
+ return gomp_loop_ordered_static_start (start, end, incr, chunk_size,
+ istart, iend);
+}
+
+bool
+GOMP_loop_ordered_dynamic_start (long start, long end, long incr,
+ long chunk_size, long *istart, long *iend)
+{
+ return gomp_loop_ordered_dynamic_start (start, end, incr, chunk_size,
+ istart, iend);
+}
+
+bool
+GOMP_loop_ordered_guided_start (long start, long end, long incr,
+ long chunk_size, long *istart, long *iend)
+{
+ return gomp_loop_ordered_guided_start (start, end, incr, chunk_size,
+ istart, iend);
+}
+
+bool
+GOMP_loop_static_next (long *istart, long *iend)
+{
+ return gomp_loop_static_next (istart, iend);
+}
+
+bool
+GOMP_loop_dynamic_next (long *istart, long *iend)
+{
+ return gomp_loop_dynamic_next (istart, iend);
+}
+
+bool
+GOMP_loop_guided_next (long *istart, long *iend)
+{
+ return gomp_loop_guided_next (istart, iend);
+}
+
+bool
+GOMP_loop_ordered_static_next (long *istart, long *iend)
+{
+ return gomp_loop_ordered_static_next (istart, iend);
+}
+
+bool
+GOMP_loop_ordered_dynamic_next (long *istart, long *iend)
+{
+ return gomp_loop_ordered_dynamic_next (istart, iend);
+}
+
+bool
+GOMP_loop_ordered_guided_next (long *istart, long *iend)
+{
+ return gomp_loop_ordered_guided_next (istart, iend);
+}
+#endif
--- /dev/null
+#!/usr/bin/perl -w
+# Copyright (C) 2005 Free Software Foundation, Inc.
+# Contributed by Richard Henderson <rth@redhat.com>.
+#
+# This file is part of the GNU OpenMP Library (libgomp).
+#
+# Libgomp is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# Libgomp 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 Lesser General Public License for
+# more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with libgomp; see the file COPYING.LIB. If not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# As a special exception, if you link this library with other files, some
+# of which are compiled with GCC, to produce an executable, this library
+# does not by itself cause the resulting executable to be covered by the
+# GNU General Public License. This exception does not however invalidate
+# any other reasons why the executable file might be covered by the GNU
+# General Public License.
+
+# This file fills in the blanks for omp.h.in, computing the size and
+# alignment of the lock types that we export. We do this to avoid
+# polluting the namespace with e.g. pthreads declarations.
+
+$COMPILE = $ARGV[0];
+$INFILE = $ARGV[1];
+$OUTFILE = $ARGV[2];
+
+$HEADER = "#include \"omp-lock.h\"\n";
+
+# configure might put libtool specific options into $COMPILE.
+$COMPILE =~ s/ -Wc,/ /g;
+
+# Close stderr in order to discard compiler errors. Which we expect apleanty.
+close STDERR;
+
+# Return true if the boolean expression evaluates true at compile-time.
+sub compile_test {
+ my $expr = shift;
+
+ open GCC, "|$COMPILE -fsyntax-only -xc -";
+ print GCC $HEADER;
+ print GCC "char test[($expr) ? 1 : -1];\n";
+ return close GCC;
+}
+
+# Return a number guaranteed to be larger than the integer epression.
+sub upper_bound {
+ use integer;
+ my $expr = shift;
+ my $max = 9;
+
+ while (compile_test("($expr) >= $max")) {
+ $max = $max * 2;
+ }
+
+ return $max;
+}
+
+# Return an exact number for the integer expression.
+sub binary_search {
+ use integer;
+ my $expr = shift;
+ my $low = 1;
+ my $high = upper_bound($expr);
+
+ while ($low < $high) {
+ my $mid = ($high + $low + 1) / 2;
+ if (compile_test("($expr) >= $mid")) {
+ $low = $mid;
+ } else {
+ $high = $mid - 1;
+ }
+ }
+
+ return $low;
+}
+
+# Apply OP to TYPE, where OP is either sizeof or __alignof.
+sub resolve {
+ my $op = shift;
+ my $type = shift;
+
+ return binary_search("$op($type)");
+}
+
+# Find all the constants we need.
+$sizeof_omp_lock_t = resolve ("sizeof", "omp_lock_t");
+$alignof_omp_lock_t = resolve ("__alignof", "omp_lock_t");
+$sizeof_omp_nest_lock_t = resolve ("sizeof", "omp_nest_lock_t");
+$alignof_omp_nest_lock_t = resolve ("__alignof", "omp_nest_lock_t");
+$omp_lock_kind = $sizeof_omp_lock_t;
+$omp_nest_lock_kind = $sizeof_omp_nest_lock_t;
+if ($sizeof_omp_lock_t >= 8 || $alignof_omp_lock_t > $sizeof_omp_lock_t) {
+ $omp_lock_kind = 8;
+}
+if ($sizeof_omp_nest_lock_t >= 8 || $alignof_omp_nest_lock_t > $sizeof_omp_nest_lock_t) {
+ $omp_nest_lock_kind = 8;
+}
+
+# Edit the input template into the output.
+open IN, "<", $INFILE;
+open OUT, ">", $OUTFILE;
+while (<IN>) {
+ s/OMP_LOCK_SIZE/$sizeof_omp_lock_t/o;
+ s/OMP_LOCK_ALIGN/$alignof_omp_lock_t/o;
+ s/OMP_NEST_LOCK_SIZE/$sizeof_omp_nest_lock_t/o;
+ s/OMP_NEST_LOCK_ALIGN/$alignof_omp_nest_lock_t/o;
+ s/OMP_LOCK_KIND/$omp_lock_kind/o;
+ s/OMP_NEST_LOCK_KIND/$omp_nest_lock_kind/o;
+ print OUT;
+}
+
+close OUT;
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+#ifndef OMP_H
+#define OMP_H 1
+
+#ifndef _LIBGOMP_OMP_LOCK_DEFINED
+#define _LIBGOMP_OMP_LOCK_DEFINED 1
+/* These two structures get edited by the libgomp build process to
+ reflect the shape of the two types. Their internals are private
+ to the library. */
+
+typedef struct
+{
+ unsigned char _x[OMP_LOCK_SIZE] __attribute__((__aligned__(OMP_LOCK_ALIGN)));
+} omp_lock_t;
+
+typedef struct
+{
+ unsigned char _x[OMP_NEST_LOCK_SIZE] __attribute__((__aligned__(OMP_NEST_LOCK_ALIGN)));
+} omp_nest_lock_t;
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void omp_set_num_threads (int);
+extern int omp_get_num_threads (void);
+extern int omp_get_max_threads (void);
+extern int omp_get_thread_num (void);
+extern int omp_get_num_procs (void);
+
+extern int omp_in_parallel (void);
+
+extern void omp_set_dynamic (int);
+extern int omp_get_dynamic (void);
+
+extern void omp_set_nested (int);
+extern int omp_get_nested (void);
+
+extern void omp_init_lock (omp_lock_t *);
+extern void omp_destroy_lock (omp_lock_t *);
+extern void omp_set_lock (omp_lock_t *);
+extern void omp_unset_lock (omp_lock_t *);
+extern int omp_test_lock (omp_lock_t *);
+
+extern void omp_init_nest_lock (omp_nest_lock_t *);
+extern void omp_destroy_nest_lock (omp_nest_lock_t *);
+extern void omp_set_nest_lock (omp_nest_lock_t *);
+extern void omp_unset_nest_lock (omp_nest_lock_t *);
+extern int omp_test_nest_lock (omp_nest_lock_t *);
+
+extern double omp_get_wtime (void);
+extern double omp_get_wtick (void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* OMP_H */
--- /dev/null
+! Copyright (C) 2005 Free Software Foundation, Inc.
+! Contributed by Jakub Jelinek <jakub@redhat.com>.
+
+! This file is part of the GNU OpenMP Library (libgomp).
+
+! Libgomp is free software; you can redistribute it and/or modify it
+! under the terms of the GNU Lesser General Public License as published by
+! the Free Software Foundation; either version 2.1 of the License, or
+! (at your option) any later version.
+
+! Libgomp 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 Lesser General Public License for
+! more details.
+
+! You should have received a copy of the GNU Lesser General Public License
+! along with libgomp; see the file COPYING.LIB. If not, write to the
+! Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+! MA 02110-1301, USA. */
+
+! As a special exception, if you link this library with other files, some
+! of which are compiled with GCC, to produce an executable, this library
+! does not by itself cause the resulting executable to be covered by the
+! GNU General Public License. This exception does not however invalidate
+! any other reasons why the executable file might be covered by the GNU
+! General Public License.
+
+ module omp_lib_kinds
+ integer, parameter :: omp_integer_kind = 4
+ integer, parameter :: omp_logical_kind = 4
+ integer, parameter :: omp_lock_kind = OMP_LOCK_KIND
+ integer, parameter :: omp_nest_lock_kind = OMP_NEST_LOCK_KIND
+ end module
+
+ module omp_lib
+ use omp_lib_kinds
+ integer, parameter :: openmp_version = 200505
+
+ interface
+ subroutine omp_init_lock (lock)
+ use omp_lib_kinds
+ integer (omp_lock_kind), intent (out) :: lock
+ end subroutine omp_init_lock
+ end interface
+
+ interface
+ subroutine omp_init_nest_lock (lock)
+ use omp_lib_kinds
+ integer (omp_nest_lock_kind), intent (out) :: lock
+ end subroutine omp_init_nest_lock
+ end interface
+
+ interface
+ subroutine omp_destroy_lock (lock)
+ use omp_lib_kinds
+ integer (omp_lock_kind), intent (inout) :: lock
+ end subroutine omp_destroy_lock
+ end interface
+
+ interface
+ subroutine omp_destroy_nest_lock (lock)
+ use omp_lib_kinds
+ integer (omp_nest_lock_kind), intent (inout) :: lock
+ end subroutine omp_destroy_nest_lock
+ end interface
+
+ interface
+ subroutine omp_set_lock (lock)
+ use omp_lib_kinds
+ integer (omp_lock_kind), intent (inout) :: lock
+ end subroutine omp_set_lock
+ end interface
+
+ interface
+ subroutine omp_set_nest_lock (lock)
+ use omp_lib_kinds
+ integer (omp_nest_lock_kind), intent (inout) :: lock
+ end subroutine omp_set_nest_lock
+ end interface
+
+ interface
+ subroutine omp_unset_lock (lock)
+ use omp_lib_kinds
+ integer (omp_lock_kind), intent (inout) :: lock
+ end subroutine omp_unset_lock
+ end interface
+
+ interface
+ subroutine omp_unset_nest_lock (lock)
+ use omp_lib_kinds
+ integer (omp_nest_lock_kind), intent (inout) :: lock
+ end subroutine omp_unset_nest_lock
+ end interface
+
+ interface omp_set_dynamic
+ subroutine omp_set_dynamic (set)
+ logical (4), intent (in) :: set
+ end subroutine omp_set_dynamic
+ subroutine omp_set_dynamic_8 (set)
+ logical (8), intent (in) :: set
+ end subroutine omp_set_dynamic_8
+ end interface
+
+ interface omp_set_nested
+ subroutine omp_set_nested (set)
+ logical (4), intent (in) :: set
+ end subroutine omp_set_nested
+ subroutine omp_set_nested_8 (set)
+ logical (8), intent (in) :: set
+ end subroutine omp_set_nested_8
+ end interface
+
+ interface omp_set_num_threads
+ subroutine omp_set_num_threads (set)
+ integer (4), intent (in) :: set
+ end subroutine omp_set_num_threads
+ subroutine omp_set_num_threads_8 (set)
+ integer (8), intent (in) :: set
+ end subroutine omp_set_num_threads_8
+ end interface
+
+ interface
+ function omp_get_dynamic ()
+ use omp_lib_kinds
+ logical (omp_logical_kind) :: omp_get_dynamic
+ end function omp_get_dynamic
+ end interface
+
+ interface
+ function omp_get_nested ()
+ use omp_lib_kinds
+ logical (omp_logical_kind) :: omp_get_nested
+ end function omp_get_nested
+ end interface
+
+ interface
+ function omp_in_parallel ()
+ use omp_lib_kinds
+ logical (omp_logical_kind) :: omp_in_parallel
+ end function omp_in_parallel
+ end interface
+
+ interface
+ function omp_test_lock (lock)
+ use omp_lib_kinds
+ logical (omp_logical_kind) :: omp_test_lock
+ integer (omp_lock_kind), intent (inout) :: lock
+ end function omp_test_lock
+ end interface
+
+ interface
+ function omp_get_max_threads ()
+ use omp_lib_kinds
+ integer (omp_integer_kind) :: omp_get_max_threads
+ end function omp_get_max_threads
+ end interface
+
+ interface
+ function omp_get_num_procs ()
+ use omp_lib_kinds
+ integer (omp_integer_kind) :: omp_get_num_procs
+ end function omp_get_num_procs
+ end interface
+
+ interface
+ function omp_get_num_threads ()
+ use omp_lib_kinds
+ integer (omp_integer_kind) :: omp_get_num_threads
+ end function omp_get_num_threads
+ end interface
+
+ interface
+ function omp_get_thread_num ()
+ use omp_lib_kinds
+ integer (omp_integer_kind) :: omp_get_thread_num
+ end function omp_get_thread_num
+ end interface
+
+ interface
+ function omp_test_nest_lock (lock)
+ use omp_lib_kinds
+ integer (omp_integer_kind) :: omp_test_nest_lock
+ integer (omp_nest_lock_kind), intent (inout) :: lock
+ end function omp_test_nest_lock
+ end interface
+
+ interface
+ function omp_get_wtick ()
+ double precision :: omp_get_wtick
+ end function omp_get_wtick
+ end interface
+
+ interface
+ function omp_get_wtime ()
+ double precision :: omp_get_wtime
+ end function omp_get_wtime
+ end interface
+
+ end module omp_lib
--- /dev/null
+! Copyright (C) 2005 Free Software Foundation, Inc.
+! Contributed by Jakub Jelinek <jakub@redhat.com>.
+
+! This file is part of the GNU OpenMP Library (libgomp).
+
+! Libgomp is free software; you can redistribute it and/or modify it
+! under the terms of the GNU Lesser General Public License as published by
+! the Free Software Foundation; either version 2.1 of the License, or
+! (at your option) any later version.
+
+! Libgomp 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 Lesser General Public License for
+! more details.
+
+! You should have received a copy of the GNU Lesser General Public License
+! along with libgomp; see the file COPYING.LIB. If not, write to the
+! Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+! MA 02110-1301, USA. */
+
+! As a special exception, if you link this library with other files, some
+! of which are compiled with GCC, to produce an executable, this library
+! does not by itself cause the resulting executable to be covered by the
+! GNU General Public License. This exception does not however invalidate
+! any other reasons why the executable file might be covered by the GNU
+! General Public License.
+
+ integer omp_lock_kind, omp_nest_lock_kind, openmp_version
+ parameter (omp_lock_kind = OMP_LOCK_KIND)
+ parameter (omp_nest_lock_kind = OMP_NEST_LOCK_KIND)
+ parameter (openmp_version = 200505)
+
+ external omp_init_lock, omp_init_nest_lock
+ external omp_destroy_lock, omp_destroy_nest_lock
+ external omp_set_lock, omp_set_nest_lock
+ external omp_unset_lock, omp_unset_nest_lock
+ external omp_set_dynamic, omp_set_nested
+ external omp_set_num_threads
+
+ external omp_get_dynamic, omp_get_nested
+ logical*4 omp_get_dynamic, omp_get_nested
+ external omp_test_lock, omp_in_parallel
+ logical*4 omp_test_lock, omp_in_parallel
+
+ external omp_get_max_threads, omp_get_num_procs
+ integer*4 omp_get_max_threads, omp_get_num_procs
+ external omp_get_num_threads, omp_get_thread_num
+ integer*4 omp_get_num_threads, omp_get_thread_num
+ external omp_test_nest_lock
+ integer*4 omp_test_nest_lock
+
+ external omp_get_wtick, omp_get_wtime
+ double precision omp_get_wtick, omp_get_wtime
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This file handles the ORDERED construct. */
+
+#include "libgomp.h"
+
+
+/* This function is called when first allocating an iteration block. That
+ is, the thread is not currently on the queue. The work-share lock must
+ be held on entry. */
+
+void
+gomp_ordered_first (void)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ struct gomp_team *team = thr->ts.team;
+ struct gomp_work_share *ws = thr->ts.work_share;
+ unsigned index;
+
+ /* Work share constructs can be orphaned. */
+ if (team == NULL || team->nthreads == 1)
+ return;
+
+ index = ws->ordered_cur + ws->ordered_num_used;
+ if (index >= team->nthreads)
+ index -= team->nthreads;
+ ws->ordered_team_ids[index] = thr->ts.team_id;
+
+ /* If this is the first and only thread in the queue, then there is
+ no one to release us when we get to our ordered section. Post to
+ our own release queue now so that we won't block later. */
+ if (ws->ordered_num_used++ == 0)
+ gomp_sem_post (team->ordered_release[thr->ts.team_id]);
+}
+
+/* This function is called when completing the last iteration block. That
+ is, there are no more iterations to perform and so the thread should be
+ removed from the queue entirely. Because of the way ORDERED blocks are
+ managed, it follows that we currently own access to the ORDERED block,
+ and should now pass it on to the next thread. The work-share lock must
+ be held on entry. */
+
+void
+gomp_ordered_last (void)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ struct gomp_team *team = thr->ts.team;
+ struct gomp_work_share *ws = thr->ts.work_share;
+ unsigned next_id;
+
+ /* Work share constructs can be orphaned. */
+ if (team == NULL || team->nthreads == 1)
+ return;
+
+ /* We're no longer the owner. */
+ ws->ordered_owner = -1;
+
+ /* If we're not the last thread in the queue, then wake the next. */
+ if (--ws->ordered_num_used > 0)
+ {
+ unsigned next = ws->ordered_cur + 1;
+ if (next == team->nthreads)
+ next = 0;
+ ws->ordered_cur = next;
+
+ next_id = ws->ordered_team_ids[next];
+ gomp_sem_post (team->ordered_release[next_id]);
+ }
+}
+
+
+/* This function is called when allocating a subsequent allocation block.
+ That is, we're done with the current iteration block and we're allocating
+ another. This is the logical combination of a call to gomp_ordered_last
+ followed by a call to gomp_ordered_first. The work-share lock must be
+ held on entry. */
+
+void
+gomp_ordered_next (void)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ struct gomp_team *team = thr->ts.team;
+ struct gomp_work_share *ws = thr->ts.work_share;
+ unsigned index, next_id;
+
+ /* Work share constructs can be orphaned. */
+ if (team == NULL || team->nthreads == 1)
+ return;
+
+ /* We're no longer the owner. */
+ ws->ordered_owner = -1;
+
+ /* If there's only one thread in the queue, that must be us. */
+ if (ws->ordered_num_used == 1)
+ {
+ /* We have a similar situation as in gomp_ordered_first
+ where we need to post to our own release semaphore. */
+ gomp_sem_post (team->ordered_release[thr->ts.team_id]);
+ return;
+ }
+
+ /* If the queue is entirely full, then we move ourself to the end of
+ the queue merely by incrementing ordered_cur. Only if it's not
+ full do we have to write our id. */
+ if (ws->ordered_num_used < team->nthreads)
+ {
+ index = ws->ordered_cur + ws->ordered_num_used;
+ if (index >= team->nthreads)
+ index -= team->nthreads;
+ ws->ordered_team_ids[index] = thr->ts.team_id;
+ }
+
+ index = ws->ordered_cur + 1;
+ if (index == team->nthreads)
+ index = 0;
+ ws->ordered_cur = index;
+
+ next_id = ws->ordered_team_ids[index];
+ gomp_sem_post (team->ordered_release[next_id]);
+}
+
+
+/* This function is called when a statically scheduled loop is first
+ being created. */
+
+void
+gomp_ordered_static_init (void)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ struct gomp_team *team = thr->ts.team;
+
+ if (team == NULL || team->nthreads == 1)
+ return;
+
+ gomp_sem_post (team->ordered_release[0]);
+}
+
+/* This function is called when a statically scheduled loop is moving to
+ the next allocation block. Static schedules are not first come first
+ served like the others, so we're to move to the numerically next thread,
+ not the next thread on a list. The work-share lock should *not* be held
+ on entry. */
+
+void
+gomp_ordered_static_next (void)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ struct gomp_team *team = thr->ts.team;
+ struct gomp_work_share *ws = thr->ts.work_share;
+ unsigned id = thr->ts.team_id;
+
+ if (team == NULL || team->nthreads == 1)
+ return;
+
+ ws->ordered_owner = -1;
+
+ /* This thread currently owns the lock. Increment the owner. */
+ if (++id == team->nthreads)
+ id = 0;
+ ws->ordered_team_ids[0] = id;
+ gomp_sem_post (team->ordered_release[id]);
+}
+
+/* This function is called when we need to assert that the thread owns the
+ ordered section. Due to the problem of posted-but-not-waited semaphores,
+ this needs to happen before completing a loop iteration. */
+
+void
+gomp_ordered_sync (void)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ struct gomp_team *team = thr->ts.team;
+ struct gomp_work_share *ws = thr->ts.work_share;
+
+ /* Work share constructs can be orphaned. But this clearly means that
+ we are the only thread, and so we automatically own the section. */
+ if (team == NULL || team->nthreads == 1)
+ return;
+
+ /* ??? I believe it to be safe to access this data without taking the
+ ws->lock. The only presumed race condition is with the previous
+ thread on the queue incrementing ordered_cur such that it points
+ to us, concurrently with our check below. But our team_id is
+ already present in the queue, and the other thread will always
+ post to our release semaphore. So the two cases are that we will
+ either win the race an momentarily block on the semaphore, or lose
+ the race and find the semaphore already unlocked and so not block.
+ Either way we get correct results. */
+
+ if (ws->ordered_owner != thr->ts.team_id)
+ {
+ gomp_sem_wait (team->ordered_release[thr->ts.team_id]);
+ ws->ordered_owner = thr->ts.team_id;
+ }
+}
+
+/* This function is called by user code when encountering the start of an
+ ORDERED block. We must check to see if the current thread is at the
+ head of the queue, and if not, block. */
+
+#ifdef HAVE_ATTRIBUTE_ALIAS
+extern void GOMP_ordered_start (void)
+ __attribute__((alias ("gomp_ordered_sync")));
+#else
+void
+GOMP_ordered_start (void)
+{
+ gomp_ordered_sync ();
+}
+#endif
+
+/* This function is called by user code when encountering the end of an
+ ORDERED block. With the current ORDERED implementation there's nothing
+ for us to do.
+
+ However, the current implementation has a flaw in that it does not allow
+ the next thread into the ORDERED section immediately after the current
+ thread exits the ORDERED section in its last iteration. The existance
+ of this function allows the implementation to change. */
+
+void
+GOMP_ordered_end (void)
+{
+}
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This file handles the (bare) PARALLEL construct. */
+
+#include "libgomp.h"
+
+
+/* Determine the number of threads to be launched for a PARALLEL construct.
+ This algorithm is explicitly described in OpenMP 2.5 section 2.4.1.
+ SPECIFIED is a combination of the NUM_THREADS clause and the IF clause.
+ If the IF clause is false, SPECIFIED is forced to 1. When NUM_THREADS
+ is not present, SPECIFIED is 0. */
+
+unsigned
+gomp_resolve_num_threads (unsigned specified)
+{
+ /* Early exit for false IF condition or degenerate NUM_THREADS. */
+ if (specified == 1)
+ return 1;
+
+ /* If this is a nested region, and nested regions are disabled, force
+ this team to use only one thread. */
+ if (gomp_thread()->ts.team && !gomp_nest_var)
+ return 1;
+
+ /* If NUM_THREADS not specified, use nthreads_var. */
+ if (specified == 0)
+ specified = gomp_nthreads_var;
+
+ /* If dynamic threads are enabled, bound the number of threads
+ that we launch. */
+ if (gomp_dyn_var)
+ {
+ unsigned dyn = gomp_dynamic_max_threads ();
+ if (dyn < specified)
+ return dyn;
+ }
+
+ return specified;
+}
+
+void
+GOMP_parallel_start (void (*fn) (void *), void *data, unsigned num_threads)
+{
+ num_threads = gomp_resolve_num_threads (num_threads);
+ gomp_team_start (fn, data, num_threads, NULL);
+}
+
+void
+GOMP_parallel_end (void)
+{
+ gomp_team_end ();
+}
+
+\f
+/* The public OpenMP API for thread and team related inquiries. */
+
+int
+omp_get_num_threads (void)
+{
+ struct gomp_team *team = gomp_thread ()->ts.team;
+ return team ? team->nthreads : 1;
+}
+
+/* ??? Does this function need to disregard dyn_var? I don't see
+ how else one could get a useable "maximum". */
+
+int
+omp_get_max_threads (void)
+{
+ return gomp_resolve_num_threads (0);
+}
+
+int
+omp_get_thread_num (void)
+{
+ return gomp_thread ()->ts.team_id;
+}
+
+/* ??? This isn't right. The definition of this function is false if any
+ of the IF clauses for any of the parallels is false. Which is not the
+ same thing as any outer team having more than one thread. */
+
+int omp_in_parallel (void)
+{
+ struct gomp_team *team = gomp_thread ()->ts.team;
+
+ while (team)
+ {
+ if (team->nthreads > 1)
+ return true;
+ team = team->prev_ts.team;
+ }
+
+ return false;
+}
+
+ialias (omp_get_num_threads)
+ialias (omp_get_max_threads)
+ialias (omp_get_thread_num)
+ialias (omp_in_parallel)
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This file handles the SECTIONS construct. */
+
+#include "libgomp.h"
+
+
+/* Initialize the given work share construct from the given arguments. */
+
+static inline void
+gomp_sections_init (struct gomp_work_share *ws, unsigned count)
+{
+ ws->sched = GFS_DYNAMIC;
+ ws->chunk_size = 1;
+ ws->end = count + 1;
+ ws->incr = 1;
+ ws->next = 1;
+}
+
+/* This routine is called when first encountering a sections construct
+ that is not bound directly to a parallel construct. The first thread
+ that arrives will create the work-share construct; subsequent threads
+ will see the construct exists and allocate work from it.
+
+ COUNT is the number of sections in this construct.
+
+ Returns the 1-based section number for this thread to perform, or 0 if
+ all work was assigned to other threads prior to this thread's arrival. */
+
+unsigned
+GOMP_sections_start (unsigned count)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ long s, e, ret;
+
+ if (gomp_work_share_start (false))
+ gomp_sections_init (thr->ts.work_share, count);
+
+ if (gomp_iter_dynamic_next_locked (&s, &e))
+ ret = s;
+ else
+ ret = 0;
+
+ gomp_mutex_unlock (&thr->ts.work_share->lock);
+
+ return ret;
+}
+
+/* This routine is called when the thread completes processing of the
+ section currently assigned to it. If the work-share construct is
+ bound directly to a parallel construct, then the construct may have
+ been set up before the parallel. In which case, this may be the
+ first iteration for the thread.
+
+ Returns the 1-based section number for this thread to perform, or 0 if
+ all work was assigned to other threads prior to this thread's arrival. */
+
+unsigned
+GOMP_sections_next (void)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ long s, e, ret;
+
+ gomp_mutex_lock (&thr->ts.work_share->lock);
+ if (gomp_iter_dynamic_next_locked (&s, &e))
+ ret = s;
+ else
+ ret = 0;
+ gomp_mutex_unlock (&thr->ts.work_share->lock);
+
+ return ret;
+}
+
+/* This routine pre-initializes a work-share construct to avoid one
+ synchronization once we get into the loop. */
+
+void
+GOMP_parallel_sections_start (void (*fn) (void *), void *data,
+ unsigned num_threads, unsigned count)
+{
+ struct gomp_work_share *ws;
+
+ num_threads = gomp_resolve_num_threads (num_threads);
+ if (num_threads > count)
+ num_threads = count;
+
+ ws = gomp_new_work_share (false, num_threads);
+ gomp_sections_init (ws, count);
+ gomp_team_start (fn, data, num_threads, ws);
+}
+
+/* The GOMP_section_end* routines are called after the thread is told
+ that all sections are complete. This first version synchronizes
+ all threads; the nowait version does not. */
+
+void
+GOMP_sections_end (void)
+{
+ gomp_work_share_end ();
+}
+
+void
+GOMP_sections_end_nowait (void)
+{
+ gomp_work_share_end_nowait ();
+}
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This file handles the SINGLE construct. */
+
+#include "libgomp.h"
+
+
+/* This routine is called when first encountering a SINGLE construct that
+ doesn't have a COPYPRIVATE clause. Returns true if this is the thread
+ that should execute the clause. */
+
+bool
+GOMP_single_start (void)
+{
+ bool ret = gomp_work_share_start (false);
+ gomp_mutex_unlock (&gomp_thread ()->ts.work_share->lock);
+ gomp_work_share_end_nowait ();
+ return ret;
+}
+
+/* This routine is called when first encountering a SINGLE construct that
+ does have a COPYPRIVATE clause. Returns NULL if this is the thread
+ that should execute the clause; otherwise the return value is pointer
+ given to GOMP_single_copy_end by the thread that did execute the clause. */
+
+void *
+GOMP_single_copy_start (void)
+{
+ struct gomp_thread *thr = gomp_thread ();
+
+ bool first;
+ void *ret;
+
+ first = gomp_work_share_start (false);
+ gomp_mutex_unlock (&thr->ts.work_share->lock);
+
+ if (first)
+ ret = NULL;
+ else
+ {
+ gomp_barrier_wait (&thr->ts.team->barrier);
+
+ ret = thr->ts.work_share->copyprivate;
+ gomp_work_share_end_nowait ();
+ }
+
+ return ret;
+}
+
+/* This routine is called when the thread that entered a SINGLE construct
+ with a COPYPRIVATE clause gets to the end of the construct. */
+
+void
+GOMP_single_copy_end (void *data)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ struct gomp_team *team = thr->ts.team;
+
+ if (team != NULL)
+ {
+ thr->ts.work_share->copyprivate = data;
+ gomp_barrier_wait (&team->barrier);
+ }
+
+ gomp_work_share_end_nowait ();
+}
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This file handles the maintainence of threads in response to team
+ creation and termination. */
+
+#include "libgomp.h"
+#include <stdlib.h>
+#include <string.h>
+
+
+/* This array manages threads spawned from the top level, which will
+ return to the idle loop once the current PARALLEL construct ends. */
+static struct gomp_thread **gomp_threads;
+static unsigned gomp_threads_size;
+static unsigned gomp_threads_used;
+
+/* This attribute contains PTHREAD_CREATE_DETACHED. */
+static pthread_attr_t gomp_thread_attr;
+
+/* This barrier holds and releases threads waiting in gomp_threads. */
+static gomp_barrier_t gomp_threads_dock;
+
+/* This is the libgomp per-thread data structure. */
+#ifdef HAVE_TLS
+__thread struct gomp_thread gomp_tls_data;
+#else
+pthread_key_t gomp_tls_key;
+#endif
+
+
+/* This structure is used to communicate across pthread_create. */
+
+struct gomp_thread_start_data
+{
+ struct gomp_team_state ts;
+ void (*fn) (void *);
+ void *fn_data;
+ bool nested;
+};
+
+
+/* This function is a pthread_create entry point. This contains the idle
+ loop in which a thread waits to be called up to become part of a team. */
+
+static void *
+gomp_thread_start (void *xdata)
+{
+ struct gomp_thread_start_data *data = xdata;
+ struct gomp_thread *thr;
+ void (*local_fn) (void *);
+ void *local_data;
+
+#ifdef HAVE_TLS
+ thr = &gomp_tls_data;
+#else
+ struct gomp_thread local_thr;
+ thr = &local_thr;
+ pthread_setspecific (gomp_tls_key, thr);
+#endif
+ gomp_sem_init (&thr->release, 0);
+
+ /* Extract what we need from data. */
+ local_fn = data->fn;
+ local_data = data->fn_data;
+ thr->ts = data->ts;
+
+ thr->ts.team->ordered_release[thr->ts.team_id] = &thr->release;
+
+ if (data->nested)
+ {
+ gomp_barrier_wait (&thr->ts.team->barrier);
+ local_fn (local_data);
+ gomp_barrier_wait (&thr->ts.team->barrier);
+ }
+ else
+ {
+ gomp_threads[thr->ts.team_id] = thr;
+
+ gomp_barrier_wait (&gomp_threads_dock);
+ do
+ {
+ struct gomp_team *team;
+
+ local_fn (local_data);
+
+ /* Clear out the team and function data. This is a debugging
+ signal that we're in fact back in the dock. */
+ team = thr->ts.team;
+ thr->fn = NULL;
+ thr->data = NULL;
+ thr->ts.team = NULL;
+ thr->ts.work_share = NULL;
+ thr->ts.team_id = 0;
+ thr->ts.work_share_generation = 0;
+ thr->ts.static_trip = 0;
+
+ gomp_barrier_wait (&team->barrier);
+ gomp_barrier_wait (&gomp_threads_dock);
+
+ local_fn = thr->fn;
+ local_data = thr->data;
+ }
+ while (local_fn);
+ }
+
+ return NULL;
+}
+
+
+/* Create a new team data structure. */
+
+static struct gomp_team *
+new_team (unsigned nthreads, struct gomp_work_share *work_share)
+{
+ struct gomp_team *team;
+ size_t size;
+
+ size = sizeof (*team) + nthreads * sizeof (team->ordered_release[0]);
+ team = gomp_malloc (size);
+ gomp_mutex_init (&team->work_share_lock);
+
+ team->work_shares = gomp_malloc (4 * sizeof (struct gomp_work_share *));
+ team->generation_mask = 3;
+ team->oldest_live_gen = work_share == NULL;
+ team->num_live_gen = work_share != NULL;
+ team->work_shares[0] = work_share;
+
+ team->nthreads = nthreads;
+ gomp_barrier_init (&team->barrier, nthreads);
+
+ gomp_sem_init (&team->master_release, 0);
+ team->ordered_release[0] = &team->master_release;
+
+ return team;
+}
+
+
+/* Free a team data structure. */
+
+static void
+free_team (struct gomp_team *team)
+{
+ free (team->work_shares);
+ gomp_mutex_destroy (&team->work_share_lock);
+ gomp_barrier_destroy (&team->barrier);
+ gomp_sem_destroy (&team->master_release);
+ free (team);
+}
+
+
+/* Launch a team. */
+
+void
+gomp_team_start (void (*fn) (void *), void *data, unsigned nthreads,
+ struct gomp_work_share *work_share)
+{
+ struct gomp_thread_start_data *start_data;
+ struct gomp_thread *thr, *nthr;
+ struct gomp_team *team;
+ bool nested;
+ unsigned i, n, old_threads_used = 0;
+
+ thr = gomp_thread ();
+ nested = thr->ts.team != NULL;
+
+ team = new_team (nthreads, work_share);
+
+ /* Always save the previous state, even if this isn't a nested team.
+ In particular, we should save any work share state from an outer
+ orphaned work share construct. */
+ team->prev_ts = thr->ts;
+
+ thr->ts.team = team;
+ thr->ts.work_share = work_share;
+ thr->ts.team_id = 0;
+ thr->ts.work_share_generation = 0;
+ thr->ts.static_trip = 0;
+
+ if (nthreads == 1)
+ return;
+
+ i = 1;
+
+ /* We only allow the reuse of idle threads for non-nested PARALLEL
+ regions. This appears to be implied by the semantics of
+ threadprivate variables, but perhaps that's reading too much into
+ things. Certainly it does prevent any locking problems, since
+ only the initial program thread will modify gomp_threads. */
+ if (!nested)
+ {
+ old_threads_used = gomp_threads_used;
+
+ if (nthreads <= old_threads_used)
+ n = nthreads;
+ else if (old_threads_used == 0)
+ {
+ n = 0;
+ gomp_barrier_init (&gomp_threads_dock, nthreads);
+ }
+ else
+ {
+ n = old_threads_used;
+
+ /* Increase the barrier threshold to make sure all new
+ threads arrive before the team is released. */
+ gomp_barrier_reinit (&gomp_threads_dock, nthreads);
+ }
+
+ /* Not true yet, but soon will be. We're going to release all
+ threads from the dock, and those that aren't part of the
+ team will exit. */
+ gomp_threads_used = nthreads;
+
+ /* Release existing idle threads. */
+ for (; i < n; ++i)
+ {
+ nthr = gomp_threads[i];
+ nthr->ts.team = team;
+ nthr->ts.work_share = work_share;
+ nthr->ts.team_id = i;
+ nthr->ts.work_share_generation = 0;
+ nthr->ts.static_trip = 0;
+ nthr->fn = fn;
+ nthr->data = data;
+ team->ordered_release[i] = &nthr->release;
+ }
+
+ if (i == nthreads)
+ goto do_release;
+
+ /* If necessary, expand the size of the gomp_threads array. It is
+ expected that changes in the number of threads is rare, thus we
+ make no effort to expand gomp_threads_size geometrically. */
+ if (nthreads >= gomp_threads_size)
+ {
+ gomp_threads_size = nthreads + 1;
+ gomp_threads
+ = gomp_realloc (gomp_threads,
+ gomp_threads_size
+ * sizeof (struct gomp_thread_data *));
+ }
+ }
+
+ start_data = alloca (sizeof (struct gomp_thread_start_data) * (nthreads-i));
+
+ /* Launch new threads. */
+ for (; i < nthreads; ++i, ++start_data)
+ {
+ pthread_t pt;
+ int err;
+
+ start_data->ts.team = team;
+ start_data->ts.work_share = work_share;
+ start_data->ts.team_id = i;
+ start_data->ts.work_share_generation = 0;
+ start_data->ts.static_trip = 0;
+ start_data->fn = fn;
+ start_data->fn_data = data;
+ start_data->nested = nested;
+
+ err = pthread_create (&pt, &gomp_thread_attr,
+ gomp_thread_start, start_data);
+ if (err != 0)
+ gomp_fatal ("Thread creation failed: %s", strerror (err));
+ }
+
+ do_release:
+ gomp_barrier_wait (nested ? &team->barrier : &gomp_threads_dock);
+
+ /* Decrease the barrier threshold to match the number of threads
+ that should arrive back at the end of this team. The extra
+ threads should be exiting. Note that we arrange for this test
+ to never be true for nested teams. */
+ if (nthreads < old_threads_used)
+ gomp_barrier_reinit (&gomp_threads_dock, nthreads);
+}
+
+
+/* Terminate the current team. This is only to be called by the master
+ thread. We assume that we must wait for the other threads. */
+
+void
+gomp_team_end (void)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ struct gomp_team *team = thr->ts.team;
+
+ gomp_barrier_wait (&team->barrier);
+
+ thr->ts = team->prev_ts;
+
+ free_team (team);
+}
+
+
+/* Constructors for this file. */
+
+static void __attribute__((constructor))
+initialize_team (void)
+{
+ struct gomp_thread *thr;
+
+#ifndef HAVE_TLS
+ static struct gomp_thread initial_thread_tls_data;
+
+ pthread_key_create (&gomp_tls_key, NULL);
+ pthread_setspecific (gomp_tls_key, &initial_thread_tls_data);
+#endif
+
+#ifdef HAVE_TLS
+ thr = &gomp_tls_data;
+#else
+ thr = &initial_thread_tls_data;
+#endif
+ gomp_sem_init (&thr->release, 0);
+
+ pthread_attr_init (&gomp_thread_attr);
+ pthread_attr_setdetachstate (&gomp_thread_attr, PTHREAD_CREATE_DETACHED);
+}
--- /dev/null
+## Process this file with automake to produce Makefile.in.
+
+AUTOMAKE_OPTIONS = foreign dejagnu
+
+# May be used by various substitution variables.
+gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+
+EXPECT = $(shell if test -f $(top_builddir)/../expect/expect; then \
+ echo $(top_builddir)/../expect/expect; else echo expect; fi)
+
+_RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
+ echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
+RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"
--- /dev/null
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = testsuite
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
+ $(top_srcdir)/../config/lead-dot.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DEJATOOL = $(PACKAGE)
+RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FC = @FC@
+FCFLAGS = @FCFLAGS@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBGOMP_BUILD_VERSIONED_SHLIB_FALSE = @LIBGOMP_BUILD_VERSIONED_SHLIB_FALSE@
+LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE = @LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OPT_LDFLAGS = @OPT_LDFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+RANLIB = @RANLIB@
+SECTION_LDFLAGS = @SECTION_LDFLAGS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_FORTRAN_FALSE = @USE_FORTRAN_FALSE@
+USE_FORTRAN_TRUE = @USE_FORTRAN_TRUE@
+VERSION = @VERSION@
+XCFLAGS = @XCFLAGS@
+XLDFLAGS = @XLDFLAGS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_FC = @ac_ct_FC@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+config_path = @config_path@
+datadir = @datadir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+libtool_VERSION = @libtool_VERSION@
+link_gomp = @link_gomp@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexecdir = @toolexecdir@
+toolexeclibdir = @toolexeclibdir@
+AUTOMAKE_OPTIONS = foreign dejagnu
+
+# May be used by various substitution variables.
+gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+EXPECT = $(shell if test -f $(top_builddir)/../expect/expect; then \
+ echo $(top_builddir)/../expect/expect; else echo expect; fi)
+
+_RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
+ echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
+
+RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign testsuite/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign testsuite/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+check-DEJAGNU: site.exp
+ srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+ EXPECT=$(EXPECT); export EXPECT; \
+ runtest=$(RUNTEST); \
+ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+ l='$(DEJATOOL)'; for tool in $$l; do \
+ $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \
+ done; \
+ else echo "WARNING: could not find \`runtest'" 1>&2; :;\
+ fi
+site.exp: Makefile
+ @echo 'Making a new site.exp file...'
+ @echo '## these variables are automatically generated by make ##' >site.tmp
+ @echo '# Do not edit here. If you wish to override these values' >>site.tmp
+ @echo '# edit the last section' >>site.tmp
+ @echo 'set srcdir $(srcdir)' >>site.tmp
+ @echo "set objdir `pwd`" >>site.tmp
+ @echo 'set build_alias "$(build_alias)"' >>site.tmp
+ @echo 'set build_triplet $(build_triplet)' >>site.tmp
+ @echo 'set host_alias "$(host_alias)"' >>site.tmp
+ @echo 'set host_triplet $(host_triplet)' >>site.tmp
+ @echo 'set target_alias "$(target_alias)"' >>site.tmp
+ @echo 'set target_triplet $(target_triplet)' >>site.tmp
+ @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp
+ @test ! -f site.exp || \
+ sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
+ @-rm -f site.bak
+ @test ! -f site.exp || mv site.exp site.bak
+ @mv site.tmp site.exp
+
+distclean-DEJAGNU:
+ -rm -f site.exp site.bak
+ -l='$(DEJATOOL)'; for tool in $$l; do \
+ rm -f $$tool.sum $$tool.log; \
+ done
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-DEJAGNU distclean-generic \
+ distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-DEJAGNU check-am clean clean-generic \
+ clean-libtool distclean distclean-DEJAGNU distclean-generic \
+ distclean-libtool distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
--- /dev/null
+# Damn dejagnu for not having proper library search paths for load_lib.
+# We have to explicitly load everything that gcc-dg.exp wants to load.
+
+proc load_gcc_lib { filename } {
+ global srcdir loaded_libs
+
+ load_file $srcdir/../../gcc/testsuite/lib/$filename
+ set loaded_libs($filename) ""
+}
+
+load_lib dg.exp
+load_gcc_lib file-format.exp
+load_gcc_lib target-supports.exp
+load_gcc_lib target-supports-dg.exp
+load_gcc_lib scanasm.exp
+load_gcc_lib scandump.exp
+load_gcc_lib scantree.exp
+load_gcc_lib scanipa.exp
+load_gcc_lib prune.exp
+load_gcc_lib target-libpath.exp
+load_gcc_lib wrapper.exp
+load_gcc_lib gcc-defs.exp
+load_gcc_lib gcc-dg.exp
+load_gcc_lib gfortran-dg.exp
+
+set dg-do-what-default run
+
+#
+# GCC_UNDER_TEST is the compiler under test.
+#
+
+set libgomp_compile_options ""
+
+#
+# libgomp_init -- This gets run more than it should be....
+#
+
+if [info exists TOOL_OPTIONS] {
+ set multilibs [get_multilibs $TOOL_OPTIONS]
+} else {
+ set multilibs [get_multilibs]
+}
+set blddir [lookfor_file $multilibs libgomp]
+
+proc libgomp_init { args } {
+ global srcdir blddir objdir tool_root_dir
+ global libgomp_initialized
+ global tmpdir
+ global gluefile wrap_flags
+ global ALWAYS_CFLAGS
+ global CFLAGS
+ global TOOL_EXECUTABLE TOOL_OPTIONS
+ global GCC_UNDER_TEST
+ global TESTING_IN_BUILD_TREE
+ global target_triplet
+ global ld_library_path
+ global lang_test_file
+ global lang_library_path
+ global lang_link_flags
+
+ # We set LC_ALL and LANG to C so that we get the same error
+ # messages as expected.
+ setenv LC_ALL C
+ setenv LANG C
+
+ if ![info exists GCC_UNDER_TEST] then {
+ if [info exists TOOL_EXECUTABLE] {
+ set GCC_UNDER_TEST $TOOL_EXECUTABLE
+ } else {
+ set GCC_UNDER_TEST "[find_gcc]"
+ }
+ }
+
+ if ![info exists tmpdir] {
+ set tmpdir "/tmp"
+ }
+
+ if [info exists gluefile] {
+ unset gluefile
+ }
+
+ if {![info exists CFLAGS]} {
+ set CFLAGS ""
+ }
+
+ # Locate libgcc.a so we don't need to account for different values of
+ # SHLIB_EXT on different platforms
+ set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
+ if {$gccdir != ""} {
+ set gccdir [file dirname $gccdir]
+ }
+
+ # Compute what needs to be put into LD_LIBRARY_PATH
+ set ld_library_path ".:${blddir}/.libs"
+
+ if {$gccdir != ""} {
+ append ld_library_path ":${gccdir}"
+ }
+
+ if { [info exists lang_test_file] && [file exists "${blddir}/"] } {
+ append ld_library_path ":${blddir}/${lang_library_path}"
+ }
+ append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
+ set_ld_library_path_env_vars
+
+ set ALWAYS_CFLAGS ""
+ lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/"
+ lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}"
+ lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.."
+ lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs -lgomp"
+ if { [info exists lang_test_file] && [file exists "${blddir}/"] } {
+ lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/${lang_library_path} ${lang_link_flags}"
+ }
+
+ # We use atomic operations in the testcases to validate results.
+ if [istarget i?86-*-*] {
+ lappend ALWAYS_CFLAGS "additional_flags=-march=i486"
+ }
+ if [istarget sparc*-*-*] {
+ lappend ALWAYS_CFLAGS "additional_flags=-mcpu=v9"
+ }
+
+ if [info exists TOOL_OPTIONS] {
+ lappend ALWAYS_CFLAGS "additional_flags=$TOOL_OPTIONS"
+ }
+
+ # Make sure that lines are not wrapped. That can confuse the
+ # error-message parsing machinery.
+ lappend ALWAYS_CFLAGS "additional_flags=-fmessage-length=0"
+
+ # And, gee, turn on OpenMP.
+ lappend ALWAYS_CFLAGS "additional_flags=-fopenmp"
+}
+
+#
+# libgomp_target_compile -- compile a source file
+#
+
+proc libgomp_target_compile { source dest type options } {
+ global tmpdir
+ global libgomp_compile_options
+ global gluefile wrap_flags
+ global ALWAYS_CFLAGS
+ global GCC_UNDER_TEST
+
+ libgomp_init
+
+ if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
+ lappend options "libs=${gluefile}"
+ lappend options "ldflags=${wrap_flags}"
+ }
+
+ lappend options "additional_flags=[libio_include_flags]"
+ lappend options "compiler=$GCC_UNDER_TEST"
+
+ set options [concat $libgomp_compile_options $options]
+
+ set options [concat "$ALWAYS_CFLAGS" $options]
+
+ set options [dg-additional-files-options $options $source]
+
+ set result [target_compile $source $dest $type $options]
+
+ return $result
+}
+
+# ??? The same as in standard.exp. Why doesn't anyone else have to
+# define this?
+
+proc libgomp_load { program args } {
+ if { [llength $args] > 0 } {
+ set program_args [lindex $args 0]
+ } else {
+ set program_args ""
+ }
+
+ if { [llength $args] > 1 } {
+ set input_file [lindex $args 1]
+ } else {
+ set input_file ""
+ }
+ return [remote_load target $program $program_args $input_file]
+}
+
+proc libgomp_option_help { } {
+ send_user " --additional_options,OPTIONS\t\tUse OPTIONS to compile the testcase files. OPTIONS should be comma-separated.\n"
+}
+
+proc libgomp_option_proc { option } {
+ if [regexp "^--additional_options," $option] {
+ global libgomp_compile_options
+ regsub "--additional_options," $option "" option
+ foreach x [split $option ","] {
+ lappend libgomp_compile_options "additional_flags=$x"
+ }
+ return 1
+ } else {
+ return 0
+ }
+}
+
+proc libgomp-dg-test { prog do_what extra_tool_flags } {
+ return [gcc-dg-test-1 libgomp_target_compile $prog $do_what $extra_tool_flags]
+}
+
+proc libgomp-dg-prune { system text } {
+ return [gcc-dg-prune $system $text]
+}
--- /dev/null
+/* { dg-do run } */
+
+#include <stdio.h>
+
+void
+work (int n)
+{
+ printf ("[%d of %d], nested = %d, n = %d\n", omp_get_thread_num (), omp_get_num_threads(), omp_get_nested (), n);
+}
+
+void
+sub3 (int n)
+{
+ work (n);
+#pragma omp barrier
+ work (n);
+}
+
+void
+sub2 (int k)
+{
+#pragma omp parallel shared(k)
+ sub3 (k);
+}
+
+void
+sub1 (int n)
+{
+ int i;
+#pragma omp parallel private(i) shared(n)
+ {
+#pragma omp for
+ for (i = 0; i < n; i++)
+ sub2 (i);
+ }
+}
+int
+main ()
+{
+ sub1 (2);
+ sub2 (15);
+ sub3 (20);
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+#include <stdio.h>
+
+float
+work1 (int i)
+{
+ return 1.0 * i;
+}
+
+float
+work2 (int i)
+{
+ return 2.0 * i;
+}
+
+void
+a16 (float *x, float *y, int *index, int n)
+{
+ int i;
+#pragma omp parallel for shared(x, y, index, n)
+ for (i = 0; i < n; i++)
+ {
+#pragma omp atomic
+ x[index[i]] += work1 (i);
+ y[i] += work2 (i);
+ }
+}
+int
+main ()
+{
+ float x[1000];
+ float y[10000];
+ int index[10000];
+ int i;
+ for (i = 0; i < 10000; i++)
+ {
+ index[i] = i % 1000;
+ y[i] = 0.0;
+ }
+ for (i = 0; i < 1000; i++)
+ x[i] = 0.0;
+ a16 (x, y, index, 10000);
+ for (i = 0; i < 10; i++)
+ printf ("x[%d] = %f, y[%d] = %f\n", i, x[i], i, y[i]);
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+#include <omp.h>
+#include <stdio.h>
+
+extern void abort (void);
+
+#define NUMBER_OF_THREADS 4
+
+int synch[NUMBER_OF_THREADS];
+int work[NUMBER_OF_THREADS];
+int result[NUMBER_OF_THREADS];
+int
+fn1 (int i)
+{
+ return i * 2;
+}
+
+int
+fn2 (int a, int b)
+{
+ return a + b;
+}
+
+int
+main ()
+{
+ int i, iam, neighbor;
+ omp_set_num_threads (NUMBER_OF_THREADS);
+#pragma omp parallel private(iam,neighbor) shared(work,synch)
+ {
+ iam = omp_get_thread_num ();
+ synch[iam] = 0;
+#pragma omp barrier
+ /*Do computation into my portion of work array */
+ work[iam] = fn1 (iam);
+ /* Announce that I am done with my work. The first flush
+ * ensures that my work is made visible before synch.
+ * The second flush ensures that synch is made visible.
+ */
+#pragma omp flush(work,synch)
+ synch[iam] = 1;
+#pragma omp flush(synch)
+ /* Wait for neighbor. The first flush ensures that synch is read
+ * from memory, rather than from the temporary view of memory.
+ * The second flush ensures that work is read from memory, and
+ * is done so after the while loop exits.
+ */
+ neighbor = (iam > 0 ? iam : omp_get_num_threads ()) - 1;
+ while (synch[neighbor] == 0)
+ {
+#pragma omp flush(synch)
+ }
+#pragma omp flush(work,synch)
+ /* Read neighbor's values of work array */
+ result[iam] = fn2 (work[neighbor], work[iam]);
+ }
+ /* output result here */
+ for (i = 0; i < NUMBER_OF_THREADS; i++)
+ {
+ neighbor = (i > 0 ? i : NUMBER_OF_THREADS) - 1;
+ if (result[i] != i * 2 + neighbor * 2)
+ abort ();
+ }
+
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+int x, *p = &x;
+extern void abort (void);
+void
+f1 (int *q)
+{
+ *q = 1;
+#pragma omp flush
+ /* x, p, and *q are flushed */
+ /* because they are shared and accessible */
+ /* q is not flushed because it is not shared. */
+}
+
+void
+f2 (int *q)
+{
+#pragma omp barrier
+ *q = 2;
+#pragma omp barrier
+ /* a barrier implies a flush */
+ /* x, p, and *q are flushed */
+ /* because they are shared and accessible */
+ /* q is not flushed because it is not shared. */
+}
+
+int
+g (int n)
+{
+ int i = 1, j, sum = 0;
+ *p = 1;
+#pragma omp parallel reduction(+: sum) num_threads(2)
+ {
+ f1 (&j);
+ /* i, n and sum were not flushed */
+ /* because they were not accessible in f1 */
+ /* j was flushed because it was accessible */
+ sum += j;
+ f2 (&j);
+ /* i, n, and sum were not flushed */
+ /* because they were not accessible in f2 */
+ /* j was flushed because it was accessible */
+ sum += i + j + *p + n;
+ }
+ return sum;
+}
+
+int
+main ()
+{
+ int result = g (10);
+ if (result != 30)
+ abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+#include <stdio.h>
+#include <omp.h>
+extern void abort (void);
+int
+main ()
+{
+ int bad, x;
+ x = 2;
+ bad = 0;
+#pragma omp parallel num_threads(2) shared(x, bad)
+ {
+ if (omp_get_thread_num () == 0)
+ {
+ volatile int i;
+ for (i = 0; i < 100000000; i++)
+ x = 5;
+ }
+ else
+ {
+ /* Print 1: the following read of x has a race */
+ if (x != 2 && x != 5)
+ bad = 1;
+ }
+#pragma omp barrier
+ if (omp_get_thread_num () == 0)
+ {
+ /* x must be 5 now. */
+ if (x != 5)
+ bad = 1;
+ }
+ else
+ {
+ /* x must be 5 now. */
+ if (x != 5)
+ bad = 1;
+ }
+ }
+
+ if (bad)
+ abort ();
+
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+#include <stdio.h>
+void
+work (int k)
+{
+#pragma omp ordered
+ printf (" %d\n", k);
+}
+
+void
+a21 (int lb, int ub, int stride)
+{
+ int i;
+#pragma omp parallel for ordered schedule(dynamic)
+ for (i = lb; i < ub; i += stride)
+ work (i);
+}
+
+int
+main ()
+{
+ a21 (0, 100, 5);
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+#include <stdio.h>
+int
+main ()
+{
+ int i, j;
+ i = 1;
+ j = 2;
+#pragma omp parallel private(i) firstprivate(j)
+ {
+ i = 3;
+ j = j + 2;
+ }
+ printf ("%d %d\n", i, j); /* i and j are undefined */
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+#include <assert.h>
+int A[2][2] = { 1, 2, 3, 4 };
+void
+f (int n, int B[n][n], int C[])
+{
+ int D[2][2] = { 1, 2, 3, 4 };
+ int E[n][n];
+ assert (n >= 2);
+ E[1][1] = 4;
+#pragma omp parallel firstprivate(B, C, D, E)
+ {
+ assert (sizeof (B) == sizeof (int (*)[n]));
+ assert (sizeof (C) == sizeof (int *));
+ assert (sizeof (D) == 4 * sizeof (int));
+ assert (sizeof (E) == n * n * sizeof (int));
+ /* Private B and C have values of original B and C. */
+ assert (&B[1][1] == &A[1][1]);
+ assert (&C[3] == &A[1][1]);
+ assert (D[1][1] == 4);
+ assert (E[1][1] == 4);
+ }
+}
+int
+main ()
+{
+ f (2, A, A[0]);
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+#include <stdio.h>
+int
+main ()
+{
+# ifdef _OPENMP
+ printf ("Compiled by an OpenMP-compliant implementation.\n");
+# endif
+ return 0;
+}
--- /dev/null
+/* { dg-do compile } */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <omp.h>
+omp_lock_t *
+new_lock ()
+{
+ omp_lock_t *lock_ptr;
+#pragma omp single copyprivate(lock_ptr)
+ {
+ lock_ptr = (omp_lock_t *) malloc (sizeof (omp_lock_t));
+ omp_init_lock (lock_ptr);
+ }
+ return lock_ptr;
+}
--- /dev/null
+/* { dg-do run } */
+
+#include <omp.h>
+#include <stdlib.h>
+void
+do_by_16 (float *x, int iam, int ipoints)
+{
+}
+
+void
+a36 (float *x, int npoints)
+{
+ int iam, ipoints;
+ omp_set_dynamic (0);
+ omp_set_num_threads (16);
+#pragma omp parallel shared(x, npoints) private(iam, ipoints)
+ {
+ if (omp_get_num_threads () != 16)
+ abort ();
+ iam = omp_get_thread_num ();
+ ipoints = npoints / 16;
+ do_by_16 (x, iam, ipoints);
+ }
+}
+
+int main()
+{
+ float a[10];
+ a36 (a, 10);
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+#include <stdio.h>
+#include <omp.h>
+void
+skip (int i)
+{
+}
+
+void
+work (int i)
+{
+}
+int
+main ()
+{
+ omp_lock_t lck;
+ int id;
+ omp_init_lock (&lck);
+#pragma omp parallel shared(lck) private(id)
+ {
+ id = omp_get_thread_num ();
+ omp_set_lock (&lck);
+ /* only one thread at a time can execute this printf */
+ printf ("My thread id is %d.\n", id);
+ omp_unset_lock (&lck);
+ while (!omp_test_lock (&lck))
+ {
+ skip (id); /* we do not yet have the lock,
+ so we must do something else */
+ }
+ work (id); /* we now have the lock
+ and can do the work */
+ omp_unset_lock (&lck);
+ }
+ omp_destroy_lock (&lck);
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+#include <omp.h>
+extern void abort (void);
+void
+subdomain (float *x, int istart, int ipoints)
+{
+ int i;
+ for (i = 0; i < ipoints; i++)
+ x[istart + i] = 123.456;
+}
+
+void
+sub (float *x, int npoints)
+{
+ int iam, nt, ipoints, istart;
+#pragma omp parallel default(shared) private(iam,nt,ipoints,istart)
+ {
+ iam = omp_get_thread_num ();
+ nt = omp_get_num_threads ();
+ ipoints = npoints / nt; /* size of partition */
+ istart = iam * ipoints; /* starting array index */
+ if (iam == nt - 1) /* last thread may do more */
+ ipoints = npoints - istart;
+ subdomain (x, istart, ipoints);
+ }
+}
+int
+main ()
+{
+ int i;
+ float array[10000];
+ sub (array, 10000);
+ for (i = 0; i < 10000; i++)
+ if (array[i] < 123.45 || array[i] > 123.46)
+ abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do compile } */
+
+#include <omp.h>
+typedef struct
+{
+ int a, b;
+ omp_nest_lock_t lck;
+} pair;
+int work1 ();
+int work2 ();
+int work3 ();
+void
+incr_a (pair * p, int a)
+{
+ /* Called only from incr_pair, no need to lock. */
+ p->a += a;
+}
+
+void
+incr_b (pair * p, int b)
+{
+ /* Called both from incr_pair and elsewhere, */
+ /* so need a nestable lock. */
+ omp_set_nest_lock (&p->lck);
+ p->b += b;
+ omp_unset_nest_lock (&p->lck);
+}
+
+void
+incr_pair (pair * p, int a, int b)
+{
+ omp_set_nest_lock (&p->lck);
+ incr_a (p, a);
+ incr_b (p, b);
+ omp_unset_nest_lock (&p->lck);
+}
+
+void
+a40 (pair * p)
+{
+#pragma omp parallel sections
+ {
+#pragma omp section
+ incr_pair (p, work1 (), work2 ());
+#pragma omp section
+ incr_b (p, work3 ());
+ }
+}
--- /dev/null
+/* { dg-do run } */
+
+#include <omp.h>
+int
+main ()
+{
+ omp_set_dynamic (1);
+#pragma omp parallel num_threads(10)
+ {
+ /* do work here */
+ }
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2 -fopenmp" } */
+/* { dg-options "-O2 -fopenmp -march=pentium" { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O2 -fopenmp" { target lp64 } } */
+
+#ifdef __i386__
+#include "../../../gcc/testsuite/gcc.dg/i386-cpuid.h"
+#define bit_CX8 (1 << 8)
+#endif
+
+extern void abort (void);
+double d;
+struct
+{
+ int i;
+ double e;
+ int j;
+} x;
+
+void
+f1 (void)
+{
+ #pragma omp atomic
+ d += 7.5;
+ #pragma omp atomic
+ d *= 2.5;
+ #pragma omp atomic
+ d /= 0.25;
+}
+
+void
+f2 (void)
+{
+ #pragma omp atomic
+ x.e += 7.5;
+ #pragma omp atomic
+ x.e *= 2.5;
+ #pragma omp atomic
+ x.e /= 0.25;
+}
+
+int
+main (void)
+{
+#ifdef __i386__
+ unsigned long cpu_facilities;
+
+ cpu_facilities = i386_cpuid ();
+
+ if ((cpu_facilities & bit_CX8) == 0)
+ return 0;
+#endif
+
+ d = 1.0;
+ f1 ();
+ if (d != 85.0)
+ abort ();
+
+ x.e = 1.0;
+ f2 ();
+ if (x.i != 0 || x.e != 85.0 || x.j != 0)
+ abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2 -fopenmp" } */
+
+extern void abort (void);
+int x1, x2, x3, x4, x5;
+volatile int y6 = 9, y2, y3, y4, y5;
+volatile unsigned char z1, z2, z3, z4, z5;
+float a1, a2, a3, a4;
+
+void
+f1 (void)
+{
+ #pragma omp atomic
+ x1++;
+ #pragma omp atomic
+ x2--;
+ #pragma omp atomic
+ ++x3;
+ #pragma omp atomic
+ --x4;
+ #pragma omp atomic
+ x5 += 1;
+ #pragma omp atomic
+ x1 -= y6;
+ #pragma omp atomic
+ x2 |= 1;
+ #pragma omp atomic
+ x3 &= 1;
+ #pragma omp atomic
+ x4 ^= 1;
+ #pragma omp atomic
+ x5 *= 3;
+ #pragma omp atomic
+ x1 /= 3;
+ #pragma omp atomic
+ x2 /= 3;
+ #pragma omp atomic
+ x3 <<= 3;
+ #pragma omp atomic
+ x4 >>= 3;
+}
+
+void
+f2 (void)
+{
+ #pragma omp atomic
+ y6++;
+ #pragma omp atomic
+ y2--;
+ #pragma omp atomic
+ ++y3;
+ #pragma omp atomic
+ --y4;
+ #pragma omp atomic
+ y5 += 1;
+ #pragma omp atomic
+ y6 -= x1;
+ #pragma omp atomic
+ y2 |= 1;
+ #pragma omp atomic
+ y3 &= 1;
+ #pragma omp atomic
+ y4 ^= 1;
+ #pragma omp atomic
+ y5 *= 3;
+ #pragma omp atomic
+ y6 /= 3;
+ #pragma omp atomic
+ y2 /= 3;
+ #pragma omp atomic
+ y3 <<= 3;
+ #pragma omp atomic
+ y4 >>= 3;
+}
+
+void
+f3 (void)
+{
+ #pragma omp atomic
+ z1++;
+ #pragma omp atomic
+ z2--;
+ #pragma omp atomic
+ ++z3;
+ #pragma omp atomic
+ --z4;
+ #pragma omp atomic
+ z5 += 1;
+ #pragma omp atomic
+ z1 |= 1;
+ #pragma omp atomic
+ z2 &= 1;
+ #pragma omp atomic
+ z3 ^= 1;
+ #pragma omp atomic
+ z4 *= 3;
+ #pragma omp atomic
+ z5 /= 3;
+ #pragma omp atomic
+ z1 /= 3;
+ #pragma omp atomic
+ z2 <<= 3;
+ #pragma omp atomic
+ z3 >>= 3;
+}
+
+void
+f4 (void)
+{
+ #pragma omp atomic
+ a1 += 8.0;
+ #pragma omp atomic
+ a2 *= 3.5;
+ #pragma omp atomic
+ a3 -= a1 + a2;
+ #pragma omp atomic
+ a4 /= 2.0;
+}
+
+int
+main (void)
+{
+ f1 ();
+ if (x1 != -2 || x2 != 0 || x3 != 8 || x4 != -1 || x5 != 3)
+ abort ();
+ f2 ();
+ if (y6 != 4 || y2 != 0 || y3 != 8 || y4 != -1 || y5 != 3)
+ abort ();
+ f3 ();
+ if (z1 != 0 || z2 != 8 || z3 != 0 || z4 != 253 || z5 != 0)
+ abort ();
+ a1 = 7;
+ a2 = 10;
+ a3 = 11;
+ a4 = 13;
+ f4 ();
+ if (a1 != 15.0 || a2 != 35.0 || a3 != -39.0 || a4 != 6.5)
+ abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2 -fopenmp" } */
+/* { dg-options "-O2 -fopenmp -march=nocona" { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O2 -fopenmp" { target ilp32 } } */
+
+double d = 1.5;
+long double ld = 3;
+extern void abort (void);
+
+void
+test (void)
+{
+#pragma omp atomic
+ d *= 1.25;
+#pragma omp atomic
+ ld /= 0.75;
+ if (d != 1.875 || ld != 4.0L)
+ abort ();
+}
+
+int
+main (void)
+{
+#ifdef __x86_64__
+# define bit_SSE3 (1 << 0)
+# define bit_CX16 (1 << 13)
+ unsigned int ax, bx, cx, dx;
+ __asm__ ("cpuid" : "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx)
+ : "0" (1) : "cc");
+ if ((cx & (bit_SSE3 | bit_CX16)) != (bit_SSE3 | bit_CX16))
+ return 0;
+#endif
+ test ();
+ return 0;
+}
--- /dev/null
+/* Trivial test of barrier. */
+
+#include <omp.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <assert.h>
+#include "libgomp_g.h"
+
+
+struct timeval stamps[3][3];
+
+static void function(void *dummy)
+{
+ int iam = omp_get_thread_num ();
+
+ gettimeofday (&stamps[iam][0], NULL);
+ if (iam == 0)
+ usleep (10);
+
+ GOMP_barrier ();
+
+ if (iam == 0)
+ {
+ gettimeofday (&stamps[0][1], NULL);
+ usleep (10);
+ }
+
+ GOMP_barrier ();
+
+ gettimeofday (&stamps[iam][2], NULL);
+}
+
+int main()
+{
+ omp_set_dynamic (0);
+
+ GOMP_parallel_start (function, NULL, 3);
+ function (NULL);
+ GOMP_parallel_end ();
+
+ assert (timercmp (&stamps[0][0], &stamps[0][1], <));
+ assert (timercmp (&stamps[1][0], &stamps[0][1], <));
+ assert (timercmp (&stamps[2][0], &stamps[0][1], <));
+
+ assert (timercmp (&stamps[0][1], &stamps[0][2], <));
+ assert (timercmp (&stamps[0][1], &stamps[1][2], <));
+ assert (timercmp (&stamps[0][1], &stamps[2][2], <));
+
+ return 0;
+}
--- /dev/null
+if [info exists lang_library_path] then {
+ unset lang_library_path
+ unset lang_test_file
+ unset lang_link_flags
+}
+
+load_lib libgomp-dg.exp
+
+# If a testcase doesn't have special options, use these.
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS "-O2 -fopenmp"
+}
+
+# Initialize dg.
+dg-init
+
+# Gather a list of all tests.
+set tests [lsort [find $srcdir/$subdir *.c]]
+
+# Main loop.
+dg-runtest $tests "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-require-effective-target tls_runtime } */
+
+#include <omp.h>
+#include <stdlib.h>
+
+int thr = 32;
+#pragma omp threadprivate (thr)
+
+int
+main (void)
+{
+ int l = 0;
+
+ omp_set_dynamic (0);
+ omp_set_num_threads (6);
+
+#pragma omp parallel copyin (thr) reduction (||:l)
+ {
+ l = thr != 32;
+ thr = omp_get_thread_num () + 11;
+ }
+
+ if (l || thr != 11)
+ abort ();
+
+#pragma omp parallel reduction (||:l)
+ l = thr != omp_get_thread_num () + 11;
+
+ if (l)
+ abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-require-effective-target tls_runtime } */
+
+#include <omp.h>
+#include <stdlib.h>
+
+struct { int t; char buf[64]; } thr = { 32, "" };
+#pragma omp threadprivate (thr)
+
+int
+main (void)
+{
+ int l = 0;
+
+ omp_set_dynamic (0);
+ omp_set_num_threads (6);
+
+#pragma omp parallel copyin (thr) reduction (||:l)
+ {
+ l = thr.t != 32;
+ thr.t = omp_get_thread_num () + 11;
+ }
+
+ if (l || thr.t != 11)
+ abort ();
+
+#pragma omp parallel reduction (||:l)
+ l = thr.t != omp_get_thread_num () + 11;
+
+ if (l)
+ abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-require-effective-target tls_runtime } */
+
+#include <omp.h>
+#include <stdlib.h>
+
+int thr;
+#pragma omp threadprivate (thr)
+
+int
+test (int l)
+{
+ return l || (thr != omp_get_thread_num () * 2);
+}
+
+int
+main (void)
+{
+ int l = 0;
+
+ omp_set_dynamic (0);
+ omp_set_num_threads (6);
+
+ thr = 8;
+ /* Broadcast the value to all threads. */
+#pragma omp parallel copyin (thr)
+ ;
+
+#pragma omp parallel reduction (||:l)
+ {
+ /* Now test if the broadcast succeeded. */
+ l = thr != 8;
+ thr = omp_get_thread_num () * 2;
+#pragma omp barrier
+ l = test (l);
+ }
+
+ if (l)
+ abort ();
+ return 0;
+}
--- /dev/null
+/* Trivial test of critical sections. */
+
+#include <omp.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <assert.h>
+#include "libgomp_g.h"
+
+
+static volatile int test = -1;
+
+static void function(void *dummy)
+{
+ int iam = omp_get_thread_num ();
+ int old;
+
+ GOMP_critical_start ();
+
+ old = __sync_lock_test_and_set (&test, iam);
+ assert (old == -1);
+
+ usleep (10);
+ test = -1;
+
+ GOMP_critical_end ();
+}
+
+int main()
+{
+ omp_set_dynamic (0);
+
+ GOMP_parallel_start (function, NULL, 3);
+ function (NULL);
+ GOMP_parallel_end ();
+
+ return 0;
+}
--- /dev/null
+// { dg-do run }
+// Test several constructs within a parallel. At one point in development,
+// the critical directive clobbered the shared clause of the parallel.
+
+#include <omp.h>
+#include <stdlib.h>
+
+#define N 2000
+
+int main()
+{
+ int A[N];
+ int nthreads;
+ int i;
+
+#pragma omp parallel shared (A, nthreads)
+ {
+ #pragma omp master
+ nthreads = omp_get_num_threads ();
+
+ #pragma omp for
+ for (i = 0; i < N; i++)
+ A[i] = 0;
+
+ #pragma omp critical
+ for (i = 0; i < N; i++)
+ A[i] += 1;
+ }
+
+ for (i = 0; i < N; i++)
+ if (A[i] != nthreads)
+ abort ();
+
+ return 0;
+}
--- /dev/null
+#include <stdlib.h>
+#include <omp.h>
+
+int
+main (void)
+{
+ double d, e;
+ int l;
+ omp_lock_t lck;
+ omp_nest_lock_t nlck;
+
+ d = omp_get_wtime ();
+
+ omp_init_lock (&lck);
+ omp_set_lock (&lck);
+ if (omp_test_lock (&lck))
+ abort ();
+ omp_unset_lock (&lck);
+ if (! omp_test_lock (&lck))
+ abort ();
+ if (omp_test_lock (&lck))
+ abort ();
+ omp_unset_lock (&lck);
+ omp_destroy_lock (&lck);
+
+ omp_init_nest_lock (&nlck);
+ if (omp_test_nest_lock (&nlck) != 1)
+ abort ();
+ omp_set_nest_lock (&nlck);
+ if (omp_test_nest_lock (&nlck) != 3)
+ abort ();
+ omp_unset_nest_lock (&nlck);
+ omp_unset_nest_lock (&nlck);
+ if (omp_test_nest_lock (&nlck) != 2)
+ abort ();
+ omp_unset_nest_lock (&nlck);
+ omp_unset_nest_lock (&nlck);
+ omp_destroy_nest_lock (&nlck);
+
+ omp_set_dynamic (1);
+ if (! omp_get_dynamic ())
+ abort ();
+ omp_set_dynamic (0);
+ if (omp_get_dynamic ())
+ abort ();
+
+ omp_set_nested (1);
+ if (! omp_get_nested ())
+ abort ();
+ omp_set_nested (0);
+ if (omp_get_nested ())
+ abort ();
+
+ omp_set_num_threads (5);
+ if (omp_get_num_threads () != 1)
+ abort ();
+ if (omp_get_max_threads () != 5)
+ abort ();
+ if (omp_get_thread_num () != 0)
+ abort ();
+ omp_set_num_threads (3);
+ if (omp_get_num_threads () != 1)
+ abort ();
+ if (omp_get_max_threads () != 3)
+ abort ();
+ if (omp_get_thread_num () != 0)
+ abort ();
+ l = 0;
+#pragma omp parallel reduction (|:l)
+ {
+ l = omp_get_num_threads () != 3;
+ l |= omp_get_thread_num () < 0;
+ l |= omp_get_thread_num () >= 3;
+#pragma omp master
+ l |= omp_get_thread_num () != 0;
+ }
+ if (l)
+ abort ();
+
+ if (omp_get_num_procs () <= 0)
+ abort ();
+ if (omp_in_parallel ())
+ abort ();
+#pragma omp parallel reduction (|:l)
+ l = ! omp_in_parallel ();
+#pragma omp parallel reduction (|:l) if (1)
+ l = ! omp_in_parallel ();
+
+ e = omp_get_wtime ();
+ if (d > e)
+ abort ();
+ d = omp_get_wtick ();
+ /* Negative precision is definitely wrong,
+ bigger than 1s clock resolution is also strange. */
+ if (d <= 0 || d > 1)
+ abort ();
+
+ return 0;
+}
--- /dev/null
+/* Test that all loop iterations are touched. This doesn't verify
+ scheduling order, merely coverage. */
+
+#include <omp.h>
+#include <string.h>
+#include <assert.h>
+#include "libgomp_g.h"
+
+
+#define N 10000
+static int S, E, INCR, CHUNK, NTHR;
+static int data[N];
+
+static void clean_data (void)
+{
+ memset (data, -1, sizeof (data));
+}
+
+static void test_data (void)
+{
+ int i, j;
+
+ for (i = 0; i < S; ++i)
+ assert (data[i] == -1);
+
+ for (j = 0; i < E; ++i, j = (j + 1) % INCR)
+ if (j == 0)
+ assert (data[i] != -1);
+ else
+ assert (data[i] == -1);
+
+ for (; i < N; ++i)
+ assert (data[i] == -1);
+}
+
+static void set_data (long i, int val)
+{
+ int old;
+ assert (i >= 0 && i < N);
+ old = __sync_lock_test_and_set (data+i, val);
+ assert (old == -1);
+}
+
+
+#define TMPL_1(sched) \
+static void f_##sched##_1 (void *dummy) \
+{ \
+ int iam = omp_get_thread_num (); \
+ long s0, e0, i; \
+ if (GOMP_loop_##sched##_start (S, E, INCR, CHUNK, &s0, &e0)) \
+ do \
+ { \
+ for (i = s0; i < e0; i += INCR) \
+ set_data (i, iam); \
+ } \
+ while (GOMP_loop_##sched##_next (&s0, &e0)); \
+ GOMP_loop_end (); \
+} \
+static void t_##sched##_1 (void) \
+{ \
+ clean_data (); \
+ GOMP_parallel_start (f_##sched##_1, NULL, NTHR); \
+ f_##sched##_1 (NULL); \
+ GOMP_parallel_end (); \
+ test_data (); \
+}
+
+TMPL_1(static)
+TMPL_1(dynamic)
+TMPL_1(guided)
+
+#define TMPL_2(sched) \
+static void f_##sched##_2 (void *dummy) \
+{ \
+ int iam = omp_get_thread_num (); \
+ long s0, e0, i; \
+ while (GOMP_loop_##sched##_next (&s0, &e0)) \
+ { \
+ for (i = s0; i < e0; i += INCR) \
+ set_data (i, iam); \
+ } \
+ GOMP_loop_end_nowait (); \
+} \
+static void t_##sched##_2 (void) \
+{ \
+ clean_data (); \
+ GOMP_parallel_loop_##sched##_start \
+ (f_##sched##_2, NULL, NTHR, S, E, INCR, CHUNK); \
+ f_##sched##_2 (NULL); \
+ GOMP_parallel_end (); \
+ test_data (); \
+}
+
+TMPL_2(static)
+TMPL_2(dynamic)
+TMPL_2(guided)
+
+static void test (void)
+{
+ t_static_1 ();
+ t_dynamic_1 ();
+ t_guided_1 ();
+ t_static_2 ();
+ t_dynamic_2 ();
+ t_guided_2 ();
+}
+
+int main()
+{
+ omp_set_dynamic (0);
+
+ NTHR = 4;
+
+ S = 0, E = N, INCR = 1, CHUNK = 4;
+ test ();
+
+ S = 0, E = N, INCR = 2, CHUNK = 4;
+ test ();
+
+ S = 1, E = N-1, INCR = 1, CHUNK = 5;
+ test ();
+
+ S = 1, E = N-1, INCR = 2, CHUNK = 5;
+ test ();
+
+ S = 2, E = 4, INCR = 1, CHUNK = 1;
+ test ();
+
+ S = 0, E = N, INCR = 1, CHUNK = 0;
+ t_static_1 ();
+ t_static_2 ();
+
+ S = 1, E = N-1, INCR = 1, CHUNK = 0;
+ t_static_1 ();
+ t_static_2 ();
+
+ return 0;
+}
--- /dev/null
+/* Validate static scheduling iteration dispatch. We only test with
+ even thread distributions here; there are multiple valid solutions
+ for uneven thread distributions. */
+
+#include <omp.h>
+#include <string.h>
+#include <assert.h>
+#include "libgomp_g.h"
+
+
+#define N 360
+static int data[N][2];
+static int INCR, NTHR, CHUNK;
+
+static void clean_data (void)
+{
+ memset (data, -1, sizeof (data));
+}
+
+static void test_data (void)
+{
+ int n, i, c, thr, iter, chunk;
+
+ chunk = CHUNK;
+ if (chunk == 0)
+ chunk = N / INCR / NTHR;
+
+ thr = iter = c = i = 0;
+
+ for (n = 0; n < N; ++n)
+ {
+ if (i == 0)
+ {
+ assert (data[n][0] == thr);
+ assert (data[n][1] == iter);
+ }
+ else
+ {
+ assert (data[n][0] == -1);
+ assert (data[n][1] == -1);
+ }
+
+ if (++i == INCR)
+ {
+ i = 0;
+ if (++c == chunk)
+ {
+ c = 0;
+ if (++thr == NTHR)
+ {
+ thr = 0;
+ ++iter;
+ }
+ }
+ }
+ }
+}
+
+static void set_data (long i, int thr, int iter)
+{
+ int old;
+ assert (i >= 0 && i < N);
+ old = __sync_lock_test_and_set (&data[i][0], thr);
+ assert (old == -1);
+ old = __sync_lock_test_and_set (&data[i][1], iter);
+ assert (old == -1);
+}
+
+static void f_static_1 (void *dummy)
+{
+ int iam = omp_get_thread_num ();
+ long s0, e0, i, count = 0;
+ if (GOMP_loop_static_start (0, N, INCR, CHUNK, &s0, &e0))
+ do
+ {
+ for (i = s0; i < e0; i += INCR)
+ set_data (i, iam, count);
+ ++count;
+ }
+ while (GOMP_loop_static_next (&s0, &e0));
+ GOMP_loop_end ();
+}
+
+static void test (void)
+{
+ clean_data ();
+ GOMP_parallel_start (f_static_1, NULL, NTHR);
+ f_static_1 (NULL);
+ GOMP_parallel_end ();
+ test_data ();
+}
+
+int main()
+{
+ omp_set_dynamic (0);
+
+ NTHR = 5;
+
+ INCR = 1, CHUNK = 0; /* chunk = 360 / 5 = 72 */
+ test ();
+
+ INCR = 4, CHUNK = 0; /* chunk = 360 / 4 / 5 = 18 */
+ test ();
+
+ INCR = 1, CHUNK = 4; /* 1 * 4 * 5 = 20 -> 360 / 20 = 18 iterations. */
+ test ();
+
+ INCR = 3, CHUNK = 4; /* 3 * 4 * 5 = 60 -> 360 / 60 = 6 iterations. */
+ test ();
+
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+extern void abort (void);
+
+volatile int count;
+static int test(void)
+{
+ return ++count > 0;
+}
+
+int main()
+{
+ int i;
+ #pragma omp for
+ for (i = 0; i < 10; ++i)
+ {
+ if (test())
+ continue;
+ abort ();
+ }
+ if (i != count)
+ abort ();
+ return 0;
+}
--- /dev/null
+#include <omp.h>
+#include <stdlib.h>
+
+int
+main (void)
+{
+ int i = -1, j = -1;
+
+ omp_set_nested (1);
+ omp_set_dynamic (0);
+#pragma omp parallel num_threads (4)
+ {
+#pragma omp single
+ {
+ i = omp_get_thread_num () + omp_get_num_threads () * 256;
+#pragma omp parallel num_threads (2)
+ {
+#pragma omp single
+ {
+ j = omp_get_thread_num () + omp_get_num_threads () * 256;
+ }
+ }
+ }
+ }
+ if (i < 4 * 256 || i >= 4 * 256 + 4)
+ abort ();
+ if (j < 2 * 256 || j >= 2 * 256 + 2)
+ abort ();
+ return 0;
+}
--- /dev/null
+#include <omp.h>
+#include <stdlib.h>
+
+int
+main (void)
+{
+ int i = -1, j = -1;
+
+ omp_set_nested (0);
+ omp_set_dynamic (0);
+#pragma omp parallel num_threads (4)
+ {
+#pragma omp single
+ {
+ i = omp_get_thread_num () + omp_get_num_threads () * 256;
+#pragma omp parallel num_threads (2)
+ {
+#pragma omp single
+ {
+ j = omp_get_thread_num () + omp_get_num_threads () * 256;
+ }
+ }
+ }
+ }
+ if (i < 4 * 256 || i >= 4 * 256 + 4)
+ abort ();
+ if (j != 256 + 0)
+ abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+#include <omp.h>
+#include <stdlib.h>
+
+int
+main (void)
+{
+ int a = 1, b = 2, c = 3;
+ void
+ foo (void)
+ {
+ int l = 0;
+#pragma omp parallel shared (a) private (b) firstprivate (c) \
+ num_threads (2) reduction (||:l)
+ {
+ if (a != 1 || c != 3) l = 1;
+#pragma omp barrier
+ if (omp_get_thread_num () == 0)
+ {
+ a = 4;
+ b = 5;
+ c = 6;
+ }
+#pragma omp barrier
+ if (omp_get_thread_num () == 1)
+ {
+ if (a != 4 || c != 3) l = 1;
+ a = 7;
+ b = 8;
+ c = 9;
+ }
+ else if (omp_get_num_threads () == 1)
+ a = 7;
+#pragma omp barrier
+ if (omp_get_thread_num () == 0)
+ if (a != 7 || b != 5 || c != 6) l = 1;
+#pragma omp barrier
+ if (omp_get_thread_num () == 1)
+ if (a != 7 || b != 8 || c != 9) l = 1;
+ }
+ if (l)
+ abort ();
+ }
+ foo ();
+ if (a != 7)
+ abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+extern void abort (void);
+
+int
+main (void)
+{
+ int i;
+ void
+ foo (void)
+ {
+#pragma omp master
+ i += 8;
+ }
+ i = 4;
+ foo ();
+ if (i != 12)
+ abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+#include <omp.h>
+
+extern void abort (void);
+
+int
+main (void)
+{
+ int i = 5, l = 0;
+ int foo (void) { return i == 6; }
+ int bar (void) { return i - 3; }
+
+ omp_set_dynamic (0);
+
+#pragma omp parallel if (foo ()) num_threads (bar ()) reduction (|:l)
+ if (omp_get_num_threads () != 1)
+ l = 1;
+
+ i++;
+
+#pragma omp parallel if (foo ()) num_threads (bar ()) reduction (|:l)
+ if (omp_get_num_threads () != 3)
+ l = 1;
+
+ i++;
+
+#pragma omp master
+ if (bar () != 4)
+ abort ();
+
+#pragma omp single
+ {
+ if (foo ())
+ abort ();
+ i--;
+ if (! foo ())
+ abort ();
+ }
+
+ if (l)
+ abort ();
+
+ i = 8;
+#pragma omp atomic
+ l += bar ();
+
+ if (l != 5)
+ abort ();
+
+ return 0;
+}
--- /dev/null
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <omp.h>
+
+#define MAX 1000
+
+void main1()
+{
+ int i, N1, N2, step;
+ int a[MAX], b[MAX];
+
+ N1 = rand () % 13;
+ N2 = rand () % (MAX - 51) + 50;
+ step = rand () % 7 + 1;
+
+ printf ("N1 = %d\nN2 = %d\nstep = %d\n", N1, N2, step);
+
+ for (i = N1; i <= N2; i += step)
+ a[i] = 42+ i;
+
+ /* COUNTING UP (<). Fill in array 'b' in parallel. */
+ memset (b, 0, sizeof b);
+#pragma omp parallel shared(a,b,N1,N2,step) private(i)
+ {
+#pragma omp for
+ for (i = N1; i < N2; i += step)
+ b[i] = a[i];
+ }
+
+ /* COUNTING UP (<). Check that all the cells were filled in properly. */
+ for (i = N1; i < N2; i += step)
+ if (a[i] != b[i])
+ abort ();
+
+ printf ("for (i = %d; i < %d; i += %d) [OK]\n", N1, N2, step);
+
+ /* COUNTING UP (<=). Fill in array 'b' in parallel. */
+ memset (b, 0, sizeof b);
+#pragma omp parallel shared(a,b,N1,N2,step) private(i)
+ {
+#pragma omp for
+ for (i = N1; i <= N2; i += step)
+ b[i] = a[i];
+ }
+
+ /* COUNTING UP (<=). Check that all the cells were filled in properly. */
+ for (i = N1; i <= N2; i += step)
+ if (a[i] != b[i])
+ abort ();
+
+ printf ("for (i = %d; i <= %d; i += %d) [OK]\n", N1, N2, step);
+
+ /* COUNTING DOWN (>). Fill in array 'b' in parallel. */
+ memset (b, 0, sizeof b);
+#pragma omp parallel shared(a,b,N1,N2,step) private(i)
+ {
+#pragma omp for
+ for (i = N2; i > N1; i -= step)
+ b[i] = a[i];
+ }
+
+ /* COUNTING DOWN (>). Check that all the cells were filled in properly. */
+ for (i = N2; i > N1; i -= step)
+ if (a[i] != b[i])
+ abort ();
+
+ printf ("for (i = %d; i > %d; i -= %d) [OK]\n", N2, N1, step);
+
+ /* COUNTING DOWN (>=). Fill in array 'b' in parallel. */
+ memset (b, 0, sizeof b);
+#pragma omp parallel shared(a,b,N1,N2,step) private(i)
+ {
+#pragma omp for
+ for (i = N2; i >= N1; i -= step)
+ b[i] = a[i];
+ }
+
+ /* COUNTING DOWN (>=). Check that all the cells were filled in properly. */
+ for (i = N2; i >= N1; i -= step)
+ if (a[i] != b[i])
+ abort ();
+
+ printf ("for (i = %d; i >= %d; i -= %d) [OK]\n", N2, N1, step);
+}
+
+int
+main ()
+{
+ int i;
+
+ srand (0);
+ for (i = 0; i < 10; ++i)
+ main1();
+ return 0;
+}
--- /dev/null
+#include <omp.h>
+
+/* Orphaned work sharing. */
+
+extern void abort (void);
+
+#define N 10
+
+void parloop (int *a)
+{
+ int i;
+
+#pragma omp for
+ for (i = 0; i < N; i++)
+ a[i] = i + 3;
+}
+
+main()
+{
+ int i, a[N];
+
+#pragma omp parallel shared(a)
+ {
+ parloop (a);
+ }
+
+ for (i = 0; i < N; i++)
+ if (a[i] != i + 3)
+ abort ();
+
+ return 0;
+}
--- /dev/null
+extern void abort (void);
+int a;
+
+void
+foo ()
+{
+ int i;
+ a = 30;
+#pragma omp barrier
+#pragma omp for lastprivate (a)
+ for (i = 0; i < 1024; i++)
+ {
+ a = i;
+ }
+ if (a != 1023)
+ abort ();
+}
+
+int
+main (void)
+{
+#pragma omp parallel num_threads (64)
+ foo ();
+
+ return 0;
+}
--- /dev/null
+// { dg-do run }
+
+extern void abort(void);
+#define N 1000
+
+int foo()
+{
+ int i = 0, j;
+
+ #pragma omp parallel for num_threads(2) shared (i)
+ for (j = 0; j < N; ++j)
+ {
+ #pragma omp parallel num_threads(1) shared (i)
+ {
+ #pragma omp atomic
+ i++;
+ }
+ }
+
+ return i;
+}
+
+int main()
+{
+ if (foo() != N)
+ abort ();
+ return 0;
+}
--- /dev/null
+extern void abort (void);
+
+main()
+{
+ int i, a;
+
+ a = 30;
+
+#pragma omp parallel for firstprivate (a) lastprivate (a) \
+ num_threads (2) schedule(static)
+ for (i = 0; i < 10; i++)
+ a = a + i;
+
+ /* The thread that owns the last iteration will have computed
+ 30 + 5 + 6 + 7 + 8 + 9 = 65. */
+ if (a != 65)
+ abort ();
+
+ return 0;
+}
--- /dev/null
+#include <omp.h>
+
+extern void abort (void);
+
+int
+foo (void)
+{
+ return 10;
+}
+
+main ()
+{
+ int A = 0;
+
+ #pragma omp parallel if (foo () > 10) shared (A)
+ {
+ A = omp_get_num_threads ();
+ }
+
+ if (A != 1)
+ abort ();
+
+ #pragma omp parallel if (foo () == 10) num_threads (3) shared (A)
+ {
+ A = omp_get_num_threads ();
+ }
+
+ if (A != 3)
+ abort ();
+
+ #pragma omp parallel if (foo () == 10) num_threads (foo ()) shared (A)
+ {
+ A = omp_get_num_threads ();
+ }
+
+ if (A != 10)
+ abort ();
+
+ return 0;
+}
--- /dev/null
+extern void abort (void);
+
+main()
+{
+ int i = 0;
+
+ #pragma omp parallel shared (i)
+ {
+ #pragma omp single
+ {
+ i++;
+ }
+ }
+
+ if (i != 1)
+ abort ();
+
+ return 0;
+}
--- /dev/null
+#include <omp.h>
+
+extern void abort (void);
+
+struct X
+{
+ int a;
+ char b;
+ int c;
+};
+
+main()
+{
+ int i = 0;
+ struct X x;
+ int bad = 0;
+
+ #pragma omp parallel private (i, x) shared (bad)
+ {
+ i = 5;
+
+ #pragma omp single copyprivate (i, x)
+ {
+ i++;
+ x.a = 23;
+ x.b = 42;
+ x.c = 26;
+ }
+
+ if (i != 6 || x.a != 23 || x.b != 42 || x.c != 26)
+ bad = 1;
+ }
+
+ if (bad)
+ abort ();
+
+ return 0;
+}
--- /dev/null
+extern void abort (void);
+
+void
+single (int a, int b)
+{
+ #pragma omp single copyprivate(a) copyprivate(b)
+ {
+ a = b = 5;
+ }
+
+ if (a != b)
+ abort ();
+}
+
+int main()
+{
+ #pragma omp parallel
+ single (1, 2);
+
+ return 0;
+}
--- /dev/null
+/******************************************************************************
+* FILE: omp_hello.c
+* DESCRIPTION:
+* OpenMP Example - Hello World - C/C++ Version
+* In this simple example, the master thread forks a parallel region.
+* All threads in the team obtain their unique thread number and print it.
+* The master thread only prints the total number of threads. Two OpenMP
+* library routines are used to obtain the number of threads and each
+* thread's number.
+* AUTHOR: Blaise Barney 5/99
+* LAST REVISED: 04/06/05
+******************************************************************************/
+#include <omp.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main (int argc, char *argv[]) {
+
+int nthreads, tid;
+
+/* Fork a team of threads giving them their own copies of variables */
+#pragma omp parallel private(nthreads, tid)
+ {
+
+ /* Obtain thread number */
+ tid = omp_get_thread_num();
+ printf("Hello World from thread = %d\n", tid);
+
+ /* Only master thread does this */
+ if (tid == 0)
+ {
+ nthreads = omp_get_num_threads();
+ printf("Number of threads = %d\n", nthreads);
+ }
+
+ } /* All threads join master thread and disband */
+
+ return 0;
+}
--- /dev/null
+/******************************************************************************
+* OpenMP Example - Matrix-vector multiplication - C/C++ Version
+* FILE: omp_matvec.c
+* DESCRIPTION:
+* This example multiplies all row i elements of matrix A with vector
+* element b(i) and stores the summed products in vector c(i). A total is
+* maintained for the entire matrix. Performed by using the OpenMP loop
+* work-sharing construct. The update of the shared global total is
+* serialized by using the OpenMP critical directive.
+* SOURCE: Blaise Barney 5/99
+* LAST REVISED:
+******************************************************************************/
+
+#include <omp.h>
+#include <stdio.h>
+#define SIZE 10
+
+
+main ()
+{
+
+float A[SIZE][SIZE], b[SIZE], c[SIZE], total;
+int i, j, tid;
+
+/* Initializations */
+total = 0.0;
+for (i=0; i < SIZE; i++)
+ {
+ for (j=0; j < SIZE; j++)
+ A[i][j] = (j+1) * 1.0;
+ b[i] = 1.0 * (i+1);
+ c[i] = 0.0;
+ }
+printf("\nStarting values of matrix A and vector b:\n");
+for (i=0; i < SIZE; i++)
+ {
+ printf(" A[%d]= ",i);
+ for (j=0; j < SIZE; j++)
+ printf("%.1f ",A[i][j]);
+ printf(" b[%d]= %.1f\n",i,b[i]);
+ }
+printf("\nResults by thread/row:\n");
+
+/* Create a team of threads and scope variables */
+#pragma omp parallel shared(A,b,c,total) private(tid,i)
+ {
+ tid = omp_get_thread_num();
+
+/* Loop work-sharing construct - distribute rows of matrix */
+#pragma omp for private(j)
+ for (i=0; i < SIZE; i++)
+ {
+ for (j=0; j < SIZE; j++)
+ c[i] += (A[i][j] * b[i]);
+
+ /* Update and display of running total must be serialized */
+ #pragma omp critical
+ {
+ total = total + c[i];
+ printf(" thread %d did row %d\t c[%d]=%.2f\t",tid,i,i,c[i]);
+ printf("Running total= %.2f\n",total);
+ }
+
+ } /* end of parallel i loop */
+
+ } /* end of parallel construct */
+
+printf("\nMatrix-vector total - sum of all c[] = %.2f\n\n",total);
+
+ return 0;
+}
+
--- /dev/null
+/******************************************************************************
+* FILE: omp_orphan.c
+* DESCRIPTION:
+* OpenMP Example - Parallel region with an orphaned directive - C/C++ Version
+* This example demonstrates a dot product being performed by an orphaned
+* loop reduction construct. Scoping of the reduction variable is critical.
+* AUTHOR: Blaise Barney 5/99
+* LAST REVISED: 04/06/05
+******************************************************************************/
+#include <omp.h>
+#include <stdio.h>
+#include <stdlib.h>
+#define VECLEN 100
+
+float a[VECLEN], b[VECLEN], sum;
+
+float dotprod ()
+{
+int i,tid;
+
+tid = omp_get_thread_num();
+#pragma omp for reduction(+:sum)
+ for (i=0; i < VECLEN; i++)
+ {
+ sum = sum + (a[i]*b[i]);
+ printf(" tid= %d i=%d\n",tid,i);
+ }
+
+return(sum);
+}
+
+
+int main (int argc, char *argv[])
+{
+int i;
+
+for (i=0; i < VECLEN; i++)
+ a[i] = b[i] = 1.0 * i;
+sum = 0.0;
+
+#pragma omp parallel
+ sum = dotprod();
+
+printf("Sum = %f\n",sum);
+
+ return 0;
+}
--- /dev/null
+/******************************************************************************
+* FILE: omp_reduction.c
+* DESCRIPTION:
+* OpenMP Example - Combined Parallel Loop Reduction - C/C++ Version
+* This example demonstrates a sum reduction within a combined parallel loop
+* construct. Notice that default data element scoping is assumed - there
+* are no clauses specifying shared or private variables. OpenMP will
+* automatically make loop index variables private within team threads, and
+* global variables shared.
+* AUTHOR: Blaise Barney 5/99
+* LAST REVISED: 04/06/05
+******************************************************************************/
+#include <omp.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main (int argc, char *argv[]) {
+
+int i, n;
+float a[100], b[100], sum;
+
+/* Some initializations */
+n = 100;
+for (i=0; i < n; i++)
+ a[i] = b[i] = i * 1.0;
+sum = 0.0;
+
+#pragma omp parallel for reduction(+:sum)
+ for (i=0; i < n; i++)
+ sum = sum + (a[i] * b[i]);
+
+printf(" Sum = %f\n",sum);
+
+ return 0;
+}
--- /dev/null
+/******************************************************************************
+* FILE: omp_workshare1.c
+* DESCRIPTION:
+* OpenMP Example - Loop Work-sharing - C/C++ Version
+* In this example, the iterations of a loop are scheduled dynamically
+* across the team of threads. A thread will perform CHUNK iterations
+* at a time before being scheduled for the next CHUNK of work.
+* AUTHOR: Blaise Barney 5/99
+* LAST REVISED: 04/06/05
+******************************************************************************/
+#include <omp.h>
+#include <stdio.h>
+#include <stdlib.h>
+#define CHUNKSIZE 10
+#define N 100
+
+int main (int argc, char *argv[]) {
+
+int nthreads, tid, i, chunk;
+float a[N], b[N], c[N];
+
+/* Some initializations */
+for (i=0; i < N; i++)
+ a[i] = b[i] = i * 1.0;
+chunk = CHUNKSIZE;
+
+#pragma omp parallel shared(a,b,c,nthreads,chunk) private(i,tid)
+ {
+ tid = omp_get_thread_num();
+ if (tid == 0)
+ {
+ nthreads = omp_get_num_threads();
+ printf("Number of threads = %d\n", nthreads);
+ }
+ printf("Thread %d starting...\n",tid);
+
+ #pragma omp for schedule(dynamic,chunk)
+ for (i=0; i<N; i++)
+ {
+ c[i] = a[i] + b[i];
+ printf("Thread %d: c[%d]= %f\n",tid,i,c[i]);
+ }
+
+ } /* end of parallel section */
+
+ return 0;
+}
--- /dev/null
+/******************************************************************************
+* FILE: omp_workshare2.c
+* DESCRIPTION:
+* OpenMP Example - Sections Work-sharing - C/C++ Version
+* In this example, the OpenMP SECTION directive is used to assign
+* different array operations to threads that execute a SECTION. Each
+* thread receives its own copy of the result array to work with.
+* AUTHOR: Blaise Barney 5/99
+* LAST REVISED: 04/06/05
+******************************************************************************/
+#include <omp.h>
+#include <stdio.h>
+#include <stdlib.h>
+#define N 50
+
+int main (int argc, char *argv[]) {
+
+int i, nthreads, tid;
+float a[N], b[N], c[N];
+
+/* Some initializations */
+for (i=0; i<N; i++)
+ a[i] = b[i] = i * 1.0;
+
+#pragma omp parallel shared(a,b,nthreads) private(c,i,tid)
+ {
+ tid = omp_get_thread_num();
+ if (tid == 0)
+ {
+ nthreads = omp_get_num_threads();
+ printf("Number of threads = %d\n", nthreads);
+ }
+ printf("Thread %d starting...\n",tid);
+
+ #pragma omp sections nowait
+ {
+ #pragma omp section
+ {
+ printf("Thread %d doing section 1\n",tid);
+ for (i=0; i<N; i++)
+ {
+ c[i] = a[i] + b[i];
+ printf("Thread %d: c[%d]= %f\n",tid,i,c[i]);
+ }
+ }
+
+ #pragma omp section
+ {
+ printf("Thread %d doing section 2\n",tid);
+ for (i=0; i<N; i++)
+ {
+ c[i] = a[i] * b[i];
+ printf("Thread %d: c[%d]= %f\n",tid,i,c[i]);
+ }
+ }
+
+ } /* end of sections */
+
+ printf("Thread %d done.\n",tid);
+
+ } /* end of parallel section */
+
+ return 0;
+}
--- /dev/null
+/* { dg-do compile } */
+
+/******************************************************************************
+* OpenMP Example - Combined Parallel Loop Work-sharing - C/C++ Version
+* FILE: omp_workshare3.c
+* DESCRIPTION:
+* This example attempts to show use of the parallel for construct. However
+* it will generate errors at compile time. Try to determine what is causing
+* the error. See omp_workshare4.c for a corrected version.
+* SOURCE: Blaise Barney 5/99
+* LAST REVISED: 03/03/2002
+******************************************************************************/
+
+#include <omp.h>
+#include <stdio.h>
+#define N 50
+#define CHUNKSIZE 5
+
+main () {
+
+int i, chunk, tid;
+float a[N], b[N], c[N];
+
+/* Some initializations */
+for (i=0; i < N; i++)
+ a[i] = b[i] = i * 1.0;
+chunk = CHUNKSIZE;
+
+#pragma omp parallel for \
+ shared(a,b,c,chunk) \
+ private(i,tid) \
+ schedule(static,chunk)
+ { /* { dg-error "expected" } */
+ tid = omp_get_thread_num();
+ for (i=0; i < N; i++)
+ {
+ c[i] = a[i] + b[i];
+ printf("tid= %d i= %d c[i]= %f\n", tid, i, c[i]);
+ }
+ } /* end of parallel for construct */
+
+ return 0;
+}
--- /dev/null
+/******************************************************************************
+* OpenMP Example - Combined Parallel Loop Work-sharing - C/C++ Version
+* FILE: omp_workshare4.c
+* DESCRIPTION:
+* This is a corrected version of the omp_workshare3.c example. Corrections
+* include removing all statements between the parallel for construct and
+* the actual for loop, and introducing logic to preserve the ability to
+* query a thread's id and print it from inside the for loop.
+* SOURCE: Blaise Barney 5/99
+* LAST REVISED: 03/03/2002
+******************************************************************************/
+
+#include <omp.h>
+#include <stdio.h>
+#define N 50
+#define CHUNKSIZE 5
+
+main () {
+
+int i, chunk, tid;
+float a[N], b[N], c[N];
+char first_time;
+
+/* Some initializations */
+for (i=0; i < N; i++)
+ a[i] = b[i] = i * 1.0;
+chunk = CHUNKSIZE;
+first_time = 'y';
+
+#pragma omp parallel for \
+ shared(a,b,c,chunk) \
+ private(i,tid) \
+ schedule(static,chunk) \
+ firstprivate(first_time)
+
+ for (i=0; i < N; i++)
+ {
+ if (first_time == 'y')
+ {
+ tid = omp_get_thread_num();
+ first_time = 'n';
+ }
+ c[i] = a[i] + b[i];
+ printf("tid= %d i= %d c[i]= %f\n", tid, i, c[i]);
+ }
+
+ return 0;
+}
--- /dev/null
+/* Test that all loop iterations are touched. This doesn't verify
+ scheduling order, merely coverage. */
+/* Note that we never call GOMP_ordered_start in here. AFAICS, this is
+ valid; the only requirement is "not more than once per iteration". */
+
+#include <omp.h>
+#include <string.h>
+#include <assert.h>
+#include "libgomp_g.h"
+
+
+#define N 1000
+static int S, E, INCR, CHUNK, NTHR;
+static int data[N];
+
+static void clean_data (void)
+{
+ memset (data, -1, sizeof (data));
+}
+
+static void test_data (void)
+{
+ int i, j;
+
+ for (i = 0; i < S; ++i)
+ assert (data[i] == -1);
+
+ for (j = 0; i < E; ++i, j = (j + 1) % INCR)
+ if (j == 0)
+ assert (data[i] != -1);
+ else
+ assert (data[i] == -1);
+
+ for (; i < N; ++i)
+ assert (data[i] == -1);
+}
+
+static void set_data (long i, int val)
+{
+ int old;
+ assert (i >= 0 && i < N);
+ old = __sync_lock_test_and_set (data+i, val);
+ assert (old == -1);
+}
+
+
+#define TMPL_1(sched) \
+static void f_##sched##_1 (void *dummy) \
+{ \
+ int iam = omp_get_thread_num (); \
+ long s0, e0, i; \
+ if (GOMP_loop_ordered_##sched##_start (S, E, INCR, CHUNK, &s0, &e0)) \
+ do \
+ { \
+ for (i = s0; i < e0; i += INCR) \
+ set_data (i, iam); \
+ } \
+ while (GOMP_loop_ordered_##sched##_next (&s0, &e0)); \
+ GOMP_loop_end (); \
+} \
+static void t_##sched##_1 (void) \
+{ \
+ clean_data (); \
+ GOMP_parallel_start (f_##sched##_1, NULL, NTHR); \
+ f_##sched##_1 (NULL); \
+ GOMP_parallel_end (); \
+ test_data (); \
+}
+
+TMPL_1(static)
+TMPL_1(dynamic)
+TMPL_1(guided)
+
+static void test (void)
+{
+ t_static_1 ();
+ t_dynamic_1 ();
+ t_guided_1 ();
+}
+
+int main()
+{
+ omp_set_dynamic (0);
+
+ NTHR = 4;
+
+ S = 0, E = N, INCR = 1, CHUNK = 4;
+ test ();
+
+ S = 0, E = N, INCR = 2, CHUNK = 4;
+ test ();
+
+ S = 1, E = N-1, INCR = 1, CHUNK = 5;
+ test ();
+
+ S = 1, E = N-1, INCR = 2, CHUNK = 5;
+ test ();
+
+ S = 2, E = 4, INCR = 1, CHUNK = 1;
+ test ();
+
+ S = 0, E = N, INCR = 1, CHUNK = 0;
+ t_static_1 ();
+
+ S = 1, E = N-1, INCR = 1, CHUNK = 0;
+ t_static_1 ();
+
+ NTHR = 10;
+ S = 1, E = 9, INCR = 1, CHUNK = 0;
+ t_static_1 ();
+
+ return 0;
+}
--- /dev/null
+/* Trivial test of ordered. */
+
+#include <omp.h>
+#include <string.h>
+#include <assert.h>
+#include "libgomp_g.h"
+
+
+#define N 100
+static int next;
+static int CHUNK, NTHR;
+
+static void clean_data (void)
+{
+ next = 0;
+}
+
+static void set_data (long i)
+{
+ int n = __sync_fetch_and_add (&next, 1);
+ assert (n == i);
+}
+
+
+#define TMPL_1(sched) \
+static void f_##sched##_1 (void *dummy) \
+{ \
+ long s0, e0, i; \
+ if (GOMP_loop_ordered_##sched##_start (0, N, 1, CHUNK, &s0, &e0)) \
+ do \
+ { \
+ for (i = s0; i < e0; ++i) \
+ { \
+ GOMP_ordered_start (); \
+ set_data (i); \
+ GOMP_ordered_end (); \
+ } \
+ } \
+ while (GOMP_loop_ordered_##sched##_next (&s0, &e0)); \
+ GOMP_loop_end (); \
+} \
+static void t_##sched##_1 (void) \
+{ \
+ clean_data (); \
+ GOMP_parallel_start (f_##sched##_1, NULL, NTHR); \
+ f_##sched##_1 (NULL); \
+ GOMP_parallel_end (); \
+}
+
+TMPL_1(static)
+TMPL_1(dynamic)
+TMPL_1(guided)
+
+static void test (void)
+{
+ t_static_1 ();
+ t_dynamic_1 ();
+ t_guided_1 ();
+}
+
+int main()
+{
+ omp_set_dynamic (0);
+
+ NTHR = 4;
+
+ CHUNK = 1;
+ test ();
+
+ CHUNK = 5;
+ test ();
+
+ CHUNK = 7;
+ test ();
+
+ CHUNK = 0;
+ t_static_1 ();
+
+ return 0;
+}
--- /dev/null
+#include <stdlib.h>
+
+int cnt;
+
+void
+check (int x)
+{
+ if (cnt++ != x)
+ abort ();
+}
+
+int
+main (void)
+{
+ int j;
+
+ cnt = 0;
+#pragma omp parallel for ordered schedule (static, 1) num_threads (4) if (0)
+ for (j = 0; j < 1000; j++)
+ {
+#pragma omp ordered
+ check (j);
+ }
+
+ cnt = 0;
+#pragma omp parallel for ordered schedule (static, 1) num_threads (4) if (1)
+ for (j = 0; j < 1000; j++)
+ {
+#pragma omp ordered
+ check (j);
+ }
+
+ cnt = 0;
+#pragma omp parallel for ordered schedule (runtime) num_threads (4) if (0)
+ for (j = 0; j < 1000; j++)
+ {
+#pragma omp ordered
+ check (j);
+ }
+
+ cnt = 0;
+#pragma omp parallel for ordered schedule (runtime) num_threads (4) if (1)
+ for (j = 0; j < 1000; j++)
+ {
+#pragma omp ordered
+ check (j);
+ }
+
+ cnt = 0;
+#pragma omp parallel for ordered schedule (dynamic) num_threads (4) if (0)
+ for (j = 0; j < 1000; j++)
+ {
+#pragma omp ordered
+ check (j);
+ }
+
+ cnt = 0;
+#pragma omp parallel for ordered schedule (dynamic) num_threads (4) if (1)
+ for (j = 0; j < 1000; j++)
+ {
+#pragma omp ordered
+ check (j);
+ }
+
+ cnt = 0;
+#pragma omp parallel for ordered schedule (guided) num_threads (4) if (0)
+ for (j = 0; j < 1000; j++)
+ {
+#pragma omp ordered
+ check (j);
+ }
+
+ cnt = 0;
+#pragma omp parallel for ordered schedule (guided) num_threads (4) if (1)
+ for (j = 0; j < 1000; j++)
+ {
+#pragma omp ordered
+ check (j);
+ }
+
+ return 0;
+}
--- /dev/null
+/* Trivial test of thread startup. */
+
+#include <omp.h>
+#include <string.h>
+#include <assert.h>
+#include "libgomp_g.h"
+
+
+static int nthr;
+static int saw[4];
+
+static void function(void *dummy)
+{
+ int iam = omp_get_thread_num ();
+
+ if (iam == 0)
+ nthr = omp_get_num_threads ();
+
+ saw[iam] = 1;
+}
+
+int main()
+{
+ omp_set_dynamic (0);
+
+ GOMP_parallel_start (function, NULL, 2);
+ function (NULL);
+ GOMP_parallel_end ();
+
+ assert (nthr == 2);
+ assert (saw[0] != 0);
+ assert (saw[1] != 0);
+ assert (saw[2] == 0);
+
+ memset (saw, 0, sizeof (saw));
+
+ GOMP_parallel_start (function, NULL, 3);
+ function (NULL);
+ GOMP_parallel_end ();
+
+ assert (nthr == 3);
+ assert (saw[0] != 0);
+ assert (saw[1] != 0);
+ assert (saw[2] != 0);
+ assert (saw[3] == 0);
+
+ return 0;
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-require-effective-target tls } */
+extern int i;
+#pragma omp threadprivate (i)
+
+int i;
--- /dev/null
+/* { dg-do run } */
+/* { dg-additional-sources pr24455-1.c } */
+/* { dg-require-effective-target tls_runtime } */
+
+extern void abort (void);
+
+extern int i;
+#pragma omp threadprivate(i)
+
+int main()
+{
+ i = 0;
+
+#pragma omp parallel default(none) num_threads(10)
+ {
+ i++;
+#pragma omp barrier
+ if (i != 1)
+ abort ();
+ }
+
+ return 0;
+}
--- /dev/null
+#include <omp.h>
+#include <stdlib.h>
+
+int
+main (void)
+{
+ int i = 0, j = 0, k = ~0;
+ double d = 1.0;
+#pragma omp parallel num_threads(4) reduction(+:i) reduction(*:d) reduction(&:k)
+ {
+ if (i != 0 || d != 1.0 || k != ~0)
+#pragma omp atomic
+ j |= 1;
+
+ if (omp_get_num_threads () != 4)
+#pragma omp atomic
+ j |= 2;
+
+ i = omp_get_thread_num ();
+ d = i + 1;
+ k = ~(1 << (2 * i));
+ }
+
+ if (j & 1)
+ abort ();
+ if ((j & 2) == 0)
+ {
+ if (i != (0 + 1 + 2 + 3))
+ abort ();
+ if (d != (1.0 * 2.0 * 3.0 * 4.0))
+ abort ();
+ if (k != (~0 ^ 0x55))
+ abort ();
+ }
+ return 0;
+}
--- /dev/null
+#include <omp.h>
+#include <stdlib.h>
+
+int
+main (void)
+{
+ int i = 0, j = 0, k = ~0, l;
+ double d = 1.0;
+#pragma omp parallel num_threads(4)
+ {
+#pragma omp single
+ {
+ i = 16;
+ k ^= (1 << 16);
+ d += 32.0;
+ }
+
+#pragma omp for reduction(+:i) reduction(*:d) reduction(&:k)
+ for (l = 0; l < 4; l++)
+ {
+ if (omp_get_num_threads () == 4 && (i != 0 || d != 1.0 || k != ~0))
+#pragma omp atomic
+ j |= 1;
+
+ if (l == omp_get_thread_num ())
+ {
+ i = omp_get_thread_num ();
+ d = i + 1;
+ k = ~(1 << (2 * i));
+ }
+ }
+
+ if (omp_get_num_threads () == 4)
+ {
+ if (i != (16 + 0 + 1 + 2 + 3))
+#pragma omp atomic
+ j |= 2;
+ if (d != (33.0 * 1.0 * 2.0 * 3.0 * 4.0))
+#pragma omp atomic
+ j |= 4;
+ if (k != (~0 ^ 0x55 ^ (1 << 16)))
+#pragma omp atomic
+ j |= 8;
+ }
+ }
+
+ if (j)
+ abort ();
+ return 0;
+}
--- /dev/null
+#include <omp.h>
+#include <stdlib.h>
+
+int
+main (void)
+{
+ int i = 0, j = 0, k = ~0, l;
+ double d = 1.0;
+#pragma omp parallel num_threads(4)
+ {
+#pragma omp single
+ {
+ i = 16;
+ k ^= (1 << 16);
+ d += 32.0;
+ }
+
+#pragma omp for reduction(+:i) reduction(*:d) reduction(&:k) nowait
+ for (l = 0; l < 4; l++)
+ {
+ if (omp_get_num_threads () == 4 && (i != 0 || d != 1.0 || k != ~0))
+#pragma omp atomic
+ j |= 1;
+
+ if (l == omp_get_thread_num ())
+ {
+ i = omp_get_thread_num ();
+ d = i + 1;
+ k = ~(1 << (2 * i));
+ }
+ }
+
+ if (omp_get_num_threads () == 4)
+ {
+#pragma omp barrier
+ if (i != (16 + 0 + 1 + 2 + 3))
+#pragma omp atomic
+ j |= 2;
+ if (d != (33.0 * 1.0 * 2.0 * 3.0 * 4.0))
+#pragma omp atomic
+ j |= 4;
+ if (k != (~0 ^ 0x55 ^ (1 << 16)))
+#pragma omp atomic
+ j |= 8;
+ }
+ }
+
+ if (j)
+ abort ();
+ return 0;
+}
--- /dev/null
+#include <omp.h>
+#include <stdlib.h>
+
+int
+main (void)
+{
+ int i = 0, j = 0, k = 0, l = 0;
+#pragma omp parallel num_threads(4) reduction(-:i) reduction(|:k) \
+ reduction(^:l)
+ {
+ if (i != 0 || k != 0 || l != 0)
+#pragma omp atomic
+ j |= 1;
+
+ if (omp_get_num_threads () != 4)
+#pragma omp atomic
+ j |= 2;
+
+ i = omp_get_thread_num ();
+ k = 1 << (2 * i);
+ l = 0xea << (3 * i);
+ }
+
+ if (j & 1)
+ abort ();
+ if ((j & 2) == 0)
+ {
+ if (i != (0 + 1 + 2 + 3))
+ abort ();
+ if (k != 0x55)
+ abort ();
+ if (l != 0x1e93a)
+ abort ();
+ }
+ return 0;
+}
--- /dev/null
+/* Test that all sections are touched. */
+
+#include <omp.h>
+#include <string.h>
+#include <assert.h>
+#include "libgomp_g.h"
+
+
+#define N 100
+static int data[N];
+static int NTHR;
+
+static void clean_data (void)
+{
+ memset (data, -1, sizeof (data));
+}
+
+static void test_data (void)
+{
+ int i;
+
+ for (i = 0; i < N; ++i)
+ assert (data[i] != -1);
+}
+
+static void set_data (unsigned i, int val)
+{
+ int old;
+ assert (i >= 1 && i <= N);
+ old = __sync_lock_test_and_set (data+i-1, val);
+ assert (old == -1);
+}
+
+
+static void f_1 (void *dummy)
+{
+ int iam = omp_get_thread_num ();
+ unsigned long s;
+
+ for (s = GOMP_sections_start (N); s ; s = GOMP_sections_next ())
+ set_data (s, iam);
+ GOMP_sections_end ();
+}
+
+static void test_1 (void)
+{
+ clean_data ();
+ GOMP_parallel_start (f_1, NULL, NTHR);
+ f_1 (NULL);
+ GOMP_parallel_end ();
+ test_data ();
+}
+
+static void f_2 (void *dummy)
+{
+ int iam = omp_get_thread_num ();
+ unsigned s;
+
+ while ((s = GOMP_sections_next ()))
+ set_data (s, iam);
+ GOMP_sections_end_nowait ();
+}
+
+static void test_2 (void)
+{
+ clean_data ();
+ GOMP_parallel_sections_start (f_2, NULL, NTHR, N);
+ f_2 (NULL);
+ GOMP_parallel_end ();
+ test_data ();
+}
+
+int main()
+{
+ omp_set_dynamic (0);
+
+ NTHR = 4;
+
+ test_1 ();
+ test_2 ();
+
+ return 0;
+}
--- /dev/null
+extern void abort (void);
+
+struct Y
+{
+ int l[5][10];
+};
+
+struct X
+{
+ struct Y y;
+ float b[10];
+};
+
+void
+parallel (int a, int b)
+{
+ int i, j;
+ struct X A[10][5];
+ a = b = 3;
+
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 5; j++)
+ A[i][j].y.l[3][3] = -10;
+
+ #pragma omp parallel shared (a, b, A) num_threads (5)
+ {
+ int i, j;
+
+ #pragma omp atomic
+ a += omp_get_num_threads ();
+
+ #pragma omp atomic
+ b += omp_get_num_threads ();
+
+ #pragma omp for private (j)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 5; j++)
+ A[i][j].y.l[3][3] += 20;
+
+ }
+
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 5; j++)
+ if (A[i][j].y.l[3][3] != 10)
+ abort ();
+
+ if (a != 28)
+ abort ();
+
+ if (b != 28)
+ abort ();
+}
+
+main()
+{
+ parallel (1, 2);
+ return 0;
+}
--- /dev/null
+#include <stdio.h>
+#include <omp.h>
+
+extern void abort (void);
+
+void
+parallel (int a, int b)
+{
+ int bad, LASTPRIV, LASTPRIV_SEC;
+ int i;
+
+ a = b = 3;
+
+ bad = 0;
+
+ #pragma omp parallel firstprivate (a,b) shared (bad) num_threads (5)
+ {
+ if (a != 3 || b != 3)
+ bad = 1;
+
+ #pragma omp for lastprivate (LASTPRIV)
+ for (i = 0; i < 10; i++)
+ LASTPRIV = i;
+
+ #pragma omp sections lastprivate (LASTPRIV_SEC)
+ {
+ #pragma omp section
+ { LASTPRIV_SEC = 3; }
+
+ #pragma omp section
+ { LASTPRIV_SEC = 42; }
+ }
+
+ }
+
+ if (LASTPRIV != 9)
+ abort ();
+
+ if (LASTPRIV_SEC != 42)
+ abort ();
+
+ if (bad)
+ abort ();
+}
+
+int main()
+{
+ parallel (1, 2);
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+void abort (void);
+
+int main()
+{
+ int x;
+ int *p;
+
+ p = &x;
+
+ #pragma omp parallel
+ {
+ if (p != &x)
+ abort ();
+ }
+
+ return 0;
+}
--- /dev/null
+/* Trivial test of single. */
+
+#include <omp.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <assert.h>
+#include "libgomp_g.h"
+
+
+static int test;
+
+static void f_nocopy (void *dummy)
+{
+ if (GOMP_single_start ())
+ {
+ int iam = omp_get_thread_num ();
+ int old = __sync_lock_test_and_set (&test, iam);
+ assert (old == -1);
+ }
+}
+
+static void f_copy (void *dummy)
+{
+ int *x = GOMP_single_copy_start ();
+ if (x == NULL)
+ {
+ int iam = omp_get_thread_num ();
+ int old = __sync_lock_test_and_set (&test, iam);
+ assert (old == -1);
+ GOMP_single_copy_end (&test);
+ }
+ else
+ assert (x == &test);
+}
+
+int main()
+{
+ omp_set_dynamic (0);
+
+ test = -1;
+ GOMP_parallel_start (f_nocopy, NULL, 3);
+ f_nocopy (NULL);
+ GOMP_parallel_end ();
+
+ test = -1;
+ GOMP_parallel_start (f_copy, NULL, 3);
+ f_copy (NULL);
+ GOMP_parallel_end ();
+
+ return 0;
+}
--- /dev/null
+#include <stdlib.h>
+
+int
+main (void)
+{
+ int i;
+ i = 4;
+#pragma omp single copyprivate (i)
+ {
+ i = 6;
+ }
+ if (i != 6)
+ abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+#include <omp.h>
+#include <stdlib.h>
+#include <string.h>
+
+int
+main (int argc, char **argv[])
+{
+ int n = argc < 5 ? 12 : 31, i, m, l;
+ char a[n + 3];
+ unsigned short b[n / 2 - 1];
+ int c[n * 2 + 1];
+
+ for (i = 0; i < n + 3; i++)
+ a[i] = i;
+ for (i = 0; i < n / 2 - 1; i++)
+ b[i] = (i << 8) | i;
+ for (i = 0; i < n * 2 + 1; i++)
+ c[i] = (i << 24) | i;
+ l = 0;
+ m = n;
+#pragma omp parallel default (shared) num_threads (4) \
+ firstprivate (a, m) private (b, i) reduction (+:l)
+ {
+ for (i = 0; i < m + 3; i++)
+ if (a[i] != i)
+ l++;
+ for (i = 0; i < m * 2 + 1; i++)
+ if (c[i] != ((i << 24) | i))
+ l++;
+#pragma omp barrier
+ memset (a, omp_get_thread_num (), m + 3);
+ for (i = 0; i < m / 2 - 1; i++)
+ b[i] = a[0] + 7;
+#pragma omp master
+ {
+ for (i = 0; i < m * 2 + 1; i++)
+ c[i] = a[0] + 16;
+ }
+#pragma omp barrier
+ if (a[0] != omp_get_thread_num ())
+ l++;
+ for (i = 1; i < m + 3; i++)
+ if (a[i] != a[0])
+ l++;
+ for (i = 0; i < m / 2 - 1; i++)
+ if (b[i] != a[0] + 7)
+ l++;
+ for (i = 0; i < m * 2 + 1; i++)
+ if (c[i] != 16)
+ l++;
+ }
+ if (l)
+ abort ();
+ for (i = 0; i < n * 2 + 1; i++)
+ if (c[i] != 16)
+ l++;
+ return 0;
+}
--- /dev/null
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ Contributed by Richard Henderson <rth@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ does not by itself cause the resulting executable to be covered by the
+ GNU General Public License. This exception does not however invalidate
+ any other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+/* This file contains routines to manage the work-share queue for a team
+ of threads. */
+
+#include "libgomp.h"
+#include <stdlib.h>
+#include <string.h>
+
+
+/* Create a new work share structure. */
+
+struct gomp_work_share *
+gomp_new_work_share (bool ordered, unsigned nthreads)
+{
+ struct gomp_work_share *ws;
+ size_t size;
+
+ size = sizeof (*ws);
+ if (ordered)
+ size += nthreads * sizeof (ws->ordered_team_ids[0]);
+
+ ws = gomp_malloc_cleared (size);
+ gomp_mutex_init (&ws->lock);
+ ws->ordered_owner = -1;
+
+ return ws;
+}
+
+
+/* Free a work share structure. */
+
+static void
+free_work_share (struct gomp_work_share *ws)
+{
+ gomp_mutex_destroy (&ws->lock);
+ free (ws);
+}
+
+
+/* The current thread is ready to begin the next work sharing construct.
+ In all cases, thr->ts.work_share is updated to point to the new
+ structure. In all cases the work_share lock is locked. Return true
+ if this was the first thread to reach this point. */
+
+bool
+gomp_work_share_start (bool ordered)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ struct gomp_team *team = thr->ts.team;
+ struct gomp_work_share *ws;
+ unsigned ws_index, ws_gen;
+
+ /* Work sharing constructs can be orphaned. */
+ if (team == NULL)
+ {
+ ws = gomp_new_work_share (ordered, 1);
+ thr->ts.work_share = ws;
+ thr->ts.static_trip = 0;
+ gomp_mutex_lock (&ws->lock);
+ return true;
+ }
+
+ gomp_mutex_lock (&team->work_share_lock);
+
+ /* This thread is beginning its next generation. */
+ ws_gen = ++thr->ts.work_share_generation;
+
+ /* If this next generation is not newer than any other generation in
+ the team, then simply reference the existing construct. */
+ if (ws_gen - team->oldest_live_gen < team->num_live_gen)
+ {
+ ws_index = ws_gen & team->generation_mask;
+ ws = team->work_shares[ws_index];
+ thr->ts.work_share = ws;
+ thr->ts.static_trip = 0;
+
+ gomp_mutex_lock (&ws->lock);
+ gomp_mutex_unlock (&team->work_share_lock);
+
+ return false;
+ }
+
+ /* Resize the work shares queue if we've run out of space. */
+ if (team->num_live_gen++ == team->generation_mask)
+ {
+ team->work_shares = gomp_realloc (team->work_shares,
+ 2 * team->num_live_gen
+ * sizeof (*team->work_shares));
+
+ /* Unless oldest_live_gen is zero, the sequence of live elements
+ wraps around the end of the array. If we do nothing, we break
+ lookup of the existing elements. Fix that by unwrapping the
+ data from the front to the end. */
+ if (team->oldest_live_gen > 0)
+ memcpy (team->work_shares + team->num_live_gen,
+ team->work_shares,
+ (team->oldest_live_gen & team->generation_mask)
+ * sizeof (*team->work_shares));
+
+ team->generation_mask = team->generation_mask * 2 + 1;
+ }
+
+ ws_index = ws_gen & team->generation_mask;
+ ws = gomp_new_work_share (ordered, team->nthreads);
+ thr->ts.work_share = ws;
+ thr->ts.static_trip = 0;
+ team->work_shares[ws_index] = ws;
+
+ gomp_mutex_lock (&ws->lock);
+ gomp_mutex_unlock (&team->work_share_lock);
+
+ return true;
+}
+
+
+/* The current thread is done with its current work sharing construct.
+ This version does imply a barrier at the end of the work-share. */
+
+void
+gomp_work_share_end (void)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ struct gomp_team *team = thr->ts.team;
+ struct gomp_work_share *ws = thr->ts.work_share;
+ bool last;
+
+ thr->ts.work_share = NULL;
+
+ /* Work sharing constructs can be orphaned. */
+ if (team == NULL)
+ {
+ free_work_share (ws);
+ return;
+ }
+
+ last = gomp_barrier_wait_start (&team->barrier);
+
+ if (last)
+ {
+ unsigned ws_index;
+
+ ws_index = thr->ts.work_share_generation & team->generation_mask;
+ team->work_shares[ws_index] = NULL;
+ team->oldest_live_gen++;
+ team->num_live_gen = 0;
+
+ free_work_share (ws);
+ }
+
+ gomp_barrier_wait_end (&team->barrier, last);
+}
+
+
+/* The current thread is done with its current work sharing construct.
+ This version does NOT imply a barrier at the end of the work-share. */
+
+void
+gomp_work_share_end_nowait (void)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ struct gomp_team *team = thr->ts.team;
+ struct gomp_work_share *ws = thr->ts.work_share;
+ unsigned completed;
+
+ thr->ts.work_share = NULL;
+
+ /* Work sharing constructs can be orphaned. */
+ if (team == NULL)
+ {
+ free_work_share (ws);
+ return;
+ }
+
+#ifdef HAVE_SYNC_BUILTINS
+ completed = __sync_add_and_fetch (&ws->threads_completed, 1);
+#else
+ gomp_mutex_lock (&ws->lock);
+ completed = ++ws->threads_completed;
+ gomp_mutex_unlock (&ws->lock);
+#endif
+
+ if (completed == team->nthreads)
+ {
+ unsigned ws_index;
+
+ gomp_mutex_lock (&team->work_share_lock);
+
+ ws_index = thr->ts.work_share_generation & team->generation_mask;
+ team->work_shares[ws_index] = NULL;
+ team->oldest_live_gen++;
+ team->num_live_gen--;
+
+ gomp_mutex_unlock (&team->work_share_lock);
+
+ free_work_share (ws);
+ }
+}