From e3d197b9a4f8aa60eaf053c7e3255fea2833e01c Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 4 Oct 2012 21:29:39 +0200 Subject: [PATCH] Handle more cases of `moc-qt4` and support `moc-qt5`. Fixes false positives. Thanks to Felix Geyer for informing me of this issue. For more information see Debian bug #689616. --- bin/blhc | 13 ++++++++----- t/logs/qt4 | 10 +++++++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/bin/blhc b/bin/blhc index f2f0d6f..01c0e02 100755 --- a/bin/blhc +++ b/bin/blhc @@ -852,12 +852,15 @@ foreach my $file (@ARGV) { [Cc]ompiler[\s.]*:?\s+ /x; next if $line =~ /^\s*(?:- )?(?:HOST_)?(?:CC|CXX)\s*=\s*$cc_regex_full\s*$/o; - # `moc-qt4`, contains '-I/usr/share/qt4/mkspecs/linux-g++' (or - # similar for other architectures) which gets recognized as a - # compiler line. Ignore it. - next if $line =~ m{^/usr/bin/moc-qt4 + # `moc-qt4`/`moc-qt5` contain '-I.../linux-g++' in their command + # line (or similar for other architectures) which gets recognized + # as a compiler line, but `moc-qt*` is only a preprocessor for Qt + # C++ files. No hardening flags are relevant during this step, + # thus ignore `moc-qt*` lines. The resulting files will be + # compiled in a separate step (and therefore checked). + next if $line =~ m{^\S+/bin/moc-qt[45] \s.+\s - -I/usr/share/qt4/mkspecs/[a-z]+-g\++(?:-64)? + -I\S+/mkspecs/[a-z]+-g\++(?:-64)? \s}x; # Ignore false positives when the line contains only CC=gcc but no # other gcc command. diff --git a/t/logs/qt4 b/t/logs/qt4 index c707639..c5823bb 100644 --- a/t/logs/qt4 +++ b/t/logs/qt4 @@ -1,8 +1,16 @@ dpkg-buildpackage: source package test -# Output by qt4 which should be ignored. +# `moc-qt4`/`moc-qt5` are preprocessors and don't require any hardening flags. /usr/bin/moc-qt4 -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I/usr/include/qt4/QtDBus -I/include -I.. -I. -I. test.h -o moc_test.cpp /usr/bin/moc-qt4 -DQT_NO_DEBUG_OUTPUT -DAPP_VERSION=1.1 -DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS -DQT_NO_DEBUG -DQT_PHONON_LIB -DQT_DBUS_LIB -DQT_SQL_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/glibc-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtSql -I/usr/include/qt4/QtDBus -I/usr/include/qt4 -Ilocale -Ibuild/moc -o build/moc/moc_test.cpp /usr/bin/moc-qt4 -DQT_NO_DEBUG_OUTPUT -DAPP_VERSION=1.1 -DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS -DQT_NO_DEBUG -DQT_PHONON_LIB -DQT_DBUS_LIB -DQT_SQL_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtSql -I/usr/include/qt4/QtDBus -I/usr/include/qt4 -Ilocale -Ibuild/moc -o build/moc/moc_test.cpp + +# Tests for Debian bug #678616. + +/tmp/buildd/qt4-x11-4.8.3+dfsg/bin/moc-qt4 -DQT_OPENGL_SUPPORT -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_DECLARATIVE_LIB -DQT_SQL_LIB -DQT_XML_LIB -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_HAVE_SSE3 -DQT_HAVE_SSSE3 -DQT_HAVE_SSE4_1 -DQT_HAVE_SSE4_2 -DQT_HAVE_AVX -DQT_SHARED -I../../mkspecs/linux-g++-64 -I. -I../../include/QtCore -I../../include/QtNetwork -I../../include/QtGui -I../../include/QtOpenGL -I../../include/QtXml -I../../include/QtSql -I../../include/QtDeclarative -I../../include -I../../include/QtHelp -I/usr/X11R6/include -I/usr/X11R6/include -I.moc/release-shared demoitemanimation.h -o .moc/release-shared/moc_demoitemanimation.cpp + +/tmp/buildd/qtbase-opensource-src-5.0.0~beta1/bin/moc-qt5 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++-64 -I. -I../../../../include -I../../../../include/QtWidgets -I../../../../include/QtGui -I../../../../include/QtCore -I.moc/release-shared norwegianwoodstyle.h -o .moc/release-shared/moc_norwegianwoodstyle.cpp +/tmp/buildd/qtbase-opensource-src-5.0.0~beta1/bin/moc-qt5 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++-64 -I. -I../../../../include -I../../../../include/QtWidgets -I../../../../include/QtGui -I../../../../include/QtCore -I.moc/release-shared norwegianwoodstyle.h -o .moc/release-shared/moc_norwegianwoodstyle.cpp +/tmp/buildd/qtbase-opensource-src-5.0.0~beta1/bin/moc-qt5 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++-64 -I. -I../../../../include -I../../../../include/QtWidgets -I../../../../include/QtGui -I../../../../include/QtCore -I.moc/release-shared norwegianwoodstyle.h -o .moc/release-shared/moc_norwegianwoodstyle.cpp -- 2.43.2