All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dtc: Remove spurious output on stderr
@ 2012-04-11 18:55 Simon Glass
       [not found] ` <1334170516-23473-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Simon Glass @ 2012-04-11 18:55 UTC (permalink / raw)
  To: Devicetree Discuss

Outputing to stderr is best avoided unless there is an error or warning to
display. At present dtc always displays the name of the file it is compiling
and the input/output formats. For example:

DTC: dts->dts  on file "-"

This can cause problems in some build systems. For example, U-Boot shows
build errors for any boards which use dtc at present. It is typically the
only message output during such a build. The C compiler does not output
anything in general. The current dtc behaviour makes it difficult to
provide a silent build in the normal case where nothing went wrong.

The -q flag is currently used to ignore warnings, and this message is not
really a warning. If we inserted another level of quietness that just
supresses non-warnings, then this would break the current behaviour of -q.

Therefore a new flag seems appropriate. Unfortunately both -v and -V are
already used, so I have come up with the random choice of -a: "announce
operation".

This also changes current behaviour, but hopefully in a good way. The main
problem is that people will wonder whether dtc actually ran at all, since
they are used to seeing the message. A quick check should confirm this, or
the -a flag can be added if desired.

I'm hoping someone has a better solution.

Signed-off-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
 dtc.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/dtc.c b/dtc.c
index 83aef32..685d046 100644
--- a/dtc.c
+++ b/dtc.c
@@ -58,6 +58,8 @@ static void  __attribute__ ((noreturn)) usage(void)
 	fprintf(stderr, "\t\tThis help text\n");
 	fprintf(stderr, "\t-q\n");
 	fprintf(stderr, "\t\tQuiet: -q suppress warnings, -qq errors, -qqq all\n");
+	fprintf(stderr, "\t-a\n");
+	fprintf(stderr, "\t\tAnnounce: Announce the file being processed\n");
 	fprintf(stderr, "\t-I <input format>\n");
 	fprintf(stderr, "\t\tInput formats are:\n");
 	fprintf(stderr, "\t\t\tdts - device tree source text\n");
@@ -103,7 +105,7 @@ int main(int argc, char *argv[])
 	const char *outform = "dts";
 	const char *outname = "-";
 	const char *depname = NULL;
-	int force = 0, sort = 0;
+	int force = 0, sort = 0, announce = 0;
 	const char *arg;
 	int opt;
 	FILE *outf = NULL;
@@ -115,9 +117,12 @@ int main(int argc, char *argv[])
 	minsize    = 0;
 	padsize    = 0;
 
-	while ((opt = getopt(argc, argv, "hI:O:o:V:d:R:S:p:fqb:i:vH:s"))
+	while ((opt = getopt(argc, argv, "ahI:O:o:V:d:R:S:p:fqb:i:vH:s"))
 			!= EOF) {
 		switch (opt) {
+		case 'a':
+			announce = 1;
+			break;
 		case 'I':
 			inform = optarg;
 			break;
@@ -193,8 +198,11 @@ int main(int argc, char *argv[])
 	if (minsize)
 		fprintf(stderr, "DTC: Use of \"-S\" is deprecated; it will be removed soon, use \"-p\" instead\n");
 
-	fprintf(stderr, "DTC: %s->%s  on file \"%s\"\n",
-		inform, outform, arg);
+	/* Messages on stderr are bad, so don't print this one unless asked */
+	if (announce) {
+		fprintf(stderr, "DTC: %s->%s  on file \"%s\"\n",
+			inform, outform, arg);
+	}
 
 	if (depname) {
 		depfile = fopen(depname, "w");
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] dtc: Remove spurious output on stderr
       [not found] ` <1334170516-23473-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
@ 2012-04-11 22:45   ` David Gibson
       [not found]     ` <20120411224557.GA8024-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
  2012-04-11 23:32   ` [PATCH v2] " Simon Glass
  1 sibling, 1 reply; 7+ messages in thread
From: David Gibson @ 2012-04-11 22:45 UTC (permalink / raw)
  To: Simon Glass; +Cc: Devicetree Discuss

On Wed, Apr 11, 2012 at 11:55:16AM -0700, Simon Glass wrote:
> Outputing to stderr is best avoided unless there is an error or warning to
> display. At present dtc always displays the name of the file it is compiling
> and the input/output formats. For example:
> 
> DTC: dts->dts  on file "-"
> 
> This can cause problems in some build systems. For example, U-Boot shows
> build errors for any boards which use dtc at present. It is typically the
> only message output during such a build. The C compiler does not output
> anything in general. The current dtc behaviour makes it difficult to
> provide a silent build in the normal case where nothing went wrong.
> 
> The -q flag is currently used to ignore warnings, and this message is not
> really a warning. If we inserted another level of quietness that just
> supresses non-warnings, then this would break the current behaviour of -q.
> 
> Therefore a new flag seems appropriate. Unfortunately both -v and -V are
> already used, so I have come up with the random choice of -a: "announce
> operation".
> 
> This also changes current behaviour, but hopefully in a good way. The main
> problem is that people will wonder whether dtc actually ran at all, since
> they are used to seeing the message. A quick check should confirm this, or
> the -a flag can be added if desired.
> 
> I'm hoping someone has a better solution.

Ugh.  Don't bother with the option, just remove the message.  I've
been half meaning to get rid of it for ages.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] dtc: Remove spurious output on stderr
       [not found]     ` <20120411224557.GA8024-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
@ 2012-04-11 23:17       ` Simon Glass
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Glass @ 2012-04-11 23:17 UTC (permalink / raw)
  To: David Gibson; +Cc: Devicetree Discuss

Hi David,

On Wed, Apr 11, 2012 at 3:45 PM, David Gibson
<david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org> wrote:
> On Wed, Apr 11, 2012 at 11:55:16AM -0700, Simon Glass wrote:
>> Outputing to stderr is best avoided unless there is an error or warning to
>> display. At present dtc always displays the name of the file it is compiling
>> and the input/output formats. For example:
>>
>> DTC: dts->dts  on file "-"
>>
>> This can cause problems in some build systems. For example, U-Boot shows
>> build errors for any boards which use dtc at present. It is typically the
>> only message output during such a build. The C compiler does not output
>> anything in general. The current dtc behaviour makes it difficult to
>> provide a silent build in the normal case where nothing went wrong.
>>
>> The -q flag is currently used to ignore warnings, and this message is not
>> really a warning. If we inserted another level of quietness that just
>> supresses non-warnings, then this would break the current behaviour of -q.
>>
>> Therefore a new flag seems appropriate. Unfortunately both -v and -V are
>> already used, so I have come up with the random choice of -a: "announce
>> operation".
>>
>> This also changes current behaviour, but hopefully in a good way. The main
>> problem is that people will wonder whether dtc actually ran at all, since
>> they are used to seeing the message. A quick check should confirm this, or
>> the -a flag can be added if desired.
>>
>> I'm hoping someone has a better solution.
>
> Ugh.  Don't bother with the option, just remove the message.  I've
> been half meaning to get rid of it for ages.

:-) That's not the answer I expected. Will do.

>
> --
> David Gibson                    | I'll have my music baroque, and my code
> david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
>                                | _way_ _around_!
> http://www.ozlabs.org/~dgibson

Regards
Simon

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] dtc: Remove spurious output on stderr
       [not found] ` <1334170516-23473-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
  2012-04-11 22:45   ` David Gibson
@ 2012-04-11 23:32   ` Simon Glass
       [not found]     ` <1334187146-8384-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
  1 sibling, 1 reply; 7+ messages in thread
From: Simon Glass @ 2012-04-11 23:32 UTC (permalink / raw)
  To: Devicetree Discuss

Outputing to stderr is best avoided unless there is an error or warning to
display. At present dtc always displays the name of the file it is compiling
and the input/output formats. For example:

DTC: dts->dts  on file "-"

This can cause problems in some build systems. For example, U-Boot shows
build errors for any boards which use dtc at present. It is typically the
only message output during such a build. The C compiler does not output
anything in general. The current dtc behaviour makes it difficult to
provide a silent build in the normal case where nothing went wrong.

Remove the message entirely.

Signed-off-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
Changes in v2:
- Drop the announce option; just remove the stderr output completely

 dtc.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/dtc.c b/dtc.c
index 83aef32..bee5085 100644
--- a/dtc.c
+++ b/dtc.c
@@ -193,9 +193,6 @@ int main(int argc, char *argv[])
 	if (minsize)
 		fprintf(stderr, "DTC: Use of \"-S\" is deprecated; it will be removed soon, use \"-p\" instead\n");
 
-	fprintf(stderr, "DTC: %s->%s  on file \"%s\"\n",
-		inform, outform, arg);
-
 	if (depname) {
 		depfile = fopen(depname, "w");
 		if (!depfile)
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] dtc: Remove spurious output on stderr
       [not found]     ` <1334187146-8384-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
@ 2012-04-11 23:34       ` David Gibson
       [not found]         ` <20120411233459.GC8024-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: David Gibson @ 2012-04-11 23:34 UTC (permalink / raw)
  To: Simon Glass; +Cc: Devicetree Discuss

On Wed, Apr 11, 2012 at 04:32:26PM -0700, Simon Glass wrote:
> Outputing to stderr is best avoided unless there is an error or warning to
> display. At present dtc always displays the name of the file it is compiling
> and the input/output formats. For example:
> 
> DTC: dts->dts  on file "-"
> 
> This can cause problems in some build systems. For example, U-Boot shows
> build errors for any boards which use dtc at present. It is typically the
> only message output during such a build. The C compiler does not output
> anything in general. The current dtc behaviour makes it difficult to
> provide a silent build in the normal case where nothing went wrong.
> 
> Remove the message entirely.
> 
> Signed-off-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

Acked-by: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] dtc: Remove spurious output on stderr
       [not found]         ` <20120411233459.GC8024-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
@ 2012-04-12  1:19           ` David Daney
  2012-04-14 14:04           ` Jon Loeliger
  1 sibling, 0 replies; 7+ messages in thread
From: David Daney @ 2012-04-12  1:19 UTC (permalink / raw)
  To: David Gibson, Simon Glass; +Cc: Devicetree Discuss

On 04/11/2012 04:34 PM, David Gibson wrote:
> On Wed, Apr 11, 2012 at 04:32:26PM -0700, Simon Glass wrote:
>> Outputing to stderr is best avoided unless there is an error or warning to
>> display. At present dtc always displays the name of the file it is compiling
>> and the input/output formats. For example:
>>
>> DTC: dts->dts  on file "-"
>>
>> This can cause problems in some build systems. For example, U-Boot shows
>> build errors for any boards which use dtc at present. It is typically the
>> only message output during such a build. The C compiler does not output
>> anything in general. The current dtc behaviour makes it difficult to
>> provide a silent build in the normal case where nothing went wrong.
>>
>> Remove the message entirely.
>>
>> Signed-off-by: Simon Glass<sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
>
> Acked-by: David Gibson<david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
>

I agree, I just saw two of them not 30 seconds ago.  So FWIW:

Acked-by: Signed-off-by: David Daney <ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] dtc: Remove spurious output on stderr
       [not found]         ` <20120411233459.GC8024-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
  2012-04-12  1:19           ` David Daney
@ 2012-04-14 14:04           ` Jon Loeliger
  1 sibling, 0 replies; 7+ messages in thread
From: Jon Loeliger @ 2012-04-14 14:04 UTC (permalink / raw)
  To: David Gibson; +Cc: Devicetree Discuss

> On Wed, Apr 11, 2012 at 04:32:26PM -0700, Simon Glass wrote:
> > Outputing to stderr is best avoided unless there is an error or warning to
> > display. At present dtc always displays the name of the file it is compiling
> > and the input/output formats. For example:
> > 
> > DTC: dts->dts  on file "-"
> > 
> > This can cause problems in some build systems. For example, U-Boot shows
> > build errors for any boards which use dtc at present. It is typically the
> > only message output during such a build. The C compiler does not output
> > anything in general. The current dtc behaviour makes it difficult to
> > provide a silent build in the normal case where nothing went wrong.
> > 
> > Remove the message entirely.
> > 
> > Signed-off-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> 
> Acked-by: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>

Applied.

Thanks,
jdl

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-04-14 14:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-11 18:55 [PATCH] dtc: Remove spurious output on stderr Simon Glass
     [not found] ` <1334170516-23473-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-04-11 22:45   ` David Gibson
     [not found]     ` <20120411224557.GA8024-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
2012-04-11 23:17       ` Simon Glass
2012-04-11 23:32   ` [PATCH v2] " Simon Glass
     [not found]     ` <1334187146-8384-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-04-11 23:34       ` David Gibson
     [not found]         ` <20120411233459.GC8024-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
2012-04-12  1:19           ` David Daney
2012-04-14 14:04           ` Jon Loeliger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.