public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] puts() and newlines (was Re: Discussion topics / issues)
Date: Wed, 15 Oct 2014 10:40:12 +0200	[thread overview]
Message-ID: <20141015084012.GA20015@amd> (raw)
In-Reply-To: <20141011150346.150C038352A@gemini.denx.de>

Hi!

> First, we have a compatibility problem here.  GCC assumes that puts()
> will add a newline character after the string; U-Boot puts() does NOT
> do this.  So the GCC auto-converted printf()s will all be wrong, as
> they are missing the newline. [1]

> [1] One might argue that this is a bug in U-Boot and should be fixed,
> but that is another topic.

I believe we should fix that, yes.

I did quick grep,

pavel at duo:~/wagabuibui/u-boot$ grep -ri puts . | wc -l
4287

and that is probably too much to change in one go. So what about this?

Best regards,
    	    	     	      	 	       	      	   	 Pavel
---

Introduce __puts() that puts strings without trailing newline. Plan is
to move the existing puts() users into __puts(), when no puts() users
are left, fix the puts() to add the newline, and move users that want
newline back to puts().

Signed-off-by: Pavel Machek <pavel@denx.de>

--- a/include/common.h
+++ b/include/common.h
@@ -836,6 +836,8 @@ int	tstc(void);
 /* stdout */
 void	putc(const char c);
 void	puts(const char *s);
+static inline void __puts(const char *s) { puts(s); }
+
 int	printf(const char *fmt, ...)
 		__attribute__ ((format (__printf__, 1, 2)));
 int	vprintf(const char *fmt, va_list args);




-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  parent reply	other threads:[~2014-10-15  8:40 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-07 12:45 [U-Boot] [SoCFPGA] next steps Marek Vasut
2014-10-08  8:58 ` Michal Simek
2014-10-08 10:39   ` Marek Vasut
2014-10-08 11:17   ` Pavel Machek
2014-10-08 20:09   ` Tom Rini
2014-10-09  8:37     ` Michal Simek
2014-10-09 11:20       ` Jagan Teki
2014-10-09 13:42         ` Marek Vasut
2014-10-09 16:11           ` Jagan Teki
2014-10-09 16:15             ` [U-Boot] Discussion topics / issues Marek Vasut
2014-10-09 16:41               ` Jagan Teki
2014-10-09 14:03       ` Marek Vasut
2014-10-09 14:45         ` Michal Simek
2014-10-09 15:57           ` Tom Rini
2014-10-09 16:10             ` Marek Vasut
2014-10-09 16:25               ` Tom Rini
2014-10-09 16:29                 ` Marek Vasut
2014-10-09 22:11         ` Pavel Machek
2014-10-09 22:24           ` Wolfgang Denk
2014-10-09 23:00             ` Pavel Machek
2014-10-10 12:22               ` Wolfgang Denk
2014-10-10 14:04                 ` Jeroen Hofstee
2014-10-10 14:26                   ` Marek Vasut
2014-10-10 14:35                     ` Fabio Estevam
2014-10-10 16:09                     ` Jeroen Hofstee
2014-10-10 19:51                       ` Albert ARIBAUD
2014-10-10 20:40                         ` Jeroen Hofstee
2014-10-10 21:13                           ` Albert ARIBAUD
2014-10-11 15:03                           ` Wolfgang Denk
2014-10-11 15:16                             ` Wolfgang Denk
2014-10-15  8:40                             ` Pavel Machek [this message]
2014-10-15  9:42                               ` [U-Boot] puts() and newlines (was Re: Discussion topics / issues) Pavel Machek
2014-10-20 15:51                               ` Tom Rini
2014-10-11 14:44                   ` [U-Boot] Discussion topics / issues Wolfgang Denk
2014-10-12 15:06                   ` Jeroen Hofstee
2014-10-09 23:05             ` Pavel Machek
2014-10-10 11:05               ` Albert ARIBAUD
2014-10-10 12:34               ` Wolfgang Denk
2014-10-10  0:12           ` Tom Rini
2014-10-08 13:18 ` [U-Boot] [SoCFPGA] next steps Dinh Nguyen
2014-10-08 19:05   ` Marek Vasut
2014-10-11 18:22 ` Masahiro YAMADA
2014-10-19 21:19   ` Marek Vasut

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=20141015084012.GA20015@amd \
    --to=pavel@denx.de \
    --cc=u-boot@lists.denx.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