diff options
Diffstat (limited to 'scripts')
29 files changed, 209 insertions, 435 deletions
| diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 6baee1200615..d53825503874 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -61,7 +61,6 @@ endif  ifneq ($(findstring 2, $(KBUILD_EXTRA_WARN)),)  KBUILD_CFLAGS += -Wdisabled-optimization -KBUILD_CFLAGS += -Wnested-externs  KBUILD_CFLAGS += -Wshadow  KBUILD_CFLAGS += $(call cc-option, -Wlogical-op)  KBUILD_CFLAGS += -Wmissing-field-initializers diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 94133708889d..213677a5ed33 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -148,10 +148,12 @@ endif  # we don't want to check (depends on variables KASAN_SANITIZE_obj.o, KASAN_SANITIZE)  #  ifeq ($(CONFIG_KASAN),y) +ifneq ($(CONFIG_KASAN_HW_TAGS),y)  _c_flags += $(if $(patsubst n%,, \  		$(KASAN_SANITIZE_$(basetarget).o)$(KASAN_SANITIZE)y), \  		$(CFLAGS_KASAN), $(CFLAGS_KASAN_NOSANITIZE))  endif +endif  ifeq ($(CONFIG_UBSAN),y)  _c_flags += $(if $(patsubst n%,, \ diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter index d7ca46c612b3..652e9542043f 100755 --- a/scripts/bloat-o-meter +++ b/scripts/bloat-o-meter @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python  #  # Copyright 2004 Matt Mackall <[email protected]>  # diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 00085308ed9d..92e888ed939f 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -6646,6 +6646,12 @@ sub process {  #			}  #		} +# strlcpy uses that should likely be strscpy +		if ($line =~ /\bstrlcpy\s*\(/) { +			WARN("STRLCPY", +			     "Prefer strscpy over strlcpy - see: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw\@mail.gmail.com/\n" . $herecurr); +		} +  # typecasts on min/max could be min_t/max_t  		if ($perl_version_ok &&  		    defined $stat && diff --git a/scripts/coccicheck b/scripts/coccicheck index 209bb0427b43..65fee63aeadb 100755 --- a/scripts/coccicheck +++ b/scripts/coccicheck @@ -16,7 +16,6 @@ if [ ! -x "$SPATCH" ]; then  fi  SPATCH_VERSION=$($SPATCH --version | head -1 | awk '{print $3}') -SPATCH_VERSION_NUM=$(echo $SPATCH_VERSION | ${DIR}/scripts/ld-version.sh)  USE_JOBS="no"  $SPATCH --help | grep "\-\-jobs" > /dev/null && USE_JOBS="yes" @@ -61,6 +60,18 @@ COCCIINCLUDE=${COCCIINCLUDE// -include/ --include}  if [ "$C" = "1" -o "$C" = "2" ]; then      ONLINE=1 +    if [[ $# -le 0 ]]; then +	    echo '' +	    echo 'Specifying both the variable "C" and rule "coccicheck" in the make +command results in a shift count error.' +	    echo '' +	    echo 'Try specifying "scripts/coccicheck" as a value for the CHECK variable instead.' +	    echo '' +	    echo 'Example:	make C=2 CHECK=scripts/coccicheck drivers/net/ethernet/ethoc.o' +	    echo '' +	    exit 1 +    fi +      # Take only the last argument, which is the C file to test      shift $(( $# - 1 ))      OPTIONS="$COCCIINCLUDE $1" @@ -186,14 +197,11 @@ coccinelle () {      OPT=`grep "Options:" $COCCI | cut -d':' -f2`      REQ=`grep "Requires:" $COCCI | cut -d':' -f2 | sed "s| ||"` -    REQ_NUM=$(echo $REQ | ${DIR}/scripts/ld-version.sh) -    if [ "$REQ_NUM" != "0" ] ; then -	    if [ "$SPATCH_VERSION_NUM" -lt "$REQ_NUM" ] ; then -		    echo "Skipping coccinelle SmPL patch: $COCCI" -		    echo "You have coccinelle:           $SPATCH_VERSION" -		    echo "This SmPL patch requires:      $REQ" -		    return -	    fi +    if [ -n "$REQ" ] && ! { echo "$REQ"; echo "$SPATCH_VERSION"; } | sort -CV ; then +	    echo "Skipping coccinelle SmPL patch: $COCCI" +	    echo "You have coccinelle:           $SPATCH_VERSION" +	    echo "This SmPL patch requires:      $REQ" +	    return      fi  #   The option '--parse-cocci' can be used to syntactically check the SmPL files. diff --git a/scripts/coccinelle/api/ptr_ret.cocci b/scripts/coccinelle/api/ptr_ret.cocci deleted file mode 100644 index e76cd5d90a8a..000000000000 --- a/scripts/coccinelle/api/ptr_ret.cocci +++ /dev/null @@ -1,97 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/// -/// Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR -/// -// Confidence: High -// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. -// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. -// URL: http://coccinelle.lip6.fr/ -// Options: --no-includes --include-headers -// -// Keywords: ERR_PTR, PTR_ERR, PTR_ERR_OR_ZERO -// Version min: 2.6.39 -// - -virtual context -virtual patch -virtual org -virtual report - -@depends on patch@ -expression ptr; -@@ - -- if (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0; -+ return PTR_ERR_OR_ZERO(ptr); - -@depends on patch@ -expression ptr; -@@ - -- if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; -+ return PTR_ERR_OR_ZERO(ptr); - -@depends on patch@ -expression ptr; -@@ - -- (IS_ERR(ptr) ? PTR_ERR(ptr) : 0) -+ PTR_ERR_OR_ZERO(ptr) - -@r1 depends on !patch@ -expression ptr; -position p1; -@@ - -* if@p1 (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0; - -@r2 depends on !patch@ -expression ptr; -position p2; -@@ - -* if@p2 (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; - -@r3 depends on !patch@ -expression ptr; -position p3; -@@ - -* IS_ERR@p3(ptr) ? PTR_ERR(ptr) : 0 - -@script:python depends on org@ -p << r1.p1; -@@ - -coccilib.org.print_todo(p[0], "WARNING: PTR_ERR_OR_ZERO can be used") - - -@script:python depends on org@ -p << r2.p2; -@@ - -coccilib.org.print_todo(p[0], "WARNING: PTR_ERR_OR_ZERO can be used") - -@script:python depends on org@ -p << r3.p3; -@@ - -coccilib.org.print_todo(p[0], "WARNING: PTR_ERR_OR_ZERO can be used") - -@script:python depends on report@ -p << r1.p1; -@@ - -coccilib.report.print_report(p[0], "WARNING: PTR_ERR_OR_ZERO can be used") - -@script:python depends on report@ -p << r2.p2; -@@ - -coccilib.report.print_report(p[0], "WARNING: PTR_ERR_OR_ZERO can be used") - -@script:python depends on report@ -p << r3.p3; -@@ - -coccilib.report.print_report(p[0], "WARNING: PTR_ERR_OR_ZERO can be used") diff --git a/scripts/coccinelle/misc/boolinit.cocci b/scripts/coccinelle/misc/boolinit.cocci deleted file mode 100644 index fed6126e2b9d..000000000000 --- a/scripts/coccinelle/misc/boolinit.cocci +++ /dev/null @@ -1,195 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/// Bool initializations should use true and false.  Bool tests don't need -/// comparisons.  Based on contributions from Joe Perches, Rusty Russell -/// and Bruce W Allan. -/// -// Confidence: High -// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. -// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. -// URL: http://coccinelle.lip6.fr/ -// Options: --include-headers - -virtual patch -virtual context -virtual org -virtual report - -@boolok@ -symbol true,false; -@@ -( -true -| -false -) - -@depends on patch@ -bool t; -@@ - -( -- t == true -+ t -| -- true == t -+ t -| -- t != true -+ !t -| -- true != t -+ !t -| -- t == false -+ !t -| -- false == t -+ !t -| -- t != false -+ t -| -- false != t -+ t -) - -@depends on patch disable is_zero, isnt_zero@ -bool t; -@@ - -( -- t == 1 -+ t -| -- t != 1 -+ !t -| -- t == 0 -+ !t -| -- t != 0 -+ t -) - -@depends on patch && boolok@ -bool b; -@@ -( - b = -- 0 -+ false -| - b = -- 1 -+ true -) - -// --------------------------------------------------------------------- - -@r1 depends on !patch@ -bool t; -position p; -@@ - -( -* t@p == true -| -* true == t@p -| -* t@p != true -| -* true != t@p -| -* t@p == false -| -* false == t@p -| -* t@p != false -| -* false != t@p -) - -@r2 depends on !patch disable is_zero, isnt_zero@ -bool t; -position p; -@@ - -( -* t@p == 1 -| -* t@p != 1 -| -* t@p == 0 -| -* t@p != 0 -) - -@r3 depends on !patch && boolok@ -bool b; -position p1; -@@ -( -*b@p1 = 0 -| -*b@p1 = 1 -) - -@r4 depends on !patch@ -bool b; -position p2; -identifier i; -constant c != {0,1}; -@@ -( - b = i -| -*b@p2 = c -) - -@script:python depends on org@ -p << r1.p; -@@ - -cocci.print_main("WARNING: Comparison to bool",p) - -@script:python depends on org@ -p << r2.p; -@@ - -cocci.print_main("WARNING: Comparison of 0/1 to bool variable",p) - -@script:python depends on org@ -p1 << r3.p1; -@@ - -cocci.print_main("WARNING: Assignment of 0/1 to bool variable",p1) - -@script:python depends on org@ -p2 << r4.p2; -@@ - -cocci.print_main("ERROR: Assignment of non-0/1 constant to bool variable",p2) - -@script:python depends on report@ -p << r1.p; -@@ - -coccilib.report.print_report(p[0],"WARNING: Comparison to bool") - -@script:python depends on report@ -p << r2.p; -@@ - -coccilib.report.print_report(p[0],"WARNING: Comparison of 0/1 to bool variable") - -@script:python depends on report@ -p1 << r3.p1; -@@ - -coccilib.report.print_report(p1[0],"WARNING: Assignment of 0/1 to bool variable") - -@script:python depends on report@ -p2 << r4.p2; -@@ - -coccilib.report.print_report(p2[0],"ERROR: Assignment of non-0/1 constant to bool variable") diff --git a/scripts/config b/scripts/config index eee5b7f3a092..8c8d7c3d7acc 100755 --- a/scripts/config +++ b/scripts/config @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash  # SPDX-License-Identifier: GPL-2.0  # Manipulate options in a .config file from the command line diff --git a/scripts/depmod.sh b/scripts/depmod.sh index e083bcae343f..3643b4f896ed 100755 --- a/scripts/depmod.sh +++ b/scripts/depmod.sh @@ -15,6 +15,8 @@ if ! test -r System.map ; then  	exit 0  fi +# legacy behavior: "depmod" in /sbin, no /sbin in PATH +PATH="$PATH:/sbin"  if [ -z $(command -v $DEPMOD) ]; then  	echo "Warning: 'make modules_install' requires $DEPMOD. Please install it." >&2  	echo "This is probably in the kmod package." >&2 diff --git a/scripts/diffconfig b/scripts/diffconfig index 89abf777f197..627eba5849b5 100755 --- a/scripts/diffconfig +++ b/scripts/diffconfig @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python  # SPDX-License-Identifier: GPL-2.0  #  # diffconfig - a tool to compare .config files. diff --git a/scripts/genksyms/keywords.c b/scripts/genksyms/keywords.c index 057c6cabad1d..b85e0979a00c 100644 --- a/scripts/genksyms/keywords.c +++ b/scripts/genksyms/keywords.c @@ -32,6 +32,9 @@ static struct resword {  	{ "restrict", RESTRICT_KEYW },  	{ "asm", ASM_KEYW }, +	// c11 keywords that can be used at module scope +	{ "_Static_assert", STATIC_ASSERT_KEYW }, +  	// attribute commented out in modutils 2.4.2.  People are using 'attribute' as a  	// field name which breaks the genksyms parser.  It is not a gcc keyword anyway.  	// KAO. }, diff --git a/scripts/genksyms/lex.l b/scripts/genksyms/lex.l index e265c5d96861..ae76472efc43 100644 --- a/scripts/genksyms/lex.l +++ b/scripts/genksyms/lex.l @@ -118,7 +118,7 @@ yylex(void)  {    static enum {      ST_NOTSTARTED, ST_NORMAL, ST_ATTRIBUTE, ST_ASM, ST_TYPEOF, ST_TYPEOF_1, -    ST_BRACKET, ST_BRACE, ST_EXPRESSION, +    ST_BRACKET, ST_BRACE, ST_EXPRESSION, ST_STATIC_ASSERT,      ST_TABLE_1, ST_TABLE_2, ST_TABLE_3, ST_TABLE_4,      ST_TABLE_5, ST_TABLE_6    } lexstate = ST_NOTSTARTED; @@ -201,6 +201,11 @@ repeat:  		  case EXPORT_SYMBOL_KEYW:  		      goto fini; + +		  case STATIC_ASSERT_KEYW: +		    lexstate = ST_STATIC_ASSERT; +		    count = 0; +		    goto repeat;  		  }  	      }  	    if (!suppress_type_lookup) @@ -401,6 +406,26 @@ repeat:  	}        break; +    case ST_STATIC_ASSERT: +      APP; +      switch (token) +	{ +	case '(': +	  ++count; +	  goto repeat; +	case ')': +	  if (--count == 0) +	    { +	      lexstate = ST_NORMAL; +	      token = STATIC_ASSERT_PHRASE; +	      break; +	    } +	  goto repeat; +	default: +	  goto repeat; +	} +      break; +      case ST_TABLE_1:        goto repeat; diff --git a/scripts/genksyms/parse.y b/scripts/genksyms/parse.y index e22b42245bcc..8e9b5e69e8f0 100644 --- a/scripts/genksyms/parse.y +++ b/scripts/genksyms/parse.y @@ -80,6 +80,7 @@ static void record_compound(struct string_list **keyw,  %token SHORT_KEYW  %token SIGNED_KEYW  %token STATIC_KEYW +%token STATIC_ASSERT_KEYW  %token STRUCT_KEYW  %token TYPEDEF_KEYW  %token UNION_KEYW @@ -97,6 +98,7 @@ static void record_compound(struct string_list **keyw,  %token BRACE_PHRASE  %token BRACKET_PHRASE  %token EXPRESSION_PHRASE +%token STATIC_ASSERT_PHRASE  %token CHAR  %token DOTS @@ -130,6 +132,7 @@ declaration1:  	| function_definition  	| asm_definition  	| export_definition +	| static_assert  	| error ';'				{ $$ = $2; }  	| error '}'				{ $$ = $2; }  	; @@ -493,6 +496,10 @@ export_definition:  		{ export_symbol((*$3)->string); $$ = $5; }  	; +/* Ignore any module scoped _Static_assert(...) */ +static_assert: +	STATIC_ASSERT_PHRASE ';'			{ $$ = $2; } +	;  %% diff --git a/scripts/get_abi.pl b/scripts/get_abi.pl index 68dab828a722..92d9aa6cc4f5 100755 --- a/scripts/get_abi.pl +++ b/scripts/get_abi.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl  # SPDX-License-Identifier: GPL-2.0  use strict; diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index f6e548b8f795..db03e2f45de4 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -11,7 +11,6 @@  #include <time.h>  #include <unistd.h>  #include <getopt.h> -#include <sys/stat.h>  #include <sys/time.h>  #include <errno.h> diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index a39d93e3c6ae..2568dbe16ed6 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -5,6 +5,7 @@  #include <sys/mman.h>  #include <sys/stat.h> +#include <sys/types.h>  #include <ctype.h>  #include <errno.h>  #include <fcntl.h> diff --git a/scripts/kconfig/lexer.l b/scripts/kconfig/lexer.l index 240109f965ae..9c22cb554673 100644 --- a/scripts/kconfig/lexer.l +++ b/scripts/kconfig/lexer.l @@ -12,7 +12,6 @@  #include <stdio.h>  #include <stdlib.h>  #include <string.h> -#include <unistd.h>  #include "lkc.h"  #include "parser.tab.h" diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 8454649b17bd..bee2413bda63 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -6,6 +6,10 @@  #ifndef LKC_H  #define LKC_H +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +  #include "expr.h"  #ifdef __cplusplus diff --git a/scripts/kconfig/preprocess.c b/scripts/kconfig/preprocess.c index 0243086fb168..0590f86df6e4 100644 --- a/scripts/kconfig/preprocess.c +++ b/scripts/kconfig/preprocess.c @@ -114,7 +114,7 @@ static char *do_error_if(int argc, char *argv[])  	if (!strcmp(argv[0], "y"))  		pperror("%s", argv[1]); -	return NULL; +	return xstrdup("");  }  static char *do_filename(int argc, char *argv[]) diff --git a/scripts/kconfig/qconf-cfg.sh b/scripts/kconfig/qconf-cfg.sh index 02ccc0ae1031..fa564cd795b7 100755 --- a/scripts/kconfig/qconf-cfg.sh +++ b/scripts/kconfig/qconf-cfg.sh @@ -2,7 +2,6 @@  # SPDX-License-Identifier: GPL-2.0  PKG="Qt5Core Qt5Gui Qt5Widgets" -PKG2="QtCore QtGui"  if [ -z "$(command -v pkg-config)" ]; then  	echo >&2 "*" @@ -12,21 +11,14 @@ if [ -z "$(command -v pkg-config)" ]; then  fi  if pkg-config --exists $PKG; then -	echo cflags=\"-std=c++11 -fPIC $(pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets)\" +	echo cflags=\"-std=c++11 -fPIC $(pkg-config --cflags $PKG)\"  	echo libs=\"$(pkg-config --libs $PKG)\"  	echo moc=\"$(pkg-config --variable=host_bins Qt5Core)/moc\"  	exit 0  fi -if pkg-config --exists $PKG2; then -	echo cflags=\"$(pkg-config --cflags $PKG2)\" -	echo libs=\"$(pkg-config --libs $PKG2)\" -	echo moc=\"$(pkg-config --variable=moc_location QtCore)\" -	exit 0 -fi -  echo >&2 "*" -echo >&2 "* Could not find Qt via pkg-config." -echo >&2 "* Please install either Qt 4.8 or 5.x. and make sure it's in PKG_CONFIG_PATH" +echo >&2 "* Could not find Qt5 via pkg-config." +echo >&2 "* Please install Qt5 and make sure it's in PKG_CONFIG_PATH"  echo >&2 "*"  exit 1 diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index f7eb093614f2..d000869b787c 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -310,15 +310,16 @@ ConfigList::ConfigList(QWidget *parent, const char *name)  	setHeaderLabels(QStringList() << "Option" << "Name" << "Value"); -	connect(this, SIGNAL(itemSelectionChanged(void)), -		SLOT(updateSelection(void))); +	connect(this, &ConfigList::itemSelectionChanged, +		this, &ConfigList::updateSelection);  	if (name) {  		configSettings->beginGroup(name);  		showName = configSettings->value("/showName", false).toBool();  		optMode = (enum optionMode)configSettings->value("/optionMode", 0).toInt();  		configSettings->endGroup(); -		connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); +		connect(configApp, &QApplication::aboutToQuit, +			this, &ConfigList::saveSettings);  	}  	showColumn(promptColIdx); @@ -888,10 +889,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)  		headerPopup = new QMenu(this);  		action = new QAction("Show Name", this);  		action->setCheckable(true); -		connect(action, SIGNAL(toggled(bool)), -			SLOT(setShowName(bool))); -		connect(this, SIGNAL(showNameChanged(bool)), -			action, SLOT(setChecked(bool))); +		connect(action, &QAction::toggled, +			this, &ConfigList::setShowName); +		connect(this, &ConfigList::showNameChanged, +			action, &QAction::setChecked);  		action->setChecked(showName);  		headerPopup->addAction(action);  	} @@ -936,15 +937,18 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)  		configSettings->beginGroup(objectName());  		setShowDebug(configSettings->value("/showDebug", false).toBool());  		configSettings->endGroup(); -		connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); +		connect(configApp, &QApplication::aboutToQuit, +			this, &ConfigInfoView::saveSettings);  	}  	contextMenu = createStandardContextMenu();  	QAction *action = new QAction("Show Debug Info", contextMenu);  	action->setCheckable(true); -	connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); -	connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setChecked(bool))); +	connect(action, &QAction::toggled, +		this, &ConfigInfoView::setShowDebug); +	connect(this, &ConfigInfoView::showDebugChanged, +		action, &QAction::setChecked);  	action->setChecked(showDebug());  	contextMenu->addSeparator();  	contextMenu->addAction(action); @@ -1231,11 +1235,13 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent)  	layout2->setSpacing(6);  	layout2->addWidget(new QLabel("Find:", this));  	editField = new QLineEdit(this); -	connect(editField, SIGNAL(returnPressed()), SLOT(search())); +	connect(editField, &QLineEdit::returnPressed, +		this, &ConfigSearchWindow::search);  	layout2->addWidget(editField);  	searchButton = new QPushButton("Search", this);  	searchButton->setAutoDefault(false); -	connect(searchButton, SIGNAL(clicked()), SLOT(search())); +	connect(searchButton, &QPushButton::clicked, +		this, &ConfigSearchWindow::search);  	layout2->addWidget(searchButton);  	layout1->addLayout(layout2); @@ -1244,10 +1250,10 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent)  	list = new ConfigList(split, "search");  	list->mode = listMode;  	info = new ConfigInfoView(split, "search"); -	connect(list, SIGNAL(menuChanged(struct menu *)), -		info, SLOT(setInfo(struct menu *))); -	connect(list, SIGNAL(menuChanged(struct menu *)), -		parent, SLOT(setMenuLink(struct menu *))); +	connect(list, &ConfigList::menuChanged, +		info, &ConfigInfoView::setInfo); +	connect(list, &ConfigList::menuChanged, +		parent, &ConfigMainWindow::setMenuLink);  	layout1->addWidget(split); @@ -1267,7 +1273,8 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent)  	if (ok)  		split->setSizes(sizes);  	configSettings->endGroup(); -	connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); +	connect(configApp, &QApplication::aboutToQuit, +		this, &ConfigSearchWindow::saveSettings);  }  void ConfigSearchWindow::saveSettings(void) @@ -1367,19 +1374,23 @@ ConfigMainWindow::ConfigMainWindow(void)  	configList->setFocus();  	backAction = new QAction(QPixmap(xpm_back), "Back", this); -	connect(backAction, SIGNAL(triggered(bool)), SLOT(goBack())); +	connect(backAction, &QAction::triggered, +		this, &ConfigMainWindow::goBack);  	QAction *quitAction = new QAction("&Quit", this);  	quitAction->setShortcut(Qt::CTRL + Qt::Key_Q); -	connect(quitAction, SIGNAL(triggered(bool)), SLOT(close())); +	connect(quitAction, &QAction::triggered, +		this, &ConfigMainWindow::close);  	QAction *loadAction = new QAction(QPixmap(xpm_load), "&Load", this);  	loadAction->setShortcut(Qt::CTRL + Qt::Key_L); -	connect(loadAction, SIGNAL(triggered(bool)), SLOT(loadConfig())); +	connect(loadAction, &QAction::triggered, +		this, &ConfigMainWindow::loadConfig);  	saveAction = new QAction(QPixmap(xpm_save), "&Save", this);  	saveAction->setShortcut(Qt::CTRL + Qt::Key_S); -	connect(saveAction, SIGNAL(triggered(bool)), SLOT(saveConfig())); +	connect(saveAction, &QAction::triggered, +		this, &ConfigMainWindow::saveConfig);  	conf_set_changed_callback(conf_changed); @@ -1388,31 +1399,37 @@ ConfigMainWindow::ConfigMainWindow(void)  	configname = xstrdup(conf_get_configname());  	QAction *saveAsAction = new QAction("Save &As...", this); -	  connect(saveAsAction, SIGNAL(triggered(bool)), SLOT(saveConfigAs())); +	connect(saveAsAction, &QAction::triggered, +		this, &ConfigMainWindow::saveConfigAs);  	QAction *searchAction = new QAction("&Find", this);  	searchAction->setShortcut(Qt::CTRL + Qt::Key_F); -	  connect(searchAction, SIGNAL(triggered(bool)), SLOT(searchConfig())); +	connect(searchAction, &QAction::triggered, +		this, &ConfigMainWindow::searchConfig);  	singleViewAction = new QAction(QPixmap(xpm_single_view), "Single View", this);  	singleViewAction->setCheckable(true); -	  connect(singleViewAction, SIGNAL(triggered(bool)), SLOT(showSingleView())); +	connect(singleViewAction, &QAction::triggered, +		this, &ConfigMainWindow::showSingleView);  	splitViewAction = new QAction(QPixmap(xpm_split_view), "Split View", this);  	splitViewAction->setCheckable(true); -	  connect(splitViewAction, SIGNAL(triggered(bool)), SLOT(showSplitView())); +	connect(splitViewAction, &QAction::triggered, +		this, &ConfigMainWindow::showSplitView);  	fullViewAction = new QAction(QPixmap(xpm_tree_view), "Full View", this);  	fullViewAction->setCheckable(true); -	  connect(fullViewAction, SIGNAL(triggered(bool)), SLOT(showFullView())); +	connect(fullViewAction, &QAction::triggered, +		this, &ConfigMainWindow::showFullView);  	QAction *showNameAction = new QAction("Show Name", this);  	  showNameAction->setCheckable(true); -	connect(showNameAction, SIGNAL(toggled(bool)), configList, SLOT(setShowName(bool))); +	connect(showNameAction, &QAction::toggled, +		configList, &ConfigList::setShowName);  	showNameAction->setChecked(configList->showName);  	QActionGroup *optGroup = new QActionGroup(this);  	optGroup->setExclusive(true); -	connect(optGroup, SIGNAL(triggered(QAction*)), configList, -		SLOT(setOptionMode(QAction *))); -	connect(optGroup, SIGNAL(triggered(QAction *)), menuList, -		SLOT(setOptionMode(QAction *))); +	connect(optGroup, &QActionGroup::triggered, +		configList, &ConfigList::setOptionMode); +	connect(optGroup, &QActionGroup::triggered, +		menuList, &ConfigList::setOptionMode);  	ConfigList::showNormalAction = new QAction("Show Normal Options", optGroup);  	ConfigList::showNormalAction->setCheckable(true); @@ -1423,13 +1440,16 @@ ConfigMainWindow::ConfigMainWindow(void)  	QAction *showDebugAction = new QAction("Show Debug Info", this);  	  showDebugAction->setCheckable(true); -	  connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); +	connect(showDebugAction, &QAction::toggled, +		helpText, &ConfigInfoView::setShowDebug);  	  showDebugAction->setChecked(helpText->showDebug());  	QAction *showIntroAction = new QAction("Introduction", this); -	  connect(showIntroAction, SIGNAL(triggered(bool)), SLOT(showIntro())); +	connect(showIntroAction, &QAction::triggered, +		this, &ConfigMainWindow::showIntro);  	QAction *showAboutAction = new QAction("About", this); -	  connect(showAboutAction, SIGNAL(triggered(bool)), SLOT(showAbout())); +	connect(showAboutAction, &QAction::triggered, +		this, &ConfigMainWindow::showAbout);  	// init tool bar  	QToolBar *toolBar = addToolBar("Tools"); @@ -1467,30 +1487,30 @@ ConfigMainWindow::ConfigMainWindow(void)  	menu->addAction(showIntroAction);  	menu->addAction(showAboutAction); -	connect (helpText, SIGNAL (anchorClicked (const QUrl &)), -		 helpText, SLOT (clicked (const QUrl &)) ); - -	connect(configList, SIGNAL(menuChanged(struct menu *)), -		helpText, SLOT(setInfo(struct menu *))); -	connect(configList, SIGNAL(menuSelected(struct menu *)), -		SLOT(changeMenu(struct menu *))); -	connect(configList, SIGNAL(itemSelected(struct menu *)), -		SLOT(changeItens(struct menu *))); -	connect(configList, SIGNAL(parentSelected()), -		SLOT(goBack())); -	connect(menuList, SIGNAL(menuChanged(struct menu *)), -		helpText, SLOT(setInfo(struct menu *))); -	connect(menuList, SIGNAL(menuSelected(struct menu *)), -		SLOT(changeMenu(struct menu *))); - -	connect(configList, SIGNAL(gotFocus(struct menu *)), -		helpText, SLOT(setInfo(struct menu *))); -	connect(menuList, SIGNAL(gotFocus(struct menu *)), -		helpText, SLOT(setInfo(struct menu *))); -	connect(menuList, SIGNAL(gotFocus(struct menu *)), -		SLOT(listFocusChanged(void))); -	connect(helpText, SIGNAL(menuSelected(struct menu *)), -		SLOT(setMenuLink(struct menu *))); +	connect(helpText, &ConfigInfoView::anchorClicked, +		helpText, &ConfigInfoView::clicked); + +	connect(configList, &ConfigList::menuChanged, +		helpText, &ConfigInfoView::setInfo); +	connect(configList, &ConfigList::menuSelected, +		this, &ConfigMainWindow::changeMenu); +	connect(configList, &ConfigList::itemSelected, +		this, &ConfigMainWindow::changeItens); +	connect(configList, &ConfigList::parentSelected, +		this, &ConfigMainWindow::goBack); +	connect(menuList, &ConfigList::menuChanged, +		helpText, &ConfigInfoView::setInfo); +	connect(menuList, &ConfigList::menuSelected, +		this, &ConfigMainWindow::changeMenu); + +	connect(configList, &ConfigList::gotFocus, +		helpText, &ConfigInfoView::setInfo); +	connect(menuList, &ConfigList::gotFocus, +		helpText, &ConfigInfoView::setInfo); +	connect(menuList, &ConfigList::gotFocus, +		this, &ConfigMainWindow::listFocusChanged); +	connect(helpText, &ConfigInfoView::menuSelected, +		this, &ConfigMainWindow::setMenuLink);  	QString listMode = configSettings->value("/listMode", "symbol").toString();  	if (listMode == "single") @@ -1779,10 +1799,13 @@ void ConfigMainWindow::showIntro(void)  void ConfigMainWindow::showAbout(void)  {  	static const QString str = "qconf is Copyright (C) 2002 Roman Zippel <[email protected]>.\n" -		"Copyright (C) 2015 Boris Barbulovski <[email protected]>.\n\n" -		"Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n"; +		"Copyright (C) 2015 Boris Barbulovski <[email protected]>.\n" +		"\n" +		"Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n" +		"\n" +		"Qt Version: "; -	QMessageBox::information(this, "qconf", str); +	QMessageBox::information(this, "qconf", str + qVersion());  }  void ConfigMainWindow::saveSettings(void) diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index ffa3ec65cc90..fe38e6fd2c2a 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -3,11 +3,11 @@   * Copyright (C) 2002 Roman Zippel <[email protected]>   */ +#include <sys/types.h>  #include <ctype.h>  #include <stdlib.h>  #include <string.h>  #include <regex.h> -#include <sys/utsname.h>  #include "lkc.h" diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index f882ce0d9327..d6c81657d695 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -34,12 +34,14 @@ static int external_module = 0;  static int warn_unresolved = 0;  /* How a symbol is exported */  static int sec_mismatch_count = 0; -static int sec_mismatch_fatal = 0; +static int sec_mismatch_warn_only = true;  /* ignore missing files */  static int ignore_missing_files;  /* If set to 1, only warn (instead of error) about missing ns imports */  static int allow_missing_ns_imports; +static bool error_occurred; +  enum export {  	export_plain,      export_unused,     export_gpl,  	export_unused_gpl, export_gpl_future, export_unknown @@ -78,6 +80,8 @@ modpost_log(enum loglevel loglevel, const char *fmt, ...)  	if (loglevel == LOG_FATAL)  		exit(1); +	if (loglevel == LOG_ERROR) +		error_occurred = true;  }  static inline bool strends(const char *str, const char *postfix) @@ -403,8 +407,8 @@ static void sym_update_namespace(const char *symname, const char *namespace)  	 * actually an assertion.  	 */  	if (!s) { -		merror("Could not update namespace(%s) for symbol %s\n", -		       namespace, symname); +		error("Could not update namespace(%s) for symbol %s\n", +		      namespace, symname);  		return;  	} @@ -2014,7 +2018,7 @@ static void read_symbols(const char *modname)  	if (!mod->is_vmlinux) {  		license = get_modinfo(&info, "license");  		if (!license) -			warn("missing MODULE_LICENSE() in %s\n", modname); +			error("missing MODULE_LICENSE() in %s\n", modname);  		while (license) {  			if (license_is_gpl_compatible(license))  				mod->gpl_compatible = 1; @@ -2141,11 +2145,11 @@ static void check_for_gpl_usage(enum export exp, const char *m, const char *s)  {  	switch (exp) {  	case export_gpl: -		fatal("GPL-incompatible module %s.ko uses GPL-only symbol '%s'\n", +		error("GPL-incompatible module %s.ko uses GPL-only symbol '%s'\n",  		      m, s);  		break;  	case export_unused_gpl: -		fatal("GPL-incompatible module %s.ko uses GPL-only symbol marked UNUSED '%s'\n", +		error("GPL-incompatible module %s.ko uses GPL-only symbol marked UNUSED '%s'\n",  		      m, s);  		break;  	case export_gpl_future: @@ -2174,22 +2178,18 @@ static void check_for_unused(enum export exp, const char *m, const char *s)  	}  } -static int check_exports(struct module *mod) +static void check_exports(struct module *mod)  {  	struct symbol *s, *exp; -	int err = 0;  	for (s = mod->unres; s; s = s->next) {  		const char *basename;  		exp = find_symbol(s->name);  		if (!exp || exp->module == mod) { -			if (have_vmlinux && !s->weak) { +			if (have_vmlinux && !s->weak)  				modpost_log(warn_unresolved ? LOG_WARN : LOG_ERROR,  					    "\"%s\" [%s.ko] undefined!\n",  					    s->name, mod->name); -				if (!warn_unresolved) -					err = 1; -			}  			continue;  		}  		basename = strrchr(mod->name, '/'); @@ -2203,8 +2203,6 @@ static int check_exports(struct module *mod)  			modpost_log(allow_missing_ns_imports ? LOG_WARN : LOG_ERROR,  				    "module %s uses symbol %s from namespace %s, but does not import it.\n",  				    basename, exp->name, exp->namespace); -			if (!allow_missing_ns_imports) -				err = 1;  			add_namespace(&mod->missing_namespaces, exp->namespace);  		} @@ -2212,11 +2210,9 @@ static int check_exports(struct module *mod)  			check_for_gpl_usage(exp->export, basename, exp->name);  		check_for_unused(exp->export, basename, exp->name);  	} - -	return err;  } -static int check_modname_len(struct module *mod) +static void check_modname_len(struct module *mod)  {  	const char *mod_name; @@ -2225,12 +2221,8 @@ static int check_modname_len(struct module *mod)  		mod_name = mod->name;  	else  		mod_name++; -	if (strlen(mod_name) >= MODULE_NAME_LEN) { -		merror("module name is too long [%s.ko]\n", mod->name); -		return 1; -	} - -	return 0; +	if (strlen(mod_name) >= MODULE_NAME_LEN) +		error("module name is too long [%s.ko]\n", mod->name);  }  /** @@ -2289,10 +2281,9 @@ static void add_staging_flag(struct buffer *b, const char *name)  /**   * Record CRCs for unresolved symbols   **/ -static int add_versions(struct buffer *b, struct module *mod) +static void add_versions(struct buffer *b, struct module *mod)  {  	struct symbol *s, *exp; -	int err = 0;  	for (s = mod->unres; s; s = s->next) {  		exp = find_symbol(s->name); @@ -2304,7 +2295,7 @@ static int add_versions(struct buffer *b, struct module *mod)  	}  	if (!modversions) -		return err; +		return;  	buf_printf(b, "\n");  	buf_printf(b, "static const struct modversion_info ____versions[]\n"); @@ -2319,9 +2310,8 @@ static int add_versions(struct buffer *b, struct module *mod)  			continue;  		}  		if (strlen(s->name) >= MODULE_NAME_LEN) { -			merror("too long symbol \"%s\" [%s.ko]\n", -			       s->name, mod->name); -			err = 1; +			error("too long symbol \"%s\" [%s.ko]\n", +			      s->name, mod->name);  			break;  		}  		buf_printf(b, "\t{ %#8x, \"%s\" },\n", @@ -2329,8 +2319,6 @@ static int add_versions(struct buffer *b, struct module *mod)  	}  	buf_printf(b, "};\n"); - -	return err;  }  static void add_depends(struct buffer *b, struct module *mod) @@ -2554,7 +2542,6 @@ int main(int argc, char **argv)  	char *missing_namespace_deps = NULL;  	char *dump_write = NULL, *files_source = NULL;  	int opt; -	int err;  	int n;  	struct dump_list *dump_read_start = NULL;  	struct dump_list **dump_read_iter = &dump_read_start; @@ -2589,7 +2576,7 @@ int main(int argc, char **argv)  			warn_unresolved = 1;  			break;  		case 'E': -			sec_mismatch_fatal = 1; +			sec_mismatch_warn_only = false;  			break;  		case 'N':  			allow_missing_ns_imports = 1; @@ -2624,8 +2611,6 @@ int main(int argc, char **argv)  	if (!have_vmlinux)  		warn("Symbol info of vmlinux is missing. Unresolved symbol check will be entirely skipped.\n"); -	err = 0; -  	for (mod = modules; mod; mod = mod->next) {  		char fname[PATH_MAX]; @@ -2634,14 +2619,14 @@ int main(int argc, char **argv)  		buf.pos = 0; -		err |= check_modname_len(mod); -		err |= check_exports(mod); +		check_modname_len(mod); +		check_exports(mod);  		add_header(&buf, mod);  		add_intree_flag(&buf, !external_module);  		add_retpoline(&buf);  		add_staging_flag(&buf, mod->name); -		err |= add_versions(&buf, mod); +		add_versions(&buf, mod);  		add_depends(&buf, mod);  		add_moddevtable(&buf, mod);  		add_srcversion(&buf, mod); @@ -2655,21 +2640,21 @@ int main(int argc, char **argv)  	if (dump_write)  		write_dump(dump_write); -	if (sec_mismatch_count && sec_mismatch_fatal) -		fatal("Section mismatches detected.\n" +	if (sec_mismatch_count && !sec_mismatch_warn_only) +		error("Section mismatches detected.\n"  		      "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n");  	for (n = 0; n < SYMBOL_HASH_SIZE; n++) {  		struct symbol *s;  		for (s = symbolhash[n]; s; s = s->next) {  			if (s->is_static) -				warn("\"%s\" [%s] is a static %s\n", -				     s->name, s->module->name, -				     export_str(s->export)); +				error("\"%s\" [%s] is a static %s\n", +				      s->name, s->module->name, +				      export_str(s->export));  		}  	}  	free(buf.p); -	return err; +	return error_occurred ? 1 : 0;  } diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index 3aa052722233..e6f46eee0af0 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h @@ -201,6 +201,19 @@ enum loglevel {  void modpost_log(enum loglevel loglevel, const char *fmt, ...); +/* + * warn - show the given message, then let modpost continue running, still + *        allowing modpost to exit successfully. This should be used when + *        we still allow to generate vmlinux and modules. + * + * error - show the given message, then let modpost continue running, but fail + *         in the end. This should be used when we should stop building vmlinux + *         or modules, but we can continue running modpost to catch as many + *         issues as possible. + * + * fatal - show the given message, and bail out immediately. This should be + *         used when there is no point to continue running modpost. + */  #define warn(fmt, args...)	modpost_log(LOG_WARN, fmt, ##args) -#define merror(fmt, args...)	modpost_log(LOG_ERROR, fmt, ##args) +#define error(fmt, args...)	modpost_log(LOG_ERROR, fmt, ##args)  #define fatal(fmt, args...)	modpost_log(LOG_FATAL, fmt, ##args) diff --git a/scripts/nsdeps b/scripts/nsdeps index dab4c1a0e27d..e8ce2a4d704a 100644 --- a/scripts/nsdeps +++ b/scripts/nsdeps @@ -12,11 +12,9 @@ if [ ! -x "$SPATCH" ]; then  	exit 1  fi -SPATCH_REQ_VERSION_NUM=$(echo $SPATCH_REQ_VERSION | ${DIR}/scripts/ld-version.sh)  SPATCH_VERSION=$($SPATCH --version | head -1 | awk '{print $3}') -SPATCH_VERSION_NUM=$(echo $SPATCH_VERSION | ${DIR}/scripts/ld-version.sh) -if [ "$SPATCH_VERSION_NUM" -lt "$SPATCH_REQ_VERSION_NUM" ] ; then +if ! { echo "$SPATCH_REQ_VERSION"; echo "$SPATCH_VERSION"; } | sort -CV ; then  	echo "spatch needs to be version $SPATCH_REQ_VERSION or higher"  	exit 1  fi diff --git a/scripts/show_delta b/scripts/show_delta index 264399307c4f..28e67e178194 100755 --- a/scripts/show_delta +++ b/scripts/show_delta @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python  # SPDX-License-Identifier: GPL-2.0-only  #  # show_deltas: Read list of printk messages instrumented with diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install index 40fa6923e80a..828a8615a918 100755 --- a/scripts/sphinx-pre-install +++ b/scripts/sphinx-pre-install @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl  # SPDX-License-Identifier: GPL-2.0-or-later  use strict; diff --git a/scripts/split-man.pl b/scripts/split-man.pl index c3db607ee9ec..96bd99dc977a 100755 --- a/scripts/split-man.pl +++ b/scripts/split-man.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl  # SPDX-License-Identifier: GPL-2.0  #  # Author: Mauro Carvalho Chehab <[email protected]> diff --git a/scripts/tracing/draw_functrace.py b/scripts/tracing/draw_functrace.py index b65735758520..74f8aadfd4cb 100755 --- a/scripts/tracing/draw_functrace.py +++ b/scripts/tracing/draw_functrace.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python  # SPDX-License-Identifier: GPL-2.0-only  """ |