mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Bernhard Walle <bernhard@bwalle.de>
To: ptxdist@pengutronix.de
Cc: Bernhard Walle <bernhard@bwalle.de>
Subject: [ptxdist] [PATCH] ptxd_lib_dgen.awk: Fix warning
Date: Wed, 29 Apr 2015 21:06:18 +0200	[thread overview]
Message-ID: <1430334378-32456-1-git-send-email-bernhard@bwalle.de> (raw)

After upgrading my gawk to 4.1.2 (which Arch Linux did today), I get
tons of warnings like

gawk: /usr/lib/ptxdist-2015.04.0/scripts/lib/ptxd_lib_dgen.awk:386:
(FILENAME=/tmp/ptxdist.p1sg2M/dgen/platformconfig FNR=233) warning:
gensub: third argument `' treated as 1

This patch fixes the warnings. According to the documentation
https://www.gnu.org/software/gawk/manual/gawk.html#String-Functions:

| gensub(regexp, replacement, how [, target]) #
| ...
|
| If the how argument is a string that does not begin with ‘g’ or ‘G’, or
| if it is a number that is less than or equal to zero, only one
| substitution is performed. If how is zero, gawk issues a warning
| message.

So the fix should be safe.

Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
---
 scripts/lib/ptxd_lib_dgen.awk | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/lib/ptxd_lib_dgen.awk b/scripts/lib/ptxd_lib_dgen.awk
index 9970953..c255706 100644
--- a/scripts/lib/ptxd_lib_dgen.awk
+++ b/scripts/lib/ptxd_lib_dgen.awk
@@ -89,7 +89,7 @@ $1 ~ /^[A-Z_]*PACKAGES-/ {
 	this_PKG = gensub(/^[A-Z_]*PACKAGES-\$\(PTXCONF_([^\)]*)\)/, "\\1", "g", $1);
 	this_PKG = gensub(/^[A-Z0-9_]*-\$\(PTXCONF_([^\)]*)\)/, "\\1", "g", this_PKG);
 
-	is_pkg = this_pkg = gensub(/^[[:space:]]*\<(.*)\>[[:space:]]*$/,"\\1","", $2);
+	is_pkg = this_pkg = gensub(/^[[:space:]]*\<(.*)\>[[:space:]]*$/,"\\1",1, $2);
 	if (this_pkg ~ /[A-Z]+/) {
 		print \
 			"\n" \
@@ -222,8 +222,8 @@ function write_vars_pkg_all(this_PKG, this_pkg, prefix) {
 	print this_PKG "_DEVPKG = " prefix this_devpkg			> DGEN_DEPS_PRE;
 	print this_PKG "_SOURCES = $(" this_PKG "_SOURCE)"		> DGEN_DEPS_PRE
 
-	target_PKG = gensub(/^HOST_|^CROSS_/, "", "", this_PKG);
-	PREFIX = gensub(/^(HOST_|CROSS_).*/, "\\1", "", this_PKG);
+	target_PKG = gensub(/^HOST_|^CROSS_/, "", 1, this_PKG);
+	PREFIX = gensub(/^(HOST_|CROSS_).*/, "\\1", 1, this_PKG);
 
 	# define default ${PKG}, ${PKG}_SOURCE, ${PKG}_DIR
 	if ((prefix != "") && (target_PKG in PKG_to_pkg)) {
@@ -352,7 +352,7 @@ function write_deps_pkg_active_image(this_PKG, this_pkg, prefix) {
 	n = split(this_PKG_DEPS, this_DEP_array, " ");
 	for (i = 1; i <= n; i++) {
 		this_dep = PKG_to_pkg[this_DEP_array[i]]
-		this_dep_prefix = gensub(/^(host-|cross-|image-|).*/, "\\1", "", this_dep)
+		this_dep_prefix = gensub(/^(host-|cross-|image-|).*/, "\\1", 1, this_dep)
 		if (this_dep_prefix == "")
 			print "$(" this_PKG "_IMAGE): "         "$(STATEDIR)/" this_dep ".targetinstall.post"	> DGEN_DEPS_POST;
 		else
@@ -371,7 +371,7 @@ END {
 	# for all pkgs
 	for (this_PKG in PKG_to_pkg) {
 		this_pkg = PKG_to_pkg[this_PKG];
-		this_pkg_prefix = gensub(/^(host-|cross-|image-|).*/, "\\1", "", this_pkg)
+		this_pkg_prefix = gensub(/^(host-|cross-|image-|).*/, "\\1", 1, this_pkg)
 
 		write_include(this_PKG)
 		if (this_pkg_prefix != "image-") {
@@ -383,7 +383,7 @@ END {
 	# for active pkgs
 	for (this_PKG in active_PKG_to_pkg) {
 		this_pkg = PKG_to_pkg[this_PKG];
-		this_pkg_prefix = gensub(/^(host-|cross-|image-|).*/, "\\1", "", this_pkg)
+		this_pkg_prefix = gensub(/^(host-|cross-|image-|).*/, "\\1", 1, this_pkg)
 
 		if (this_pkg_prefix != "image-") {
 			write_deps_pkg_active(this_PKG, this_pkg, this_pkg_prefix)
-- 
2.3.7


-- 
ptxdist mailing list
ptxdist@pengutronix.de

             reply	other threads:[~2015-04-29 19:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-29 19:06 Bernhard Walle [this message]
2015-04-30 18:56 ` Michael Olbrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430334378-32456-1-git-send-email-bernhard@bwalle.de \
    --to=bernhard@bwalle.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox