From: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
To: Devicetree Discuss
<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>
Subject: [PATCH] dtc: Remove spurious output on stderr
Date: Wed, 11 Apr 2012 11:55:16 -0700 [thread overview]
Message-ID: <1334170516-23473-1-git-send-email-sjg@chromium.org> (raw)
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
next reply other threads:[~2012-04-11 18:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-11 18:55 Simon Glass [this message]
[not found] ` <1334170516-23473-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-04-11 22:45 ` [PATCH] dtc: Remove spurious output on stderr 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
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=1334170516-23473-1-git-send-email-sjg@chromium.org \
--to=sjg-f7+t8e8rja9g9huczpvpmw@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
/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;
as well as URLs for NNTP newsgroup(s).