From aad47f9b07dc6105c3ce10059a83efea4a36bcfc Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Mon, 13 Jan 2020 22:35:56 -0800 Subject: build: Meson build system Removes the existing Autotools build system and adds a new Meson one. Also replaces the shell script test driver with a Python one, since Meson already brings in a Python dependency. Common operations: - ./configure -> meson _build - make -> ninja -C _build - make install -> ninja -C _build install - make check -> meson test -C _build - make Tartan.pot-update -> ninja -C _build tartan-pot - make update-po -> ninja -C _build tartan-update-po To run the tests with coverage enabled and make a coverage report: - meson _build -Db_coverage=true - meson test -C _build - ninja -C _build coverage-html --- ChangeLog | 2 - Makefile.am | 119 ----- README | 1 + autogen.sh | 38 -- clang-plugin/meson.build | 39 ++ configure.ac | 129 ----- git.mk | 311 ----------- m4/ax_append_compile_flags.m4 | 46 -- m4/ax_append_flag.m4 | 50 -- m4/ax_append_link_flags.m4 | 44 -- m4/ax_check_compile_flag.m4 | 53 -- m4/ax_check_enable_debug.m4 | 124 ----- m4/ax_check_link_flag.m4 | 53 -- m4/ax_compiler_flags_cxxflags.m4 | 136 ----- m4/ax_compiler_flags_gir.m4 | 60 --- m4/ax_compiler_flags_ldflags.m4 | 111 ---- m4/ax_cxx_compile_stdcxx.m4 | 948 --------------------------------- m4/ax_cxx_compile_stdcxx_11.m4 | 39 -- m4/ax_generate_changelog.m4 | 99 ---- m4/ax_is_release.m4 | 80 --- m4/ax_require_defined.m4 | 37 -- m4/tartan_code_coverage.m4 | 264 --------- meson.build | 48 ++ po/POTFILES | 1 + po/POTFILES.in | 1 - po/meson.build | 2 + scripts/meson.build | 8 + subprojects/.gitignore | 2 + subprojects/glib.wrap | 4 + subprojects/gobject-introspection.wrap | 4 + tests/driver.py | 228 ++++++++ tests/meson.build | 29 + tests/wrapper-compiler-errors | 162 ------ 33 files changed, 366 insertions(+), 2906 deletions(-) delete mode 100644 ChangeLog delete mode 100644 Makefile.am delete mode 100755 autogen.sh create mode 100644 clang-plugin/meson.build delete mode 100644 configure.ac delete mode 100644 git.mk delete mode 100644 m4/ax_append_compile_flags.m4 delete mode 100644 m4/ax_append_flag.m4 delete mode 100644 m4/ax_append_link_flags.m4 delete mode 100644 m4/ax_check_compile_flag.m4 delete mode 100644 m4/ax_check_enable_debug.m4 delete mode 100644 m4/ax_check_link_flag.m4 delete mode 100644 m4/ax_compiler_flags_cxxflags.m4 delete mode 100644 m4/ax_compiler_flags_gir.m4 delete mode 100644 m4/ax_compiler_flags_ldflags.m4 delete mode 100644 m4/ax_cxx_compile_stdcxx.m4 delete mode 100644 m4/ax_cxx_compile_stdcxx_11.m4 delete mode 100644 m4/ax_generate_changelog.m4 delete mode 100644 m4/ax_is_release.m4 delete mode 100644 m4/ax_require_defined.m4 delete mode 100644 m4/tartan_code_coverage.m4 create mode 100644 meson.build create mode 100644 po/POTFILES delete mode 100644 po/POTFILES.in create mode 100644 po/meson.build create mode 100644 scripts/meson.build create mode 100644 subprojects/.gitignore create mode 100644 subprojects/glib.wrap create mode 100644 subprojects/gobject-introspection.wrap create mode 100755 tests/driver.py create mode 100644 tests/meson.build delete mode 100755 tests/wrapper-compiler-errors diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index 92bcb9b..0000000 --- a/ChangeLog +++ /dev/null @@ -1,2 +0,0 @@ -The ChangeLog is auto-generated when releasing. -If you are seeing this, use 'git log' for a detailed list of changes. diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 319e3d7..0000000 --- a/Makefile.am +++ /dev/null @@ -1,119 +0,0 @@ -SUBDIRS = . po tests - -ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} - -DISTCHECK_CONFIGURE_FLAGS = -CLEANFILES = -MAINTAINERCLEANFILES = -EXTRA_DIST = -GITIGNOREFILES = - -# clang-plugin library -clangdir = $(libdir)/tartan/$(LLVM_VERSION)/ -clang_LTLIBRARIES = clang-plugin/libtartan.la - -clang_plugin_libtartan_la_SOURCES = \ - clang-plugin/assertion-extracter.cpp \ - clang-plugin/assertion-extracter.h \ - clang-plugin/debug.cpp \ - clang-plugin/debug.h \ - clang-plugin/plugin.cpp \ - clang-plugin/gerror-checker.cpp \ - clang-plugin/gerror-checker.h \ - clang-plugin/gir-attributes.cpp \ - clang-plugin/gir-attributes.h \ - clang-plugin/gir-manager.cpp \ - clang-plugin/gir-manager.h \ - clang-plugin/gassert-attributes.cpp \ - clang-plugin/gassert-attributes.h \ - clang-plugin/gsignal-checker.cpp \ - clang-plugin/gsignal-checker.h \ - clang-plugin/gvariant-checker.cpp \ - clang-plugin/gvariant-checker.h \ - clang-plugin/nullability-checker.cpp \ - clang-plugin/nullability-checker.h \ - clang-plugin/checker.cpp \ - clang-plugin/checker.h \ - clang-plugin/type-manager.cpp \ - clang-plugin/type-manager.h \ - $(NULL) - -clang_plugin_libtartan_la_CPPFLAGS = \ - $(AM_CPPFLAGS) \ - -I$(top_srcdir) \ - -DG_LOG_DOMAIN=\"tartan\" \ - $(DISABLE_DEPRECATED) \ - $(LLVM_CPPFLAGS) \ - $(NULL) - -clang_plugin_libtartan_la_CXXFLAGS = \ - $(AM_CXXFLAGS) \ - -std=c++0x -pedantic \ - $(CODE_COVERAGE_CFLAGS) \ - $(TARTAN_CFLAGS) \ - $(LLVM_CXXFLAGS) \ - $(WARN_CXXFLAGS) \ - $(NULL) - -clang_plugin_libtartan_la_LIBADD = \ - $(AM_LIBADD) \ - $(CODE_COVERAGE_LDFLAGS) \ - $(TARTAN_LIBS) \ - $(LLVM_LIBS) \ - $(NULL) - -clang_plugin_libtartan_la_LDFLAGS = \ - $(AM_LDFLAGS) \ - $(LLVM_LDFLAGS) \ - $(WARN_LDFLAGS) \ - -avoid-version \ - -module \ - $(NULL) - -# Clang and scan-build wrapper scripts -dist_bin_SCRIPTS = \ - scripts/tartan \ - scripts/tartan-build \ - scripts/tartan-json \ - $(NULL) - -# Code coverage -@CODE_COVERAGE_RULES@ -CODE_COVERAGE_IGNORE_PATTERN = \ - "include/clang/*" \ - "include/llvm/*" \ - "include/c++/*" \ - $(NULL) - -# Cleaning -EXTRA_DIST += \ - autogen.sh \ - HACKING \ - tartan.doap \ - $(NULL) - -CLEANFILES += \ - `find "$(srcdir)" -type f -name .dirstamp -print` \ - $(NULL) - -MAINTAINERCLEANFILES += \ - $(GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL) \ - $(GITIGNORE_MAINTAINERCLEANFILES_MAKEFILE_IN) \ - $(GITIGNORE_MAINTAINERCLEANFILES_M4_LIBTOOL) \ - build-aux/ \ - ABOUT-NLS \ - INSTALL \ - omf.make \ - config.rpath \ - `find "m4" -type f -name "*.m4" -print` \ - $(NULL) - -GITIGNOREFILES += \ - .be/id-cache \ - $(NULL) - -# ChangeLog -@GENERATE_CHANGELOG_RULES@ -dist-book: dist-ChangeLog - --include $(top_srcdir)/git.mk diff --git a/README b/README index f138e8e..2f70fa3 100644 --- a/README +++ b/README @@ -18,6 +18,7 @@ Dependencies • gio-2.0 ≥ 2.38.0 • gobject-introspection-1.0 ≥ 1.38.0 • llvm ≥ 7.0 + • meson ≥ 0.52.0 Licensing ========= diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 8f27bec..0000000 --- a/autogen.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# Run this to generate all the initial makefiles, etc. -test -n "$srcdir" || srcdir=$(dirname "$0") -test -n "$srcdir" || srcdir=. - -olddir=$(pwd) - -cd $srcdir - -(test -f configure.ac) || { - echo "*** ERROR: Directory '$srcdir' does not look like the top-level project directory ***" - exit 1 -} - -# shellcheck disable=SC2016 -PKG_NAME=$(autoconf --trace 'AC_INIT:$1' configure.ac) - -if [ "$#" = 0 -a "x$NOCONFIGURE" = "x" ]; then - echo "*** WARNING: I am going to run 'configure' with no arguments." >&2 - echo "*** If you wish to pass any to it, please specify them on the" >&2 - echo "*** '$0' command line." >&2 - echo "" >&2 -fi - -aclocal --install || exit 1 -intltoolize --force --copy --automake || exit 1 -autoreconf --verbose --force --install || exit 1 - -cd "$olddir" -if [ "$NOCONFIGURE" = "" ]; then - $srcdir/configure "$@" || exit 1 - - if [ "$1" = "--help" ]; then exit 0 else - echo "Now type 'make' to compile $PKG_NAME" || exit 1 - fi -else - echo "Skipping configure process." -fi diff --git a/clang-plugin/meson.build b/clang-plugin/meson.build new file mode 100644 index 0000000..9810177 --- /dev/null +++ b/clang-plugin/meson.build @@ -0,0 +1,39 @@ +plugin_sources = [ + 'assertion-extracter.cpp', + 'assertion-extracter.h', + 'checker.cpp', + 'checker.h', + 'debug.cpp', + 'debug.h', + 'gassert-attributes.cpp', + 'gassert-attributes.h', + 'gerror-checker.cpp', + 'gerror-checker.h', + 'gir-attributes.cpp', + 'gir-attributes.h', + 'gir-manager.cpp', + 'gir-manager.h', + 'gsignal-checker.cpp', + 'gsignal-checker.h', + 'gvariant-checker.cpp', + 'gvariant-checker.h', + 'nullability-checker.cpp', + 'nullability-checker.h', + 'plugin.cpp', + 'type-manager.cpp', + 'type-manager.h', +] + +version_arr = llvm.version().split('.') +llvm_major = version_arr[0] +llvm_minor = version_arr[1] +normalized_llvm_version = '@0@.@1@'.format(llvm_major, llvm_minor) + +plugindir = join_paths(get_option('libdir'), meson.project_name(), + normalized_llvm_version) + +plugin = shared_module('tartan', plugin_sources, name_suffix: 'so', + dependencies: [llvm, glib, gobject, gio, gi], + cpp_args: ['-DG_LOG_DOMAIN="tartan"'], + include_directories: config_h_include, + install: true, install_dir: plugindir) diff --git a/configure.ac b/configure.ac deleted file mode 100644 index ab6e12b..0000000 --- a/configure.ac +++ /dev/null @@ -1,129 +0,0 @@ -AC_PREREQ(2.65) - -# Tartan release version -m4_define(tartan_version_major, 0) -m4_define(tartan_version_minor, 4) -m4_define(tartan_version_micro, 0) - -AC_INIT([Tartan], - [tartan_version_major.tartan_version_minor.tartan_version_micro], - [https://gitlab.freedesktop.org/tartan/tartan/issues/new], - [tartan],[http://www.freedesktop.org/software/tartan/]) -AX_IS_RELEASE([git-directory]) - -# Debugging -AX_CHECK_ENABLE_DEBUG([no]) - -AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_AUX_DIR([build-aux]) -AC_CONFIG_SRCDIR([clang-plugin/plugin.cpp]) -AC_CONFIG_HEADERS([config.h]) -AC_USE_SYSTEM_EXTENSIONS - -AM_INIT_AUTOMAKE([1.12 dist-xz no-dist-gzip check-news subdir-objects color-tests parallel-tests]) -AM_SILENT_RULES([yes]) - -AC_PROG_CXX -AM_PROG_CC_C_O -AX_CXX_COMPILE_STDCXX_11() -LT_INIT([]) -PKG_PROG_PKG_CONFIG - -# Requirements -LLVM_REQS=7.0 -GLIB_REQS=2.38 # TODO -GIO_REQS=2.38 # TODO -GIR_REQS=1.38.0 # TODO - -# Tartan versioning -AC_SUBST([TARTAN_VERSION_MAJOR],tartan_version_major) -AC_SUBST([TARTAN_VERSION_MINOR],tartan_version_minor) -AC_SUBST([TARTAN_VERSION_MICRO],tartan_version_micro) - -# Tartan pkg-config dependencies -TARTAN_PACKAGES="gobject-2.0 glib-2.0 >= $GLIB_REQS gio-2.0 >= $GIO_REQS \ - gobject-introspection-1.0 >= $GIR_REQS" -AC_SUBST([TARTAN_PACKAGES]) - -PKG_CHECK_MODULES([TARTAN],[$TARTAN_PACKAGES]) - -# Tartan LLVM dependency -AC_PATH_PROG([LLVM_CONFIG],[llvm-config],"failed") -AS_IF([test $LLVM_CONFIG = "failed"],[ - AC_MSG_ERROR([LLVM version $LLVM_REQS or later needed.]) -]) - -AC_MSG_CHECKING([for LLVM]) - -# LLVM_REQS is either (e.g.) 3.5, 3.6svn or 3.4.2 -req_major=`echo $LLVM_REQS | sed -E 's/([[0-9]]*)\.([[0-9]]*)(\.[[0-9]]*)?(svn)?/\1/'` -req_minor=`echo $LLVM_REQS | sed -E 's/([[0-9]]*)\.([[0-9]]*)(\.[[0-9]]*)?(svn)?/\2/'` - -llvm_version=`$LLVM_CONFIG --version` - -major=`echo $llvm_version | sed -E 's/([[0-9]]*)\.([[0-9]]*)(\.[[0-9]]*)?(svn)?/\1/'` -minor=`echo $llvm_version | sed -E 's/([[0-9]]*)\.([[0-9]]*)(\.[[0-9]]*)?(svn)?/\2/'` - -AS_IF([test "$major" -gt "$req_major" -o \( "$major" -eq "$req_major" -a "$minor" -ge "$req_minor" \)],[ - LLVM_CPPFLAGS=`$LLVM_CONFIG --cppflags | sed -e 's,-I/,-isystem /,' | sed -e 's,-isystem /usr/include,-I/usr/include,'` - LLVM_CXXFLAGS=`$LLVM_CONFIG --cxxflags | sed -e 's,-I/,-isystem /,' | sed -e 's,-isystem /usr/include,-I/usr/include,'` - LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags` - # Don't link against the LLVM libs because they're huge. All the symbols - # will be available when the plugin is loaded anyway. - #LLVM_LIBS=`$LLVM_CONFIG --libs` - LLVM_LIBS='' - LLVM_VERSION="$major.$minor" # don’t include the ‘svn’ suffix - AC_MSG_RESULT([yes]) -],[ - AC_MSG_ERROR([LLVM version $LLVM_REQS or later needed.]) -]) - -AC_SUBST([LLVM_CPPFLAGS]) -AC_SUBST([LLVM_CXXFLAGS]) -AC_SUBST([LLVM_LDFLAGS]) -AC_SUBST([LLVM_LIBS]) -AC_SUBST([LLVM_VERSION]) - -AC_DEFINE_UNQUOTED([LLVM_CONFIG_VERSION],"$llvm_version", - [Configured LLVM version]) - -# LLVM-specific version definitions -AS_IF([test "$major" -ge 8],[ - AC_DEFINE([HAVE_LLVM_8_0], [1], [Whether LLVM ≥ 8.0 is available]) -]) -AS_IF([test "$major" -ge 9],[ - AC_DEFINE([HAVE_LLVM_9_0], [1], [Whether LLVM ≥ 9.0 is available]) -]) - -# Clang dependency (e.g. the clang-devel package on Fedora) -AC_LANG_PUSH([C++]) -old_cppflags="$CPPFLAGS" -CPPFLAGS="$LLVM_CPPFLAGS $CPPFLAGS" -AC_CHECK_HEADER([clang/AST/Expr.h],[],[ - AC_MSG_ERROR([Clang headers version $LLVM_REQS or later needed.]) -]) -CPPFLAGS="$old_cppflags" -AC_LANG_POP([C++]) - -# Internationalisation -GETTEXT_PACKAGE=AC_PACKAGE_NAME -AC_SUBST([GETTEXT_PACKAGE]) -AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],"$GETTEXT_PACKAGE", - [The name of the gettext domain]) -IT_PROG_INTLTOOL([0.40.0]) - -# Code coverage for unit tests -TARTAN_CODE_COVERAGE - -# Compiler warnings -AX_COMPILER_FLAGS - -# ChangeLog generation -AX_GENERATE_CHANGELOG - -AC_CONFIG_FILES([ -Makefile -po/Makefile.in -tests/Makefile -]) -AC_OUTPUT diff --git a/git.mk b/git.mk deleted file mode 100644 index 18c07f6..0000000 --- a/git.mk +++ /dev/null @@ -1,311 +0,0 @@ -# git.mk -# -# Copyright 2009, Red Hat, Inc. -# Copyright 2010,2011,2012,2013 Behdad Esfahbod -# Written by Behdad Esfahbod -# -# Copying and distribution of this file, with or without modification, -# is permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. -# -# The latest version of this file can be downloaded from: -# https://raw.github.com/behdad/git.mk/master/git.mk -# Bugs, etc, should be reported upstream at: -# https://github.com/behdad/git.mk -# -# To use in your project, import this file in your git repo's toplevel, -# then do "make -f git.mk". This modifies all Makefile.am files in -# your project to -include git.mk. Remember to add that line to new -# Makefile.am files you create in your project, or just rerun the -# "make -f git.mk". -# -# This enables automatic .gitignore generation. If you need to ignore -# more files, add them to the GITIGNOREFILES variable in your Makefile.am. -# But think twice before doing that. If a file has to be in .gitignore, -# chances are very high that it's a generated file and should be in one -# of MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, or MAINTAINERCLEANFILES. -# -# The only case that you need to manually add a file to GITIGNOREFILES is -# when remove files in one of mostlyclean-local, clean-local, distclean-local, -# or maintainer-clean-local make targets. -# -# Note that for files like editor backup, etc, there are better places to -# ignore them. See "man gitignore". -# -# If "make maintainer-clean" removes the files but they are not recognized -# by this script (that is, if "git status" shows untracked files still), send -# me the output of "git status" as well as your Makefile.am and Makefile for -# the directories involved and I'll diagnose. -# -# For a list of toplevel files that should be in MAINTAINERCLEANFILES, see -# Makefile.am.sample in the git.mk git repo. -# -# Don't EXTRA_DIST this file. It is supposed to only live in git clones, -# not tarballs. It serves no useful purpose in tarballs and clutters the -# build dir. -# -# This file knows how to handle autoconf, automake, libtool, gtk-doc, -# gnome-doc-utils, yelp.m4, mallard, intltool, gsettings, dejagnu. -# -# This makefile provides the following targets: -# -# - all: "make all" will build all gitignore files. -# - gitignore: makes all gitignore files in the current dir and subdirs. -# - .gitignore: make gitignore file for the current dir. -# - gitignore-recurse: makes all gitignore files in the subdirs. -# -# KNOWN ISSUES: -# -# - Recursive configure doesn't work as $(top_srcdir)/git.mk inside the -# submodule doesn't find us. If you have configure.{in,ac} files in -# subdirs, add a proxy git.mk file in those dirs that simply does: -# "include $(top_srcdir)/../git.mk". Add more ..'s to your taste. -# And add those files to git. See vte/gnome-pty-helper/git.mk for -# example. -# - - - -############################################################################### -# Variables user modules may want to add to toplevel MAINTAINERCLEANFILES: -############################################################################### - -# -# Most autotools-using modules should be fine including this variable in their -# toplevel MAINTAINERCLEANFILES: -GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL = \ - $(srcdir)/aclocal.m4 \ - $(srcdir)/autoscan.log \ - $(srcdir)/configure.scan \ - `AUX_DIR=$(srcdir)/$$(cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_AUX_DIR:$$1' ./configure.ac); \ - test "x$$AUX_DIR" = "x$(srcdir)/" && AUX_DIR=$(srcdir); \ - for x in \ - ar-lib \ - compile \ - config.guess \ - config.sub \ - depcomp \ - install-sh \ - ltmain.sh \ - missing \ - mkinstalldirs \ - test-driver \ - ; do echo "$$AUX_DIR/$$x"; done` \ - `cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_HEADERS:$$1' ./configure.ac | \ - head -n 1 | while read f; do echo "$(srcdir)/$$f.in"; done` -# -# All modules should also be fine including the following variable, which -# removes automake-generated Makefile.in files: -GITIGNORE_MAINTAINERCLEANFILES_MAKEFILE_IN = \ - `cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_FILES:$$1' ./configure.ac | \ - while read f; do \ - case $$f in Makefile|*/Makefile) \ - test -f "$(srcdir)/$$f.am" && echo "$(srcdir)/$$f.in";; esac; \ - done` -# -# Modules that use libtool and use AC_CONFIG_MACRO_DIR() may also include this, -# though it's harmless to include regardless. -GITIGNORE_MAINTAINERCLEANFILES_M4_LIBTOOL = \ - `MACRO_DIR=$(srcdir)/$$(cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_MACRO_DIR:$$1' ./configure.ac); \ - if test "x$$MACRO_DIR" != "x$(srcdir)/"; then \ - for x in \ - libtool.m4 \ - ltoptions.m4 \ - ltsugar.m4 \ - ltversion.m4 \ - lt~obsolete.m4 \ - ; do echo "$$MACRO_DIR/$$x"; done; \ - fi` - - - -############################################################################### -# Default rule is to install ourselves in all Makefile.am files: -############################################################################### - -git-all: git-mk-install - -git-mk-install: - @echo "Installing git makefile" - @any_failed=; \ - find "`test -z "$(top_srcdir)" && echo . || echo "$(top_srcdir)"`" -name Makefile.am | while read x; do \ - if grep 'include .*/git.mk' $$x >/dev/null; then \ - echo "$$x already includes git.mk"; \ - else \ - failed=; \ - echo "Updating $$x"; \ - { cat $$x; \ - echo ''; \ - echo '-include $$(top_srcdir)/git.mk'; \ - } > $$x.tmp || failed=1; \ - if test x$$failed = x; then \ - mv $$x.tmp $$x || failed=1; \ - fi; \ - if test x$$failed = x; then : else \ - echo "Failed updating $$x"; >&2 \ - any_failed=1; \ - fi; \ - fi; done; test -z "$$any_failed" - -.PHONY: git-all git-mk-install - - - -############################################################################### -# Actual .gitignore generation: -############################################################################### - -$(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk - @echo "git.mk: Generating $@" - @{ \ - if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \ - for x in \ - $(DOC_MODULE)-decl-list.txt \ - $(DOC_MODULE)-decl.txt \ - tmpl/$(DOC_MODULE)-unused.sgml \ - "tmpl/*.bak" \ - xml html \ - ; do echo "/$$x"; done; \ - FLAVOR=$$(cd $(top_srcdir); $(AUTOCONF) --trace 'GTK_DOC_CHECK:$$2' ./configure.ac); \ - case $$FLAVOR in *no-tmpl*) echo /tmpl;; esac; \ - fi; \ - if test "x$(DOC_MODULE)$(DOC_ID)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \ - for lc in $(DOC_LINGUAS); do \ - for x in \ - $(if $(DOC_MODULE),$(DOC_MODULE).xml) \ - $(DOC_PAGES) \ - $(DOC_INCLUDES) \ - ; do echo "/$$lc/$$x"; done; \ - done; \ - for x in \ - $(_DOC_OMF_ALL) \ - $(_DOC_DSK_ALL) \ - $(_DOC_HTML_ALL) \ - $(_DOC_MOFILES) \ - $(DOC_H_FILE) \ - "*/.xml2po.mo" \ - "*/*.omf.out" \ - ; do echo /$$x; done; \ - fi; \ - if test "x$(HELP_ID)" = x -o "x$(HELP_LINGUAS)" = x; then :; else \ - for lc in $(HELP_LINGUAS); do \ - for x in \ - $(HELP_FILES) \ - "$$lc.stamp" \ - "$$lc.mo" \ - ; do echo "/$$lc/$$x"; done; \ - done; \ - fi; \ - if test "x$(gsettings_SCHEMAS)" = x; then :; else \ - for x in \ - $(gsettings_SCHEMAS:.xml=.valid) \ - $(gsettings__enum_file) \ - ; do echo "/$$x"; done; \ - fi; \ - if test -f $(srcdir)/po/Makefile.in.in; then \ - for x in \ - po/Makefile.in.in \ - po/Makefile.in.in~ \ - po/Makefile.in \ - po/Makefile \ - po/Makevars.template \ - po/POTFILES \ - po/Rules-quot \ - po/stamp-it \ - po/.intltool-merge-cache \ - "po/*.gmo" \ - "po/*.header" \ - "po/*.mo" \ - "po/*.sed" \ - "po/*.sin" \ - po/$(GETTEXT_PACKAGE).pot \ - intltool-extract.in \ - intltool-merge.in \ - intltool-update.in \ - ; do echo "/$$x"; done; \ - fi; \ - if test -f $(srcdir)/configure; then \ - for x in \ - autom4te.cache \ - configure \ - config.h \ - stamp-h1 \ - libtool \ - config.lt \ - ; do echo "/$$x"; done; \ - fi; \ - if test "x$(DEJATOOL)" = x; then :; else \ - for x in \ - $(DEJATOOL) \ - ; do echo "/$$x.sum"; echo "/$$x.log"; done; \ - echo /site.exp; \ - fi; \ - if test "x$(am__dirstamp)" = x; then :; else \ - echo "$(am__dirstamp)"; \ - fi; \ - if test "x$(LTCOMPILE)" = x -a "x$(GTKDOC_RUN)" = x; then :; else \ - for x in \ - "*.lo" \ - ".libs" "_libs" \ - ; do echo "$$x"; done; \ - fi; \ - for x in \ - .gitignore \ - $(GITIGNOREFILES) \ - $(CLEANFILES) \ - $(PROGRAMS) $(check_PROGRAMS) $(EXTRA_PROGRAMS) \ - $(LIBRARIES) $(check_LIBRARIES) $(EXTRA_LIBRARIES) \ - $(LTLIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LTLIBRARIES) \ - so_locations \ - $(MOSTLYCLEANFILES) \ - $(TEST_LOGS) \ - $(TEST_LOGS:.log=.trs) \ - $(TEST_SUITE_LOG) \ - "*.$(OBJEXT)" \ - $(DISTCLEANFILES) \ - $(am__CONFIG_DISTCLEAN_FILES) \ - $(CONFIG_CLEAN_FILES) \ - TAGS ID GTAGS GRTAGS GSYMS GPATH tags \ - "*.tab.c" \ - $(MAINTAINERCLEANFILES) \ - $(BUILT_SOURCES) \ - $(DEPDIR) \ - $(patsubst %.vala,%.c,$(filter %.vala,$(SOURCES))) \ - $(filter %_vala.stamp,$(DIST_COMMON)) \ - $(filter %.vapi,$(DIST_COMMON)) \ - $(filter %$(patsubst %.vapi,%.h,$(filter %.vapi,$(DIST_COMMON))),$(DIST_COMMON)) \ - Makefile \ - Makefile.in \ - "*.orig" \ - "*.rej" \ - "*.bak" \ - "*~" \ - ".*.sw[nop]" \ - ".dirstamp" \ - ; do echo "/$$x"; done; \ - } | \ - sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \ - sed 's@/[.]/@/@g' | \ - LC_ALL=C sort | uniq > $@.tmp && \ - mv $@.tmp $@; - -all: $(srcdir)/.gitignore gitignore-recurse-maybe -gitignore: $(srcdir)/.gitignore gitignore-recurse - -gitignore-recurse-maybe: - @for subdir in $(DIST_SUBDIRS); do \ - case " $(SUBDIRS) " in \ - *" $$subdir "*) :;; \ - *) test "$$subdir" = . -o -e "$$subdir/.git" || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) gitignore || echo "Skipping $$subdir");; \ - esac; \ - done -gitignore-recurse: - @for subdir in $(DIST_SUBDIRS); do \ - test "$$subdir" = . -o -e "$$subdir/.git" || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) gitignore || echo "Skipping $$subdir"); \ - done - -maintainer-clean: gitignore-clean -gitignore-clean: - -rm -f $(srcdir)/.gitignore - -.PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe diff --git a/m4/ax_append_compile_flags.m4 b/m4/ax_append_compile_flags.m4 deleted file mode 100644 index 9c85635..0000000 --- a/m4/ax_append_compile_flags.m4 +++ /dev/null @@ -1,46 +0,0 @@ -# ============================================================================ -# https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html -# ============================================================================ -# -# SYNOPSIS -# -# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT]) -# -# DESCRIPTION -# -# For every FLAG1, FLAG2 it is checked whether the compiler works with the -# flag. If it does, the flag is added FLAGS-VARIABLE -# -# If FLAGS-VARIABLE is not specified, the current language's flags (e.g. -# CFLAGS) is used. During the check the flag is always added to the -# current language's flags. -# -# If EXTRA-FLAGS is defined, it is added to the current language's default -# flags (e.g. CFLAGS) when the check is done. The check is thus made with -# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to -# force the compiler to issue an error when a bad flag is given. -# -# INPUT gives an alternative input source to AC_COMPILE_IFELSE. -# -# NOTE: This macro depends on the AX_APPEND_FLAG and -# AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with -# AX_APPEND_LINK_FLAGS. -# -# LICENSE -# -# Copyright (c) 2011 Maarten Bosmans -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 7 - -AC_DEFUN([AX_APPEND_COMPILE_FLAGS], -[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) -AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) -for flag in $1; do - AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4]) -done -])dnl AX_APPEND_COMPILE_FLAGS diff --git a/m4/ax_append_flag.m4 b/m4/ax_append_flag.m4 deleted file mode 100644 index dd6d8b6..0000000 --- a/m4/ax_append_flag.m4 +++ /dev/null @@ -1,50 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_append_flag.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE]) -# -# DESCRIPTION -# -# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space -# added in between. -# -# If FLAGS-VARIABLE is not specified, the current language's flags (e.g. -# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains -# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly -# FLAG. -# -# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. -# -# LICENSE -# -# Copyright (c) 2008 Guido U. Draheim -# Copyright (c) 2011 Maarten Bosmans -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 8 - -AC_DEFUN([AX_APPEND_FLAG], -[dnl -AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF -AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])]) -AS_VAR_SET_IF(FLAGS,[ - AS_CASE([" AS_VAR_GET(FLAGS) "], - [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])], - [ - AS_VAR_APPEND(FLAGS,[" $1"]) - AC_RUN_LOG([: FLAGS="$FLAGS"]) - ]) - ], - [ - AS_VAR_SET(FLAGS,[$1]) - AC_RUN_LOG([: FLAGS="$FLAGS"]) - ]) -AS_VAR_POPDEF([FLAGS])dnl -])dnl AX_APPEND_FLAG diff --git a/m4/ax_append_link_flags.m4 b/m4/ax_append_link_flags.m4 deleted file mode 100644 index 99b9fa5..0000000 --- a/m4/ax_append_link_flags.m4 +++ /dev/null @@ -1,44 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT]) -# -# DESCRIPTION -# -# For every FLAG1, FLAG2 it is checked whether the linker works with the -# flag. If it does, the flag is added FLAGS-VARIABLE -# -# If FLAGS-VARIABLE is not specified, the linker's flags (LDFLAGS) is -# used. During the check the flag is always added to the linker's flags. -# -# If EXTRA-FLAGS is defined, it is added to the linker's default flags -# when the check is done. The check is thus made with the flags: "LDFLAGS -# EXTRA-FLAGS FLAG". This can for example be used to force the linker to -# issue an error when a bad flag is given. -# -# INPUT gives an alternative input source to AC_COMPILE_IFELSE. -# -# NOTE: This macro depends on the AX_APPEND_FLAG and AX_CHECK_LINK_FLAG. -# Please keep this macro in sync with AX_APPEND_COMPILE_FLAGS. -# -# LICENSE -# -# Copyright (c) 2011 Maarten Bosmans -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 7 - -AC_DEFUN([AX_APPEND_LINK_FLAGS], -[AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) -AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) -for flag in $1; do - AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3], [$4]) -done -])dnl AX_APPEND_LINK_FLAGS diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4 deleted file mode 100644 index bd753b3..0000000 --- a/m4/ax_check_compile_flag.m4 +++ /dev/null @@ -1,53 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) -# -# DESCRIPTION -# -# Check whether the given FLAG works with the current language's compiler -# or gives an error. (Warnings, however, are ignored) -# -# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on -# success/failure. -# -# If EXTRA-FLAGS is defined, it is added to the current language's default -# flags (e.g. CFLAGS) when the check is done. The check is thus made with -# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to -# force the compiler to issue an error when a bad flag is given. -# -# INPUT gives an alternative input source to AC_COMPILE_IFELSE. -# -# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this -# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. -# -# LICENSE -# -# Copyright (c) 2008 Guido U. Draheim -# Copyright (c) 2011 Maarten Bosmans -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 6 - -AC_DEFUN([AX_CHECK_COMPILE_FLAG], -[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF -AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl -AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ - ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS - _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" - AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], - [AS_VAR_SET(CACHEVAR,[yes])], - [AS_VAR_SET(CACHEVAR,[no])]) - _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) -AS_VAR_IF(CACHEVAR,yes, - [m4_default([$2], :)], - [m4_default([$3], :)]) -AS_VAR_POPDEF([CACHEVAR])dnl -])dnl AX_CHECK_COMPILE_FLAGS diff --git a/m4/ax_check_enable_debug.m4 b/m4/ax_check_enable_debug.m4 deleted file mode 100644 index 7bc7710..0000000 --- a/m4/ax_check_enable_debug.m4 +++ /dev/null @@ -1,124 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_check_enable_debug.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_ENABLE_DEBUG([enable by default=yes/info/profile/no], [ENABLE DEBUG VARIABLES ...], [DISABLE DEBUG VARIABLES NDEBUG ...], [IS-RELEASE]) -# -# DESCRIPTION -# -# Check for the presence of an --enable-debug option to configure, with -# the specified default value used when the option is not present. Return -# the value in the variable $ax_enable_debug. -# -# Specifying 'yes' adds '-g -O0' to the compilation flags for all -# languages. Specifying 'info' adds '-g' to the compilation flags. -# Specifying 'profile' adds '-g -pg' to the compilation flags and '-pg' to -# the linking flags. Otherwise, nothing is added. -# -# Define the variables listed in the second argument if debug is enabled, -# defaulting to no variables. Defines the variables listed in the third -# argument if debug is disabled, defaulting to NDEBUG. All lists of -# variables should be space-separated. -# -# If debug is not enabled, ensure AC_PROG_* will not add debugging flags. -# Should be invoked prior to any AC_PROG_* compiler checks. -# -# IS-RELEASE can be used to change the default to 'no' when making a -# release. Set IS-RELEASE to 'yes' or 'no' as appropriate. By default, it -# uses the value of $ax_is_release, so if you are using the AX_IS_RELEASE -# macro, there is no need to pass this parameter. -# -# AX_IS_RELEASE([git-directory]) -# AX_CHECK_ENABLE_DEBUG() -# -# LICENSE -# -# Copyright (c) 2011 Rhys Ulerich -# Copyright (c) 2014, 2015 Philip Withnall -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. - -#serial 9 - -AC_DEFUN([AX_CHECK_ENABLE_DEBUG],[ - AC_BEFORE([$0],[AC_PROG_CC])dnl - AC_BEFORE([$0],[AC_PROG_CXX])dnl - AC_BEFORE([$0],[AC_PROG_F77])dnl - AC_BEFORE([$0],[AC_PROG_FC])dnl - - AC_MSG_CHECKING(whether to enable debugging) - - ax_enable_debug_default=m4_tolower(m4_normalize(ifelse([$1],,[no],[$1]))) - ax_enable_debug_is_release=m4_tolower(m4_normalize(ifelse([$4],, - [$ax_is_release], - [$4]))) - - # If this is a release, override the default. - AS_IF([test "$ax_enable_debug_is_release" = "yes"], - [ax_enable_debug_default="no"]) - - m4_define(ax_enable_debug_vars,[m4_normalize(ifelse([$2],,,[$2]))]) - m4_define(ax_disable_debug_vars,[m4_normalize(ifelse([$3],,[NDEBUG],[$3]))]) - - AC_ARG_ENABLE(debug, - [AS_HELP_STRING([--enable-debug=]@<:@yes/info/profile/no@:>@,[compile with debugging])], - [],enable_debug=$ax_enable_debug_default) - - # empty mean debug yes - AS_IF([test "x$enable_debug" = "x"], - [enable_debug="yes"]) - - # case of debug - AS_CASE([$enable_debug], - [yes],[ - AC_MSG_RESULT(yes) - CFLAGS="${CFLAGS} -g -O0" - CXXFLAGS="${CXXFLAGS} -g -O0" - FFLAGS="${FFLAGS} -g -O0" - FCFLAGS="${FCFLAGS} -g -O0" - OBJCFLAGS="${OBJCFLAGS} -g -O0" - ], - [info],[ - AC_MSG_RESULT(info) - CFLAGS="${CFLAGS} -g" - CXXFLAGS="${CXXFLAGS} -g" - FFLAGS="${FFLAGS} -g" - FCFLAGS="${FCFLAGS} -g" - OBJCFLAGS="${OBJCFLAGS} -g" - ], - [profile],[ - AC_MSG_RESULT(profile) - CFLAGS="${CFLAGS} -g -pg" - CXXFLAGS="${CXXFLAGS} -g -pg" - FFLAGS="${FFLAGS} -g -pg" - FCFLAGS="${FCFLAGS} -g -pg" - OBJCFLAGS="${OBJCFLAGS} -g -pg" - LDFLAGS="${LDFLAGS} -pg" - ], - [ - AC_MSG_RESULT(no) - dnl Ensure AC_PROG_CC/CXX/F77/FC/OBJC will not enable debug flags - dnl by setting any unset environment flag variables - AS_IF([test "x${CFLAGS+set}" != "xset"], - [CFLAGS=""]) - AS_IF([test "x${CXXFLAGS+set}" != "xset"], - [CXXFLAGS=""]) - AS_IF([test "x${FFLAGS+set}" != "xset"], - [FFLAGS=""]) - AS_IF([test "x${FCFLAGS+set}" != "xset"], - [FCFLAGS=""]) - AS_IF([test "x${OBJCFLAGS+set}" != "xset"], - [OBJCFLAGS=""]) - ]) - - dnl Define various variables if debugging is disabled. - dnl assert.h is a NOP if NDEBUG is defined, so define it by default. - AS_IF([test "x$enable_debug" = "xyes"], - [m4_map_args_w(ax_enable_debug_vars, [AC_DEFINE(], [,[1],[Define if debugging is enabled])])], - [m4_map_args_w(ax_disable_debug_vars, [AC_DEFINE(], [,[1],[Define if debugging is disabled])])]) - ax_enable_debug=$enable_debug -]) diff --git a/m4/ax_check_link_flag.m4 b/m4/ax_check_link_flag.m4 deleted file mode 100644 index 03a30ce..0000000 --- a/m4/ax_check_link_flag.m4 +++ /dev/null @@ -1,53 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) -# -# DESCRIPTION -# -# Check whether the given FLAG works with the linker or gives an error. -# (Warnings, however, are ignored) -# -# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on -# success/failure. -# -# If EXTRA-FLAGS is defined, it is added to the linker's default flags -# when the check is done. The check is thus made with the flags: "LDFLAGS -# EXTRA-FLAGS FLAG". This can for example be used to force the linker to -# issue an error when a bad flag is given. -# -# INPUT gives an alternative input source to AC_LINK_IFELSE. -# -# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this -# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. -# -# LICENSE -# -# Copyright (c) 2008 Guido U. Draheim -# Copyright (c) 2011 Maarten Bosmans -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 6 - -AC_DEFUN([AX_CHECK_LINK_FLAG], -[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF -AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl -AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ - ax_check_save_flags=$LDFLAGS - LDFLAGS="$LDFLAGS $4 $1" - AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], - [AS_VAR_SET(CACHEVAR,[yes])], - [AS_VAR_SET(CACHEVAR,[no])]) - LDFLAGS=$ax_check_save_flags]) -AS_VAR_IF(CACHEVAR,yes, - [m4_default([$2], :)], - [m4_default([$3], :)]) -AS_VAR_POPDEF([CACHEVAR])dnl -])dnl AX_CHECK_LINK_FLAGS diff --git a/m4/ax_compiler_flags_cxxflags.m4 b/m4/ax_compiler_flags_cxxflags.m4 deleted file mode 100644 index 3067d9b..0000000 --- a/m4/ax_compiler_flags_cxxflags.m4 +++ /dev/null @@ -1,136 +0,0 @@ -# =============================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_compiler_flags_cxxflags.html -# =============================================================================== -# -# SYNOPSIS -# -# AX_COMPILER_FLAGS_CXXFLAGS([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS]) -# -# DESCRIPTION -# -# Add warning flags for the C++ compiler to VARIABLE, which defaults to -# WARN_CXXFLAGS. VARIABLE is AC_SUBST-ed by this macro, but must be -# manually added to the CXXFLAGS variable for each target in the code -# base. -# -# This macro depends on the environment set up by AX_COMPILER_FLAGS. -# Specifically, it uses the value of $ax_enable_compile_warnings to decide -# which flags to enable. -# -# LICENSE -# -# Copyright (c) 2015 David King -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 10 - -AC_DEFUN([AX_COMPILER_FLAGS_CXXFLAGS],[ - AC_REQUIRE([AC_PROG_SED]) - AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS]) - AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) - AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) - - # Variable names - m4_define([ax_warn_cxxflags_variable], - [m4_normalize(ifelse([$1],,[WARN_CXXFLAGS],[$1]))]) - - AC_LANG_PUSH([C++]) - - # Always pass -Werror=unknown-warning-option to get Clang to fail on bad - # flags, otherwise they are always appended to the warn_cxxflags variable, - # and Clang warns on them for every compilation unit. - # If this is passed to GCC, it will explode, so the flag must be enabled - # conditionally. - AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],[ - ax_compiler_flags_test="-Werror=unknown-warning-option" - ],[ - ax_compiler_flags_test="" - ]) - - # Check that -Wno-suggest-attribute=format is supported - AX_CHECK_COMPILE_FLAG([-Wno-suggest-attribute=format],[ - ax_compiler_no_suggest_attribute_flags="-Wno-suggest-attribute=format" - ],[ - ax_compiler_no_suggest_attribute_flags="" - ]) - - # Base flags - AX_APPEND_COMPILE_FLAGS([ dnl - -fno-strict-aliasing dnl - $3 dnl - ],ax_warn_cxxflags_variable,[$ax_compiler_flags_test]) - - AS_IF([test "$ax_enable_compile_warnings" != "no"],[ - # "yes" flags - AX_APPEND_COMPILE_FLAGS([ dnl - -Wall dnl - -Wextra dnl - -Wundef dnl - -Wwrite-strings dnl - -Wpointer-arith dnl - -Wmissing-declarations dnl - -Wredundant-decls dnl - -Wno-unused-parameter dnl - -Wno-missing-field-initializers dnl - -Wformat=2 dnl - -Wcast-align dnl - -Wformat-nonliteral dnl - -Wformat-security dnl - -Wsign-compare dnl - -Wstrict-aliasing dnl - -Wshadow dnl - -Winline dnl - -Wpacked dnl - -Wmissing-format-attribute dnl - -Wmissing-noreturn dnl - -Winit-self dnl - -Wredundant-decls dnl - -Wmissing-include-dirs dnl - -Wunused-but-set-variable dnl - -Warray-bounds dnl - -Wreturn-type dnl - -Wno-overloaded-virtual dnl - -Wswitch-enum dnl - -Wswitch-default dnl - $4 dnl - $5 dnl - $6 dnl - $7 dnl - ],ax_warn_cxxflags_variable,[$ax_compiler_flags_test]) - ]) - AS_IF([test "$ax_enable_compile_warnings" = "error"],[ - # "error" flags; -Werror has to be appended unconditionally because - # it's not possible to test for - # - # suggest-attribute=format is disabled because it gives too many false - # positives - AX_APPEND_FLAG([-Werror],ax_warn_cxxflags_variable) - - AX_APPEND_COMPILE_FLAGS([ dnl - [$ax_compiler_no_suggest_attribute_flags] dnl - ],ax_warn_cxxflags_variable,[$ax_compiler_flags_test]) - ]) - - # In the flags below, when disabling specific flags, always add *both* - # -Wno-foo and -Wno-error=foo. This fixes the situation where (for example) - # we enable -Werror, disable a flag, and a build bot passes CXXFLAGS=-Wall, - # which effectively turns that flag back on again as an error. - for flag in $ax_warn_cxxflags_variable; do - AS_CASE([$flag], - [-Wno-*=*],[], - [-Wno-*],[ - AX_APPEND_COMPILE_FLAGS([-Wno-error=$(AS_ECHO([$flag]) | $SED 's/^-Wno-//')], - ax_warn_cxxflags_variable, - [$ax_compiler_flags_test]) - ]) - done - - AC_LANG_POP([C++]) - - # Substitute the variables - AC_SUBST(ax_warn_cxxflags_variable) -])dnl AX_COMPILER_FLAGS_CXXFLAGS diff --git a/m4/ax_compiler_flags_gir.m4 b/m4/ax_compiler_flags_gir.m4 deleted file mode 100644 index 5b4924a..0000000 --- a/m4/ax_compiler_flags_gir.m4 +++ /dev/null @@ -1,60 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_compiler_flags_gir.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_COMPILER_FLAGS_GIR([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS]) -# -# DESCRIPTION -# -# Add warning flags for the g-ir-scanner (from GObject Introspection) to -# VARIABLE, which defaults to WARN_SCANNERFLAGS. VARIABLE is AC_SUBST-ed -# by this macro, but must be manually added to the SCANNERFLAGS variable -# for each GIR target in the code base. -# -# This macro depends on the environment set up by AX_COMPILER_FLAGS. -# Specifically, it uses the value of $ax_enable_compile_warnings to decide -# which flags to enable. -# -# LICENSE -# -# Copyright (c) 2015 Philip Withnall -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 6 - -AC_DEFUN([AX_COMPILER_FLAGS_GIR],[ - AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) - - # Variable names - m4_define([ax_warn_scannerflags_variable], - [m4_normalize(ifelse([$1],,[WARN_SCANNERFLAGS],[$1]))]) - - # Base flags - AX_APPEND_FLAG([$3],ax_warn_scannerflags_variable) - - AS_IF([test "$ax_enable_compile_warnings" != "no"],[ - # "yes" flags - AX_APPEND_FLAG([ dnl - --warn-all dnl - $4 dnl - $5 dnl - $6 dnl - $7 dnl - ],ax_warn_scannerflags_variable) - ]) - AS_IF([test "$ax_enable_compile_warnings" = "error"],[ - # "error" flags - AX_APPEND_FLAG([ dnl - --warn-error dnl - ],ax_warn_scannerflags_variable) - ]) - - # Substitute the variables - AC_SUBST(ax_warn_scannerflags_variable) -])dnl AX_COMPILER_FLAGS diff --git a/m4/ax_compiler_flags_ldflags.m4 b/m4/ax_compiler_flags_ldflags.m4 deleted file mode 100644 index 976d119..0000000 --- a/m4/ax_compiler_flags_ldflags.m4 +++ /dev/null @@ -1,111 +0,0 @@ -# ============================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_compiler_flags_ldflags.html -# ============================================================================== -# -# SYNOPSIS -# -# AX_COMPILER_FLAGS_LDFLAGS([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS]) -# -# DESCRIPTION -# -# Add warning flags for the linker to VARIABLE, which defaults to -# WARN_LDFLAGS. VARIABLE is AC_SUBST-ed by this macro, but must be -# manually added to the LDFLAGS variable for each target in the code base. -# -# This macro depends on the environment set up by AX_COMPILER_FLAGS. -# Specifically, it uses the value of $ax_enable_compile_warnings to decide -# which flags to enable. -# -# LICENSE -# -# Copyright (c) 2014, 2015 Philip Withnall -# Copyright (c) 2017, 2018 Reini Urban -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 9 - -AC_DEFUN([AX_COMPILER_FLAGS_LDFLAGS],[ - AX_REQUIRE_DEFINED([AX_APPEND_LINK_FLAGS]) - AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) - AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) - AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) - - # Variable names - m4_define([ax_warn_ldflags_variable], - [m4_normalize(ifelse([$1],,[WARN_LDFLAGS],[$1]))]) - - # Always pass -Werror=unknown-warning-option to get Clang to fail on bad - # flags, otherwise they are always appended to the warn_ldflags variable, - # and Clang warns on them for every compilation unit. - # If this is passed to GCC, it will explode, so the flag must be enabled - # conditionally. - AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],[ - ax_compiler_flags_test="-Werror=unknown-warning-option" - ],[ - ax_compiler_flags_test="" - ]) - - AX_CHECK_LINK_FLAG([-Wl,--as-needed], [ - AX_APPEND_LINK_FLAGS([-Wl,--as-needed], - [AM_LDFLAGS],[$ax_compiler_flags_test]) - ]) - AX_CHECK_LINK_FLAG([-Wl,-z,relro], [ - AX_APPEND_LINK_FLAGS([-Wl,-z,relro], - [AM_LDFLAGS],[$ax_compiler_flags_test]) - ]) - AX_CHECK_LINK_FLAG([-Wl,-z,now], [ - AX_APPEND_LINK_FLAGS([-Wl,-z,now], - [AM_LDFLAGS],[$ax_compiler_flags_test]) - ]) - AX_CHECK_LINK_FLAG([-Wl,-z,noexecstack], [ - AX_APPEND_LINK_FLAGS([-Wl,-z,noexecstack], - [AM_LDFLAGS],[$ax_compiler_flags_test]) - ]) - # textonly, retpolineplt not yet - - # macOS and cygwin linker do not have --as-needed - AX_CHECK_LINK_FLAG([-Wl,--no-as-needed], [ - ax_compiler_flags_as_needed_option="-Wl,--no-as-needed" - ], [ - ax_compiler_flags_as_needed_option="" - ]) - - # macOS linker speaks with a different accent - ax_compiler_flags_fatal_warnings_option="" - AX_CHECK_LINK_FLAG([-Wl,--fatal-warnings], [ - ax_compiler_flags_fatal_warnings_option="-Wl,--fatal-warnings" - ]) - AX_CHECK_LINK_FLAG([-Wl,-fatal_warnings], [ - ax_compiler_flags_fatal_warnings_option="-Wl,-fatal_warnings" - ]) - - # Base flags - AX_APPEND_LINK_FLAGS([ dnl - $ax_compiler_flags_as_needed_option dnl - $3 dnl - ],ax_warn_ldflags_variable,[$ax_compiler_flags_test]) - - AS_IF([test "$ax_enable_compile_warnings" != "no"],[ - # "yes" flags - AX_APPEND_LINK_FLAGS([$4 $5 $6 $7], - ax_warn_ldflags_variable, - [$ax_compiler_flags_test]) - ]) - AS_IF([test "$ax_enable_compile_warnings" = "error"],[ - # "error" flags; -Werror has to be appended unconditionally because - # it's not possible to test for - # - # suggest-attribute=format is disabled because it gives too many false - # positives - AX_APPEND_LINK_FLAGS([ dnl - $ax_compiler_flags_fatal_warnings_option dnl - ],ax_warn_ldflags_variable,[$ax_compiler_flags_test]) - ]) - - # Substitute the variables - AC_SUBST(ax_warn_ldflags_variable) -])dnl AX_COMPILER_FLAGS diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4 deleted file mode 100644 index 9e9eaed..0000000 --- a/m4/ax_cxx_compile_stdcxx.m4 +++ /dev/null @@ -1,948 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) -# -# DESCRIPTION -# -# Check for baseline language coverage in the compiler for the specified -# version of the C++ standard. If necessary, add switches to CXX and -# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) -# or '14' (for the C++14 standard). -# -# The second argument, if specified, indicates whether you insist on an -# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. -# -std=c++11). If neither is specified, you get whatever works, with -# preference for an extended mode. -# -# The third argument, if specified 'mandatory' or if left unspecified, -# indicates that baseline support for the specified C++ standard is -# required and that the macro should error out if no mode with that -# support is found. If specified 'optional', then configuration proceeds -# regardless, after defining HAVE_CXX${VERSION} if and only if a -# supporting mode is found. -# -# LICENSE -# -# Copyright (c) 2008 Benjamin Kosnik -# Copyright (c) 2012 Zack Weinberg -# Copyright (c) 2013 Roy Stogner -# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov -# Copyright (c) 2015 Paul Norman -# Copyright (c) 2015 Moritz Klammler -# Copyright (c) 2016, 2018 Krzesimir Nowak -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 10 - -dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro -dnl (serial version number 13). - -AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl - m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], - [$1], [14], [ax_cxx_compile_alternatives="14 1y"], - [$1], [17], [ax_cxx_compile_alternatives="17 1z"], - [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$2], [], [], - [$2], [ext], [], - [$2], [noext], [], - [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], - [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], - [$3], [optional], [ax_cxx_compile_cxx$1_required=false], - [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) - AC_LANG_PUSH([C++])dnl - ac_success=no - - m4_if([$2], [noext], [], [dnl - if test x$ac_success = xno; then - for alternative in ${ax_cxx_compile_alternatives}; do - switch="-std=gnu++${alternative}" - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXX="$CXX" - CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - fi]) - - m4_if([$2], [ext], [], [dnl - if test x$ac_success = xno; then - dnl HP's aCC needs +std=c++11 according to: - dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf - dnl Cray's crayCC needs "-h std=c++11" - for alternative in ${ax_cxx_compile_alternatives}; do - for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXX="$CXX" - CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - if test x$ac_success = xyes; then - break - fi - done - fi]) - AC_LANG_POP([C++]) - if test x$ax_cxx_compile_cxx$1_required = xtrue; then - if test x$ac_success = xno; then - AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) - fi - fi - if test x$ac_success = xno; then - HAVE_CXX$1=0 - AC_MSG_NOTICE([No compiler with C++$1 support was found]) - else - HAVE_CXX$1=1 - AC_DEFINE(HAVE_CXX$1,1, - [define if the compiler supports basic C++$1 syntax]) - fi - AC_SUBST(HAVE_CXX$1) -]) - - -dnl Test body for checking C++11 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 -) - - -dnl Test body for checking C++14 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 -) - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 -) - -dnl Tests for new features in C++11 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ - -// If the compiler admits that it is not ready for C++11, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201103L - -#error "This is not a C++11 compiler" - -#else - -namespace cxx11 -{ - - namespace test_static_assert - { - - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - } - - namespace test_final_override - { - - struct Base - { - virtual void f() {} - }; - - struct Derived : public Base - { - virtual void f() override {} - }; - - } - - namespace test_double_right_angle_brackets - { - - template < typename T > - struct check {}; - - typedef check single_type; - typedef check> double_type; - typedef check>> triple_type; - typedef check>>> quadruple_type; - - } - - namespace test_decltype - { - - int - f() - { - int a = 1; - decltype(a) b = 2; - return a + b; - } - - } - - namespace test_type_deduction - { - - template < typename T1, typename T2 > - struct is_same - { - static const bool value = false; - }; - - template < typename T > - struct is_same - { - static const bool value = true; - }; - - template < typename T1, typename T2 > - auto - add(T1 a1, T2 a2) -> decltype(a1 + a2) - { - return a1 + a2; - } - - int - test(const int c, volatile int v) - { - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == false, ""); - auto ac = c; - auto av = v; - auto sumi = ac + av + 'x'; - auto sumf = ac + av + 1.0; - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == true, ""); - return (sumf > 0.0) ? sumi : add(c, v); - } - - } - - namespace test_noexcept - { - - int f() { return 0; } - int g() noexcept { return 0; } - - static_assert(noexcept(f()) == false, ""); - static_assert(noexcept(g()) == true, ""); - - } - - namespace test_constexpr - { - - template < typename CharT > - unsigned long constexpr - strlen_c_r(const CharT *const s, const unsigned long acc) noexcept - { - return *s ? strlen_c_r(s + 1, acc + 1) : acc; - } - - template < typename CharT > - unsigned long constexpr - strlen_c(const CharT *const s) noexcept - { - return strlen_c_r(s, 0UL); - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("1") == 1UL, ""); - static_assert(strlen_c("example") == 7UL, ""); - static_assert(strlen_c("another\0example") == 7UL, ""); - - } - - namespace test_rvalue_references - { - - template < int N > - struct answer - { - static constexpr int value = N; - }; - - answer<1> f(int&) { return answer<1>(); } - answer<2> f(const int&) { return answer<2>(); } - answer<3> f(int&&) { return answer<3>(); } - - void - test() - { - int i = 0; - const int c = 0; - static_assert(decltype(f(i))::value == 1, ""); - static_assert(decltype(f(c))::value == 2, ""); - static_assert(decltype(f(0))::value == 3, ""); - } - - } - - namespace test_uniform_initialization - { - - struct test - { - static const int zero {}; - static const int one {1}; - }; - - static_assert(test::zero == 0, ""); - static_assert(test::one == 1, ""); - - } - - namespace test_lambdas - { - - void - test1() - { - auto lambda1 = [](){}; - auto lambda2 = lambda1; - lambda1(); - lambda2(); - } - - int - test2() - { - auto a = [](int i, int j){ return i + j; }(1, 2); - auto b = []() -> int { return '0'; }(); - auto c = [=](){ return a + b; }(); - auto d = [&](){ return c; }(); - auto e = [a, &b](int x) mutable { - const auto identity = [](int y){ return y; }; - for (auto i = 0; i < a; ++i) - a += b--; - return x + identity(a + b); - }(0); - return a + b + c + d + e; - } - - int - test3() - { - const auto nullary = [](){ return 0; }; - const auto unary = [](int x){ return x; }; - using nullary_t = decltype(nullary); - using unary_t = decltype(unary); - const auto higher1st = [](nullary_t f){ return f(); }; - const auto higher2nd = [unary](nullary_t f1){ - return [unary, f1](unary_t f2){ return f2(unary(f1())); }; - }; - return higher1st(nullary) + higher2nd(nullary)(unary); - } - - } - - namespace test_variadic_templates - { - - template - struct sum; - - template - struct sum - { - static constexpr auto value = N0 + sum::value; - }; - - template <> - struct sum<> - { - static constexpr auto value = 0; - }; - - static_assert(sum<>::value == 0, ""); - static_assert(sum<1>::value == 1, ""); - static_assert(sum<23>::value == 23, ""); - static_assert(sum<1, 2>::value == 3, ""); - static_assert(sum<5, 5, 11>::value == 21, ""); - static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); - - } - - // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae - // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function - // because of this. - namespace test_template_alias_sfinae - { - - struct foo {}; - - template - using member = typename T::member_type; - - template - void func(...) {} - - template - void func(member*) {} - - void test(); - - void test() { func(0); } - - } - -} // namespace cxx11 - -#endif // __cplusplus >= 201103L - -]]) - - -dnl Tests for new features in C++14 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ - -// If the compiler admits that it is not ready for C++14, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201402L - -#error "This is not a C++14 compiler" - -#else - -namespace cxx14 -{ - - namespace test_polymorphic_lambdas - { - - int - test() - { - const auto lambda = [](auto&&... args){ - const auto istiny = [](auto x){ - return (sizeof(x) == 1UL) ? 1 : 0; - }; - const int aretiny[] = { istiny(args)... }; - return aretiny[0]; - }; - return lambda(1, 1L, 1.0f, '1'); - } - - } - - namespace test_binary_literals - { - - constexpr auto ivii = 0b0000000000101010; - static_assert(ivii == 42, "wrong value"); - - } - - namespace test_generalized_constexpr - { - - template < typename CharT > - constexpr unsigned long - strlen_c(const CharT *const s) noexcept - { - auto length = 0UL; - for (auto p = s; *p; ++p) - ++length; - return length; - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("x") == 1UL, ""); - static_assert(strlen_c("test") == 4UL, ""); - static_assert(strlen_c("another\0test") == 7UL, ""); - - } - - namespace test_lambda_init_capture - { - - int - test() - { - auto x = 0; - const auto lambda1 = [a = x](int b){ return a + b; }; - const auto lambda2 = [a = lambda1(x)](){ return a; }; - return lambda2(); - } - - } - - namespace test_digit_separators - { - - constexpr auto ten_million = 100'000'000; - static_assert(ten_million == 100000000, ""); - - } - - namespace test_return_type_deduction - { - - auto f(int& x) { return x; } - decltype(auto) g(int& x) { return x; } - - template < typename T1, typename T2 > - struct is_same - { - static constexpr auto value = false; - }; - - template < typename T > - struct is_same - { - static constexpr auto value = true; - }; - - int - test() - { - auto x = 0; - static_assert(is_same::value, ""); - static_assert(is_same::value, ""); - return x; - } - - } - -} // namespace cxx14 - -#endif // __cplusplus >= 201402L - -]]) - - -dnl Tests for new features in C++17 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ - -// If the compiler admits that it is not ready for C++17, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201703L - -#error "This is not a C++17 compiler" - -#else - -#include -#include -#include - -namespace cxx17 -{ - - namespace test_constexpr_lambdas - { - - constexpr int foo = [](){return 42;}(); - - } - - namespace test::nested_namespace::definitions - { - - } - - namespace test_fold_expression - { - - template - int multiply(Args... args) - { - return (args * ... * 1); - } - - template - bool all(Args... args) - { - return (args && ...); - } - - } - - namespace test_extended_static_assert - { - - static_assert (true); - - } - - namespace test_auto_brace_init_list - { - - auto foo = {5}; - auto bar {5}; - - static_assert(std::is_same, decltype(foo)>::value); - static_assert(std::is_same::value); - } - - namespace test_typename_in_template_template_parameter - { - - template typename X> struct D; - - } - - namespace test_fallthrough_nodiscard_maybe_unused_attributes - { - - int f1() - { - return 42; - } - - [[nodiscard]] int f2() - { - [[maybe_unused]] auto unused = f1(); - - switch (f1()) - { - case 17: - f1(); - [[fallthrough]]; - case 42: - f1(); - } - return f1(); - } - - } - - namespace test_extended_aggregate_initialization - { - - struct base1 - { - int b1, b2 = 42; - }; - - struct base2 - { - base2() { - b3 = 42; - } - int b3; - }; - - struct derived : base1, base2 - { - int d; - }; - - derived d1 {{1, 2}, {}, 4}; // full initialization - derived d2 {{}, {}, 4}; // value-initialized bases - - } - - namespace test_general_range_based_for_loop - { - - struct iter - { - int i; - - int& operator* () - { - return i; - } - - const int& operator* () const - { - return i; - } - - iter& operator++() - { - ++i; - return *this; - } - }; - - struct sentinel - { - int i; - }; - - bool operator== (const iter& i, const sentinel& s) - { - return i.i == s.i; - } - - bool operator!= (const iter& i, const sentinel& s) - { - return !(i == s); - } - - struct range - { - iter begin() const - { - return {0}; - } - - sentinel end() const - { - return {5}; - } - }; - - void f() - { - range r {}; - - for (auto i : r) - { - [[maybe_unused]] auto v = i; - } - } - - } - - namespace test_lambda_capture_asterisk_this_by_value - { - - struct t - { - int i; - int foo() - { - return [*this]() - { - return i; - }(); - } - }; - - } - - namespace test_enum_class_construction - { - - enum class byte : unsigned char - {}; - - byte foo {42}; - - } - - namespace test_constexpr_if - { - - template - int f () - { - if constexpr(cond) - { - return 13; - } - else - { - return 42; - } - } - - } - - namespace test_selection_statement_with_initializer - { - - int f() - { - return 13; - } - - int f2() - { - if (auto i = f(); i > 0) - { - return 3; - } - - switch (auto i = f(); i + 4) - { - case 17: - return 2; - - default: - return 1; - } - } - - } - - namespace test_template_argument_deduction_for_class_templates - { - - template - struct pair - { - pair (T1 p1, T2 p2) - : m1 {p1}, - m2 {p2} - {} - - T1 m1; - T2 m2; - }; - - void f() - { - [[maybe_unused]] auto p = pair{13, 42u}; - } - - } - - namespace test_non_type_auto_template_parameters - { - - template - struct B - {}; - - B<5> b1; - B<'a'> b2; - - } - - namespace test_structured_bindings - { - - int arr[2] = { 1, 2 }; - std::pair pr = { 1, 2 }; - - auto f1() -> int(&)[2] - { - return arr; - } - - auto f2() -> std::pair& - { - return pr; - } - - struct S - { - int x1 : 2; - volatile double y1; - }; - - S f3() - { - return {}; - } - - auto [ x1, y1 ] = f1(); - auto& [ xr1, yr1 ] = f1(); - auto [ x2, y2 ] = f2(); - auto& [ xr2, yr2 ] = f2(); - const auto [ x3, y3 ] = f3(); - - } - - namespace test_exception_spec_type_system - { - - struct Good {}; - struct Bad {}; - - void g1() noexcept; - void g2(); - - template - Bad - f(T*, T*); - - template - Good - f(T1*, T2*); - - static_assert (std::is_same_v); - - } - - namespace test_inline_variables - { - - template void f(T) - {} - - template inline T g(T) - { - return T{}; - } - - template<> inline void f<>(int) - {} - - template<> int g<>(int) - { - return 5; - } - - } - -} // namespace cxx17 - -#endif // __cplusplus < 201703L - -]]) diff --git a/m4/ax_cxx_compile_stdcxx_11.m4 b/m4/ax_cxx_compile_stdcxx_11.m4 deleted file mode 100644 index 1733fd8..0000000 --- a/m4/ax_cxx_compile_stdcxx_11.m4 +++ /dev/null @@ -1,39 +0,0 @@ -# ============================================================================= -# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html -# ============================================================================= -# -# SYNOPSIS -# -# AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional]) -# -# DESCRIPTION -# -# Check for baseline language coverage in the compiler for the C++11 -# standard; if necessary, add switches to CXX and CXXCPP to enable -# support. -# -# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX -# macro with the version set to C++11. The two optional arguments are -# forwarded literally as the second and third argument respectively. -# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for -# more information. If you want to use this macro, you also need to -# download the ax_cxx_compile_stdcxx.m4 file. -# -# LICENSE -# -# Copyright (c) 2008 Benjamin Kosnik -# Copyright (c) 2012 Zack Weinberg -# Copyright (c) 2013 Roy Stogner -# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov -# Copyright (c) 2015 Paul Norman -# Copyright (c) 2015 Moritz Klammler -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 18 - -AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) -AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])]) diff --git a/m4/ax_generate_changelog.m4 b/m4/ax_generate_changelog.m4 deleted file mode 100644 index e2f0c54..0000000 --- a/m4/ax_generate_changelog.m4 +++ /dev/null @@ -1,99 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_generate_changelog.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_GENERATE_CHANGELOG() -# -# DESCRIPTION -# -# Builds a rule for generating a ChangeLog file from version control -# system commit messages. Currently, the only supported VCS is git, but -# support for others could be added in future. -# -# Defines GENERATE_CHANGELOG_RULES which should be substituted in your -# Makefile. -# -# Usage example: -# -# configure.ac: -# -# AX_GENERATE_CHANGELOG -# -# Makefile.am: -# -# @GENERATE_CHANGELOG_RULES@ -# CHANGELOG_START = 0.2.3^ -# dist-hook: dist-ChangeLog -# -# ChangeLog (stub committed to VCS): -# -# The ChangeLog is auto-generated when releasing. -# If you are seeing this, use 'git log' for a detailed list of changes. -# -# This results in a "dist-ChangeLog" rule being added to the Makefile. -# When run, "dist-ChangeLog" will generate a ChangeLog in the -# $(top_distdir), using $(CHANGELOG_GIT_FLAGS) to format the output from -# "git log" being run in $(CHANGELOG_GIT_DIR). -# -# Unless Automake is initialised with the 'foreign' option, a dummy -# ChangeLog file must be committed to VCS in $(top_srcdir), containing the -# text above (for example). It will be substituted by the automatically -# generated ChangeLog during "make dist". -# -# LICENSE -# -# Copyright (c) 2015 David King -# Copyright (c) 2015 Philip Withnall -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 3 - -AC_DEFUN([AX_GENERATE_CHANGELOG],[ - # Find git, defaulting to the 'missing' script so the user gets a nice - # message if git is missing, rather than a plain 'command not found'. - AC_PATH_PROG([GIT],[git],[${am_missing_run}git]) - AC_SUBST([GIT]) - - # Build the ChangeLog rules. - m4_pattern_allow([AM_V_GEN]) -GENERATE_CHANGELOG_RULES=' -# Generate ChangeLog -# -# Optional: -# - CHANGELOG_START: git commit ID or tag name to output changelogs from -# (exclusive). (Default: include all commits) -# - CHANGELOG_GIT_FLAGS: General flags to pass to git-log when generating the -# ChangeLog. (Default: various) -# - CHANGELOG_GIT_DIR: .git directory to use. (Default: $(top_srcdir)/.git) - -# git-specific -CHANGELOG_GIT_FLAGS ?= --stat -M -C --name-status --no-color --no-decorate -CHANGELOG_GIT_DIR ?= $(top_srcdir)/.git - -ifeq ($(CHANGELOG_START),) -CHANGELOG_GIT_RANGE = -else -CHANGELOG_GIT_RANGE = $(CHANGELOG_START).. -endif - -# Generate a ChangeLog in $(top_distdir) -dist-ChangeLog: - $(AM_V_GEN)if $(GIT) \ - --git-dir=$(CHANGELOG_GIT_DIR) --work-tree=$(top_srcdir) log \ - $(CHANGELOG_GIT_FLAGS) $(CHANGELOG_GIT_RANGE) \ - | fmt --split-only >.ChangeLog.tmp; \ - then mv -f .ChangeLog.tmp "$(top_distdir)/ChangeLog"; \ - else rm -f .ChangeLog.tmp; exit 1; fi - -.PHONY: dist-ChangeLog -' - - AC_SUBST([GENERATE_CHANGELOG_RULES]) - m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([GENERATE_CHANGELOG_RULES])]) -]) diff --git a/m4/ax_is_release.m4 b/m4/ax_is_release.m4 deleted file mode 100644 index 9097ddb..0000000 --- a/m4/ax_is_release.m4 +++ /dev/null @@ -1,80 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_is_release.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_IS_RELEASE(POLICY) -# -# DESCRIPTION -# -# Determine whether the code is being configured as a release, or from -# git. Set the ax_is_release variable to 'yes' or 'no'. -# -# If building a release version, it is recommended that the configure -# script disable compiler errors and debug features, by conditionalising -# them on the ax_is_release variable. If building from git, these -# features should be enabled. -# -# The POLICY parameter specifies how ax_is_release is determined. It can -# take the following values: -# -# * git-directory: ax_is_release will be 'no' if a '.git' directory exists -# * minor-version: ax_is_release will be 'no' if the minor version number -# in $PACKAGE_VERSION is odd; this assumes -# $PACKAGE_VERSION follows the 'major.minor.micro' scheme -# * micro-version: ax_is_release will be 'no' if the micro version number -# in $PACKAGE_VERSION is odd; this assumes -# $PACKAGE_VERSION follows the 'major.minor.micro' scheme -# * dash-version: ax_is_release will be 'no' if there is a dash '-' -# in $PACKAGE_VERSION, for example 1.2-pre3, 1.2.42-a8b9 -# or 2.0-dirty (in particular this is suitable for use -# with git-version-gen) -# * always: ax_is_release will always be 'yes' -# * never: ax_is_release will always be 'no' -# -# Other policies may be added in future. -# -# LICENSE -# -# Copyright (c) 2015 Philip Withnall -# Copyright (c) 2016 Collabora Ltd. -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. - -#serial 7 - -AC_DEFUN([AX_IS_RELEASE],[ - AC_BEFORE([AC_INIT],[$0]) - - m4_case([$1], - [git-directory],[ - # $is_release = (.git directory does not exist) - AS_IF([test -d ${srcdir}/.git],[ax_is_release=no],[ax_is_release=yes]) - ], - [minor-version],[ - # $is_release = ($minor_version is even) - minor_version=`echo "$PACKAGE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'` - AS_IF([test "$(( $minor_version % 2 ))" -ne 0], - [ax_is_release=no],[ax_is_release=yes]) - ], - [micro-version],[ - # $is_release = ($micro_version is even) - micro_version=`echo "$PACKAGE_VERSION" | sed 's/[[^.]]*\.[[^.]]*\.\([[^.]]*\).*/\1/'` - AS_IF([test "$(( $micro_version % 2 ))" -ne 0], - [ax_is_release=no],[ax_is_release=yes]) - ], - [dash-version],[ - # $is_release = ($PACKAGE_VERSION has a dash) - AS_CASE([$PACKAGE_VERSION], - [*-*], [ax_is_release=no], - [*], [ax_is_release=yes]) - ], - [always],[ax_is_release=yes], - [never],[ax_is_release=no], - [ - AC_MSG_ERROR([Invalid policy. Valid policies: git-directory, minor-version, micro-version, dash-version, always, never.]) - ]) -]) diff --git a/m4/ax_require_defined.m4 b/m4/ax_require_defined.m4 deleted file mode 100644 index 17c3eab..0000000 --- a/m4/ax_require_defined.m4 +++ /dev/null @@ -1,37 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_require_defined.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_REQUIRE_DEFINED(MACRO) -# -# DESCRIPTION -# -# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have -# been defined and thus are available for use. This avoids random issues -# where a macro isn't expanded. Instead the configure script emits a -# non-fatal: -# -# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found -# -# It's like AC_REQUIRE except it doesn't expand the required macro. -# -# Here's an example: -# -# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) -# -# LICENSE -# -# Copyright (c) 2014 Mike Frysinger -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 2 - -AC_DEFUN([AX_REQUIRE_DEFINED], [dnl - m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])]) -])dnl AX_REQUIRE_DEFINED diff --git a/m4/tartan_code_coverage.m4 b/m4/tartan_code_coverage.m4 deleted file mode 100644 index 2049603..0000000 --- a/m4/tartan_code_coverage.m4 +++ /dev/null @@ -1,264 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_code_coverage.html -# =========================================================================== -# -# SYNOPSIS -# -# TARTAN_CODE_COVERAGE() -# -# DESCRIPTION -# -# Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS, -# CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LIBS which should be included -# in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LIBADD variables of every -# build target (program or library) which should be built with code -# coverage support. Also defines CODE_COVERAGE_RULES which should be -# substituted in your Makefile; and $enable_code_coverage which can be -# used in subsequent configure output. CODE_COVERAGE_ENABLED is defined -# and substituted, and corresponds to the value of the -# --enable-code-coverage option, which defaults to being disabled. -# -# Test also for gcov program and create GCOV variable that could be -# substituted. -# -# Note that all optimization flags in CFLAGS must be disabled when code -# coverage is enabled. -# -# Usage example: -# -# configure.ac: -# -# TARTAN_CODE_COVERAGE -# -# Makefile.am: -# -# @CODE_COVERAGE_RULES@ -# my_program_LIBS = ... $(CODE_COVERAGE_LIBS) ... -# my_program_CPPFLAGS = ... $(CODE_COVERAGE_CPPFLAGS) ... -# my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ... -# my_program_CXXFLAGS = ... $(CODE_COVERAGE_CXXFLAGS) ... -# -# This results in a "check-code-coverage" rule being added to any -# Makefile.am which includes "@CODE_COVERAGE_RULES@" (assuming the module -# has been configured with --enable-code-coverage). Running `make -# check-code-coverage` in that directory will run the module's test suite -# (`make check`) and build a code coverage report detailing the code which -# was touched, then print the URI for the report. -# -# In earlier versions of this macro, CODE_COVERAGE_LDFLAGS was defined -# instead of CODE_COVERAGE_LIBS. They are both still defined, but use of -# CODE_COVERAGE_LIBS is preferred for clarity; CODE_COVERAGE_LDFLAGS is -# deprecated. They have the same value. -# -# This code was derived from Makefile.decl in GLib, originally licenced -# under LGPLv2.1+. -# -# LICENSE -# -# Copyright (c) 2012, 2016 Philip Withnall -# Copyright (c) 2012 Xan Lopez -# Copyright (c) 2012 Christian Persch -# Copyright (c) 2012 Paolo Borelli -# Copyright (c) 2012 Dan Winship -# Copyright (c) 2015 Bastien ROUCARIES -# -# This library 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. -# -# This library 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 this program. If not, see . - -#serial 25 - -AC_DEFUN([TARTAN_CODE_COVERAGE],[ - dnl Check for --enable-code-coverage - AC_REQUIRE([AC_PROG_SED]) - - # allow to override gcov location - AC_ARG_WITH([gcov], - [AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])], - [_AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov], - [_AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov]) - - AC_MSG_CHECKING([whether to build with code coverage support]) - AC_ARG_ENABLE([code-coverage], - AS_HELP_STRING([--enable-code-coverage], - [Whether to enable code coverage support]),, - enable_code_coverage=no) - - AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes]) - AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage]) - AC_MSG_RESULT($enable_code_coverage) - - AS_IF([ test "$enable_code_coverage" = "yes" ], [ - # check for gcov - AC_CHECK_TOOL([GCOV], - [$_AX_CODE_COVERAGE_GCOV_PROG_WITH], - [:]) - AS_IF([test "X$GCOV" = "X:"], - [AC_MSG_ERROR([gcov is needed to do coverage])]) - AC_SUBST([GCOV]) - - dnl Check if gcc is being used - AS_IF([ test "$GCC" = "no" ], [ - AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage]) - ]) - - AC_CHECK_PROG([LCOV], [lcov], [lcov]) - AC_CHECK_PROG([GENHTML], [genhtml], [genhtml]) - - AS_IF([ test -z "$LCOV" ], [ - AC_MSG_ERROR([To enable code coverage reporting you must have lcov installed]) - ]) - - AS_IF([ test -z "$GENHTML" ], [ - AC_MSG_ERROR([Could not find genhtml from the lcov package]) - ]) - - dnl Build the code coverage flags - dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility - CODE_COVERAGE_CPPFLAGS="-DNDEBUG" - CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" - CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" - CODE_COVERAGE_LIBS="-lgcov" - CODE_COVERAGE_LDFLAGS="$CODE_COVERAGE_LIBS" - - AC_SUBST([CODE_COVERAGE_CPPFLAGS]) - AC_SUBST([CODE_COVERAGE_CFLAGS]) - AC_SUBST([CODE_COVERAGE_CXXFLAGS]) - AC_SUBST([CODE_COVERAGE_LIBS]) - AC_SUBST([CODE_COVERAGE_LDFLAGS]) - - [CODE_COVERAGE_RULES_CHECK=' - -$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check - $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture -'] - [CODE_COVERAGE_RULES_CAPTURE=' - $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS) - $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS) - -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp - $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS) - @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html" -'] - [CODE_COVERAGE_RULES_CLEAN=' -clean: code-coverage-clean -distclean: code-coverage-clean -code-coverage-clean: - -$(LCOV) --directory $(top_builddir) -z - -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY) - -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete -'] - ], [ - [CODE_COVERAGE_RULES_CHECK=' - @echo "Need to reconfigure with --enable-code-coverage" -'] - CODE_COVERAGE_RULES_CAPTURE="$CODE_COVERAGE_RULES_CHECK" - CODE_COVERAGE_RULES_CLEAN='' - ]) - -[CODE_COVERAGE_RULES=' -# Code coverage -# -# Optional: -# - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting. -# Multiple directories may be specified, separated by whitespace. -# (Default: $(top_builddir)) -# - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated -# by lcov for code coverage. (Default: -# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info) -# - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage -# reports to be created. (Default: -# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage) -# - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage, -# set to 0 to disable it and leave empty to stay with the default. -# (Default: empty) -# - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov -# instances. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE) -# - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov -# instances. (Default: $CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) -# - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov -# - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the -# collecting lcov instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) -# - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov -# instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) -# - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering -# lcov instance. (Default: empty) -# - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov -# instance. (Default: $CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) -# - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the -# genhtml instance. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE) -# - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml -# instance. (Default: $CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) -# - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore -# -# The generated report will be titled using the $(PACKAGE_NAME) and -# $(PACKAGE_VERSION). In order to add the current git hash to the title, -# use the git-version-gen script, available online. - -# Optional variables -CODE_COVERAGE_DIRECTORY ?= $(top_builddir) -CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info -CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage -CODE_COVERAGE_BRANCH_COVERAGE ?= -CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\ ---rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) -CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) -CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)" -CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) -CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) -CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?= -CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) -CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=\ -$(if $(CODE_COVERAGE_BRANCH_COVERAGE),\ ---rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) -CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) -CODE_COVERAGE_IGNORE_PATTERN ?= - -GITIGNOREFILES ?= -GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY) - -code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V)) -code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY)) -code_coverage_v_lcov_cap_0 = @echo " LCOV --capture"\ - $(CODE_COVERAGE_OUTPUT_FILE); -code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V)) -code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY)) -code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*"\ - $(CODE_COVERAGE_IGNORE_PATTERN); -code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V)) -code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY)) -code_coverage_v_genhtml_0 = @echo " GEN " $(CODE_COVERAGE_OUTPUT_DIRECTORY); -code_coverage_quiet = $(code_coverage_quiet_$(V)) -code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY)) -code_coverage_quiet_0 = --quiet - -# sanitizes the test-name: replaces with underscores: dashes and dots -code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1))) - -# Use recursive makes in order to ignore errors during check -check-code-coverage:'"$CODE_COVERAGE_RULES_CHECK"' - -# Capture code coverage data -code-coverage-capture: code-coverage-capture-hook'"$CODE_COVERAGE_RULES_CAPTURE"' - -# Hook rule executed before code-coverage-capture, overridable by the user -code-coverage-capture-hook: - -'"$CODE_COVERAGE_RULES_CLEAN"' - -A''M_DISTCHECK_CONFIGURE_FLAGS ?= -A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage - -.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean -'] - - AC_SUBST([CODE_COVERAGE_RULES]) - m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])]) -]) diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..51b44f7 --- /dev/null +++ b/meson.build @@ -0,0 +1,48 @@ +project('tartan', 'cpp', version: '0.4.0', license: 'GPL3', + meson_version: '>= 0.52', + default_options: ['cpp_std=c++11', 'warning_level=3']) + +cxx = meson.get_compiler('cpp') + +### Check for required libraries ############################################### + +llvm_requirement = '>= 7.0' +glib_requirement = '>= 2.38' +gir_requirement = '>= 1.38.0' + +glib = dependency('glib-2.0', version: glib_requirement, + fallback: ['glib', 'libglib_dep']) +gobject = dependency('gobject-2.0', version: glib_requirement, + fallback: ['glib', 'libgobject_dep']) +gio = dependency('gio-2.0', version: glib_requirement, + fallback: ['glib', 'libgio_dep']) +gi = dependency('gobject-introspection-1.0', version: gir_requirement, + fallback: ['gobject-introspection', 'girepo_dep']) + +llvm_with_link = dependency('llvm', version: llvm_requirement, + include_type: 'system') +# Don't link against the LLVM libs because they're huge. All the symbols +# will be available when the plugin is loaded anyway. +llvm = llvm_with_link.partial_dependency(compile_args: true) + +cxx.check_header('clang/AST/Expr.h', dependencies: llvm, required: true) + +### Generate config.h ########################################################## + +header_conf = configuration_data() + +header_conf.set_quoted('VERSION', meson.project_version()) +header_conf.set_quoted('LLVM_CONFIG_VERSION', llvm.version()) +header_conf.set('HAVE_LLVM_8_0', llvm.version().version_compare('>= 8.0')) +header_conf.set('HAVE_LLVM_9_0', llvm.version().version_compare('>= 9.0')) +header_conf.set('GETTEXT_PACKAGE', meson.project_name()) + +configure_file(output: 'config.h', configuration: header_conf) +config_h_include = include_directories('.') + +### Build ###################################################################### + +subdir('po') +subdir('clang-plugin') +subdir('scripts') +subdir('tests') diff --git a/po/POTFILES b/po/POTFILES new file mode 100644 index 0000000..d38bbff --- /dev/null +++ b/po/POTFILES @@ -0,0 +1 @@ +clang-plugin/plugin.cpp diff --git a/po/POTFILES.in b/po/POTFILES.in deleted file mode 100644 index d38bbff..0000000 --- a/po/POTFILES.in +++ /dev/null @@ -1 +0,0 @@ -clang-plugin/plugin.cpp diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 0000000..79c6233 --- /dev/null +++ b/po/meson.build @@ -0,0 +1,2 @@ +i18n = import('i18n') +i18n.gettext(meson.project_name(), preset: 'glib') diff --git a/scripts/meson.build b/scripts/meson.build new file mode 100644 index 0000000..2f66912 --- /dev/null +++ b/scripts/meson.build @@ -0,0 +1,8 @@ +# Clang and scan-build wrapper scripts + +scripts = [ + 'tartan', + 'tartan-build', + 'tartan-json', +] +install_data(scripts, install_dir: get_option('bindir')) diff --git a/subprojects/.gitignore b/subprojects/.gitignore new file mode 100644 index 0000000..6c63c5d --- /dev/null +++ b/subprojects/.gitignore @@ -0,0 +1,2 @@ +glib +gobject-introspection diff --git a/subprojects/glib.wrap b/subprojects/glib.wrap new file mode 100644 index 0000000..e4de7ee --- /dev/null +++ b/subprojects/glib.wrap @@ -0,0 +1,4 @@ +[wrap-git] +directory=glib +url=https://gitlab.gnome.org/GNOME/glib.git +revision=origin/master diff --git a/subprojects/gobject-introspection.wrap b/subprojects/gobject-introspection.wrap new file mode 100644 index 0000000..108b80c --- /dev/null +++ b/subprojects/gobject-introspection.wrap @@ -0,0 +1,4 @@ +[wrap-git] +directory=gobject-introspection +url=https://gitlab.gnome.org/GNOME/gobject-introspection.git +revision=origin/master diff --git a/tests/driver.py b/tests/driver.py new file mode 100755 index 0000000..5b8f8df --- /dev/null +++ b/tests/driver.py @@ -0,0 +1,228 @@ +#!/usr/bin/env python3 +# coding: utf8 +# +# This file is part of Tartan. +# Copyright © 2019 Philip Chimento +# +# Tartan 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 3 of the License, or +# (at your option) any later version. +# +# Tartan 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 Tartan. If not, see . + +# Take an input file which contains a header of the form: +# /* Template: [template name] */ +# followed by a blank line, then one or more sections of the form: +# /* +# [Error message|‘No error’] +# */ +# { +# [Code] +# } +# +# Sections are separated by ‘/*’ on a line of its own. The code must not +# contain C-style comments (‘/* … */’), but can contain C++-style +# ones (‘// …’). +# +# The wrapper script takes each section and wraps the code in a main() function +# with some standard variables and reference count handling provided by the +# named template. It then compiles the code using Clang with Tartan, and checks +# the compiler output against the expected error message. If the expected error +# message is ‘No error’ it asserts there’s no error. + +import argparse +import itertools +import os +import re +import shlex +import subprocess +import sys +import tempfile + +tests_dir = sys.path[0] +tartan = os.path.join(tests_dir, '..', 'scripts', 'tartan') + +parser = argparse.ArgumentParser(description='Tartan test driver.') +parser.add_argument('infile', type=argparse.FileType('r'), metavar='FILE', + help='path to input test file') +parser.add_argument('--verbose', '-v', action='store_true', + help='print extra log messages') +parser.add_argument('--target-cc', action='store', + help='path to clang compiler that plugin targets') +args = parser.parse_args() + +# Before starting, work out the compiler’s system include paths. +# Thanks to: http://stackoverflow.com/a/17940271/2931197 +result = subprocess.run(['cpp', '-xc++', '-Wp,-v'], input='', + stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, + universal_newlines=True) +lines = result.stderr.splitlines() +system_paths = filter(lambda l: l.startswith(' '), lines) +system_paths = map(lambda l: l.replace('(framework directory)', '').strip(), + system_paths) +system_includes = [] +for path in system_paths: + system_includes += ['-isystem', path] + +output = subprocess.check_output(['pkg-config', '--cflags', 'glib-2.0'], + universal_newlines=True) +glib_includes = shlex.split(output) + + +class Test: + ids = itertools.count(0) + + def __init__(self, name, template_name): + self.name = '{} section {}'.format(name, next(Test.ids)) + self.template_name = template_name + template_head = os.path.join(tests_dir, + '{}.head.c'.format(self.template_name)) + with open(template_head, 'r') as f: + self.source = f.read() + os.linesep + self.expected_error = [] + + def add_source(self, line): + self.source += line + os.linesep + + def finish_source(self): + template_tail = os.path.join(tests_dir, + '{}.tail.c'.format(self.template_name)) + with open(template_tail, 'r') as f: + self.source += f.read() + + def add_error(self, line): + self.expected_error.append(line) + + def write(self, fp): + fp.write(self.source) + + def nonmatching_lines(self, output_lines): + return [line for line in self.expected_error + if all(map(lambda l: line not in l, output_lines))] + + +def log_tap_multiline_text(lines): + print('# ' + (os.linesep + '# ').join(lines)) + + +current_test = None +tests = [] + +# Extract the template name. +template_comment = next(args.infile) +match = re.match(r'\/\*\s*Template:(.*)\*\/', template_comment) +if not match: + template = 'generic' +else: + template = match.group(1).strip() +if args.verbose: + print('# using template {}'.format(template)) + +# Split the input file up into sections, delimiting on ‘/*’ on a line by itself +for line in args.infile: + line = line.rstrip(os.linesep) + + if line == '/*': + if current_test is not None: + current_test.finish_source() + tests.append(current_test) + current_test = Test(args.infile.name, template) + elif current_test is None: + continue + elif line.startswith(' * '): + if line != ' * No error': + current_test.add_error(line[3:]) + + if current_test is not None: + current_test.add_source(line) + +if current_test is not None: + current_test.finish_source() + tests.append(current_test) + +tartan_plugin = os.path.join(os.getcwd(), 'clang-plugin', 'libtartan.so') +input_ext = os.path.splitext(args.infile.name)[1] + +if input_ext == '.c': + lang_options = ['-std=c89'] +elif input_ext == '.cpp': + lang_options = ['-xc++'] +else: + lang_options = [] + +extra_options = [] +tartan_test_options = os.environ.get('TARTAN_TEST_OPTIONS', None) +if tartan_test_options is not None: + extra_options.append(tartan_test_options) + +test_env = { + 'TARTAN_PLUGIN': tartan_plugin, + 'TARTAN_OPTIONS': '--quiet' +} +env = dict(os.environ, **test_env) +if args.target_cc: + env['TARTAN_CC'] = args.target_cc + +print('1..{}'.format(len(tests))) +if args.verbose: + print('# reading input from {}'.format(args.infile.name)) + print('# using tartan from {}'.format(tartan)) + print('# using plugin from {}'.format(tartan_plugin)) + +for ix, test in enumerate(tests): + fd, path = tempfile.mkstemp(suffix=input_ext, text=True) + with os.fdopen(fd, 'wt') as fp: + test.write(fp) + + # Run the compiler. + # e.g. Set + # TARTAN_TEST_OPTIONS="-analyzer-checker=debug.ViewExplodedGraph" to + # debug the ExplodedGraph + command = ([tartan, '-cc1', '-analyze', '-Wno-visibility'] + lang_options + + extra_options + glib_includes + system_includes + [path]) + if args.verbose: + print('# compiling {}'.format(' '.join(command))) + result = subprocess.run(command, env=env, stdout=subprocess.DEVNULL, + stderr=subprocess.PIPE, + universal_newlines=True) + + output_lines = result.stderr.splitlines() + failed = False + + # Compare the errors. + if test.expected_error: + # Expecting an error. Check that the expected errors are a + # subset of the actual errors, to allow for spurious Clang + # warnings because generated code is hard. + nonmatching_lines = test.nonmatching_lines(output_lines) + if nonmatching_lines: + failed = True + for line in nonmatching_lines: + print('# Non-matching line: {}'.format(line)) + print('# Error: expected compiler error was not seen.') + print('# Expected:') + log_tap_multiline_text(test.expected_error) + print('# Actual:') + log_tap_multiline_text(output_lines) + else: + # Expecting no error. + if result.stderr: + failed = True + print('# Error: compiler error when none was expected.') + log_tap_multiline_text(output_lines) + + if failed: + # Leave the temporary directory alone on failure. + if args.verbose: + print('# not deleting {}'.format(path)) + else: + os.remove(path) + + print('{}ok {} {}'.format('not ' if failed else '', ix + 1, test.name)) diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 0000000..39655e2 --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,29 @@ +# Tests are implemented as a series of example C files, each of which should +# compile successfully without Tartan, and which should fail compilation +# with Tartan (and -Werror). + +tests = [ + 'assertion-extraction.c', + 'assertion-extraction-cpp.cpp', + 'assertion-extraction-return.c', + 'gerror-api.c', + 'gsignal-connect.c', + 'gvariant-builder.c', + 'gvariant-get.c', + 'gvariant-get-child.c', + 'gvariant-iter.c', + 'gvariant-lookup.c', + 'gvariant-new.c', + 'non-glib.c', + 'nonnull.c', +] + +test_driver = find_program('driver.py') +target_clang = find_program('clang') + +foreach test_name : tests + test_file = files(test_name) + test_args = [test_file, '--target-cc=@0@'.format(target_clang.path())] + test(test_name, test_driver, args: test_args, protocol: 'tap', + timeout: 1200) +endforeach diff --git a/tests/wrapper-compiler-errors b/tests/wrapper-compiler-errors deleted file mode 100755 index bc9fe3f..0000000 --- a/tests/wrapper-compiler-errors +++ /dev/null @@ -1,162 +0,0 @@ -#!/bin/sh - -# Take an input file which contains a header of the form: -# /* Template: [template name] */ -# followed by a blank line, then one or more sections of the form: -# /* -# [Error message|‘No error’] -# */ -# { -# [Code] -# } -# -# Sections are separated by ‘/*’ on a line of its own. The code must not contain -# C-style comments (‘/* … */’), but can contain C++-style ones (‘// …’). -# -# The wrapper script takes each section and wraps the code in a main() function -# with some standard variables and reference count handling provided by the -# named template. It then compiles -# the code using Clang with Tartan, and checks the compiler output against -# the expected error message. If the expected error message is ‘No error’ it -# asserts there’s no error. - -input_filename=$1 -input_ext=${input_filename##*.} -temp_dir=`mktemp -d`/${abs_top_builddir} -tests_dir=`dirname $0` -tartan=${tests_dir}/../scripts/tartan -tartan_plugin=${abs_top_builddir}/clang-plugin/.libs/libtartan.so - -echo "Reading input from ${input_filename}." -echo "Using temporary directory ${temp_dir}." -echo "Using Tartan from ${tartan}." -echo "Using plugin from ${tartan_plugin}." - -test_status=0 - -# Before starting, work out the compiler’s system include paths. -# Thanks to: http://stackoverflow.com/a/17940271/2931197 -system_includes=`echo | cpp -Wp,-v 2>&1 | grep '^[[:space:]]' | \ - sed -e 's/^[[:space:]]*/-isystem/' -e 's/ (framework directory)//' | \ - tr "\n" ' '` - -# Extract the template name. -template_name=`head -n 1 "${input_filename}" | \ - sed -n 's/\/\*[[:space:]]*Template:\(.*\)\*\//\1/p' | \ - tr -d ' '` - -echo "Using template ${template_name}." - -# Split the input file up into sections, delimiting on ‘/*’ on a line by itself. -mkdir -p ${temp_dir}/${srcdir} -tail -n +3 "${input_filename}" > "${temp_dir}/${input_filename}.tail" -csplit --keep-files --elide-empty-files --silent \ - --prefix="${temp_dir}/${input_filename}_" \ - --suffix-format="%02d${input_ext}" \ - "${temp_dir}/${input_filename}.tail" '/^\/\*/' '{*}' - -echo "" - -num=0 -while [[ -f `printf "${temp_dir}/${input_filename}_%02d${input_ext}" ${num}` ]]; do - section_filename=`printf ${temp_dir}/${input_filename}_%02d${input_ext} ${num}` - expected_error_filename=`printf ${temp_dir}/${input_filename}_%02d.expected ${num}` - actual_error_filename=`printf ${temp_dir}/${input_filename}_%02d.actual ${num}` - - echo "${section_filename}:" - echo "-------" - echo "" - echo " - Building section file ${section_filename}." - echo " - Outputting to error files ${expected_error_filename} and ${actual_error_filename}." - - # Wrap the section’s code with a prefix and suffix. - (cat "${srcdir}/${template_name}.head.c" - cat "${section_filename}" - cat "${srcdir}/${template_name}.tail.c" - ) > $section_filename.tmp - mv -f $section_filename.tmp $section_filename - - num=$((num + 1)) - - # Extract the expected comment. - sed -n '/^\/\*/n; s/^ \* \(.*\)/\1/p' < $section_filename > $expected_error_filename - - if [[ $(<"${expected_error_filename}") == "No error" ]]; then - echo " - Expecting no error" - expect_error=false - else - echo " - Expecting an error" - expect_error=true - fi - - case $input_ext in - c) lang_options=-std=c89 ;; - cpp) lang_options=-xc++ ;; - *) lang_options= - esac - - # Run the compiler. - # e.g. Set - # TARTAN_TEST_OPTIONS="-analyzer-checker=debug.ViewExplodedGraph" to - # debug the ExplodedGraph - TARTAN_PLUGIN=$tartan_plugin \ - TARTAN_OPTIONS=--quiet \ - $tartan \ - -cc1 -analyze $lang_options -Wno-visibility $TARTAN_TEST_OPTIONS \ - `pkg-config --cflags glib-2.0` \ - $system_includes \ - $section_filename > $actual_error_filename 2>&1 - - # Compare the errors. - if $expect_error; then - # Expecting an error. Check that the expected errors are a - # subset of the actual errors, to allow for spurious Clang - # warnings because generated code is hard. - grep_failed=0 - - while read line - do - # Check the string against the actual errors. - grep -F "${line}" "${actual_error_filename}" >/dev/null - grep_status=$? - - if [ $grep_status -ne 0 ]; then - echo " * Non-matching line:" 1>&2 - echo "${line}" 1>&2 - grep_failed=1 - fi - done < "${expected_error_filename}" - - if [ $grep_failed = 1 ]; then - echo " * Error: Expected compiler error was not seen." 1>&2 - - echo " - Expected:" 1>&2 - cat "${expected_error_filename}" 1>&2 - echo "" 1>&2 - echo " - Actual:" 1>&2 - cat "${actual_error_filename}" 1>&2 - - test_status=1 - fi - else - # Expecting no error. - if [[ -s "${actual_error_filename}" ]]; then - echo " * Error: Compiler error when none was expected." 1>&2 - - echo " - Actual:" 1>&2 - cat "${actual_error_filename}" 1>&2 - - test_status=1 - fi - fi - - echo "" - echo "" -done - -# Exit status. Leave the temporary directory alone on failure. -if [[ $test_status -eq 0 ]]; then - rm -rf ${temp_dir} -fi - -exit $test_status -- cgit v1.2.3