From 55a524cf3cc29a2a3f4ef43b5ac1c94534eaa7b2 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Fri, 10 Mar 2017 16:52:54 +0100 Subject: [PATCH] org: detect C++ errors * doc/org/g++wrap.in: Save error messages. * doc/Makefile.am: Display them at the end of the compilation. --- doc/Makefile.am | 5 ++++- doc/org/g++wrap.in | 17 ++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/doc/Makefile.am b/doc/Makefile.am index 917a50afe..5dbe70a30 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -57,9 +57,12 @@ dist_pkgdata_DATA = $(srcdir)/spot.tag .PHONY: org org-man org: cd $(top_builddir) && $(MAKE) doc/org/init.el - rm -rf $(srcdir)/userdoc + rm -rf $(srcdir)/userdoc $(builddir)/org/org.errors $(MAKE) org-man org/plantuml.jar $(EMACS) --batch -Q -l org/init.el + if test -s $(builddir)/org/org.errors; then \ + cat $(builddir)/org/org.errors; exit 1; \ + else :; fi org/plantuml.jar: wget http://downloads.sourceforge.net/project/plantuml/plantuml.jar -O org/plantuml.jar || curl http://downloads.sourceforge.net/project/plantuml/plantuml.jar -o org/plantuml.jar diff --git a/doc/org/g++wrap.in b/doc/org/g++wrap.in index 4bd319840..1bc81c44b 100755 --- a/doc/org/g++wrap.in +++ b/doc/org/g++wrap.in @@ -1,6 +1,17 @@ #!/bin/sh # This is a wrapper around the compiler, to ensure that the code # example run from the org-mode file are all linked with Spot. -exec @top_builddir@/libtool link @CXX@ -std=c++11 -Wall \ - -I@abs_top_builddir@ -I@abs_top_srcdir@ -I@abs_top_srcdir@/buddy/src \ - "$@" @abs_top_builddir@/spot/libspot.la +# +# Also we save errors to org.errors, so that we can detect issues +# after org-mode has exported everything. Otherwise these errors +# would go undetected. +@top_builddir@/libtool link @CXX@ @CXXFLAGS@ -Wall -Werror \ + -I@abs_top_builddir@ -I@abs_top_srcdir@ -I@abs_top_srcdir@/buddy/src \ + "$@" @abs_top_builddir@/spot/libspot.la 2> errors.$$ +code=$? +if test $code -ne 0 && test -s errors.$$; then + cat errors.$$ >>org.errors + cat errors.$$ >&2 +fi +rm -f errors.$$ +exit $code