svn commit: r240549 - head/sys/arm/tegra

2012-09-16 Thread Andrew Turner
Author: andrew
Date: Sun Sep 16 07:55:49 2012
New Revision: 240549
URL: http://svn.freebsd.org/changeset/base/240549

Log:
  The cpu_reset function is noreturn, make sure this is true on Tegra 2.
  While here fix a typo.

Modified:
  head/sys/arm/tegra/common.c

Modified: head/sys/arm/tegra/common.c
==
--- head/sys/arm/tegra/common.c Sun Sep 16 06:44:58 2012(r240548)
+++ head/sys/arm/tegra/common.c Sun Sep 16 07:55:49 2012(r240549)
@@ -47,9 +47,11 @@ void
 cpu_reset(void)
 {
bus_space_handle_t bsh;
-   printf(Restetting...\n);
+   printf(Resetting...\n);
bus_space_map(fdtbus_bs_tag,TEGRA2_CLK_RST_PA_BASE, 0x1000, 0, bsh);
bus_space_write_4(fdtbus_bs_tag, bsh, 4, 4);
+
+   while(1);
 }
 
 struct fdt_fixup_entry fdt_fixup_table[] = {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r240549 - head/sys/arm/tegra

2012-09-16 Thread Alexey Dokuchaev
On Sun, Sep 16, 2012 at 07:55:49AM +, Andrew Turner wrote:
 New Revision: 240549
 URL: http://svn.freebsd.org/changeset/base/240549
 
 Log:
   The cpu_reset function is noreturn, make sure this is true on Tegra 2.
   While here fix a typo.
  
 +
 + while(1);

I thought preferred and more style(9) compliant way to code this is:

for (;;)
continue;

./danfe
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r240549 - head/sys/arm/tegra

2012-09-16 Thread Chris Rees
On 16 September 2012 10:28, Alexey Dokuchaev da...@freebsd.org wrote:
 On Sun, Sep 16, 2012 at 07:55:49AM +, Andrew Turner wrote:
 New Revision: 240549
 URL: http://svn.freebsd.org/changeset/base/240549

 Log:
   The cpu_reset function is noreturn, make sure this is true on Tegra 2.
   While here fix a typo.

 +
 + while(1);

 I thought preferred and more style(9) compliant way to code this is:

 for (;;)
 continue;

Actually:

for (;;)
;

Chris
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r240549 - head/sys/arm/tegra

2012-09-16 Thread Alexey Dokuchaev
On Sun, Sep 16, 2012 at 10:37:56AM +0100, Chris Rees wrote:
 On 16 September 2012 10:28, Alexey Dokuchaev da...@freebsd.org wrote:
  I thought preferred and more style(9) compliant way to code [empty
  endless loop] is:
 
  for (;;)
  continue;
 
 Actually:
 
 for (;;)
 ;

Explicit continue is supposed to tell reviewer that original author did
not make a typo, but indeed knew what he was doing.  Lonely semicolon is too
ambiguous in this case.

./danfe
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r240549 - head/sys/arm/tegra

2012-09-16 Thread Chris Rees
On 16 Sep 2012 10:53, Alexey Dokuchaev da...@freebsd.org wrote:

 On Sun, Sep 16, 2012 at 10:37:56AM +0100, Chris Rees wrote:
  On 16 September 2012 10:28, Alexey Dokuchaev da...@freebsd.org wrote:
   I thought preferred and more style(9) compliant way to code [empty
   endless loop] is:
  
   for (;;)
   continue;
 
  Actually:
 
  for (;;)
  ;

 Explicit continue is supposed to tell reviewer that original author did
 not make a typo, but indeed knew what he was doing.  Lonely semicolon is
too
 ambiguous in this case.

 ./danfe


That's not what man style says...

Chris
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r240549 - head/sys/arm/tegra

2012-09-16 Thread mdf
On Sun, Sep 16, 2012 at 2:53 AM, Alexey Dokuchaev da...@freebsd.org wrote:
 On Sun, Sep 16, 2012 at 10:37:56AM +0100, Chris Rees wrote:
 On 16 September 2012 10:28, Alexey Dokuchaev da...@freebsd.org wrote:
  I thought preferred and more style(9) compliant way to code [empty
  endless loop] is:
 
  for (;;)
  continue;

 Actually:

 for (;;)
 ;

 Explicit continue is supposed to tell reviewer that original author did
 not make a typo, but indeed knew what he was doing.  Lonely semicolon is too
 ambiguous in this case.

The semicolon being on its own line is not ambiguous, and is good
style everywhere.  A semicolon on the same line as a while or for is a
red flag that it may be unintentional.

Cheers,
matthew
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r240549 - head/sys/arm/tegra

2012-09-16 Thread David Chisnall
On 16 Sep 2012, at 10:37, Chris Rees wrote:

 Actually:
 
 for (;;)
;

This form will generate a compiler warning, because it looks like a missing 
loop body.  You can silence the warning by this form:

for (;;) {}

This makes it clear that you have an explicit body containing no statements.  

David___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r240549 - head/sys/arm/tegra

2012-09-16 Thread Chris Rees
On 16 Sep 2012 16:19, David Chisnall thera...@freebsd.org wrote:

 On 16 Sep 2012, at 10:37, Chris Rees wrote:

  Actually:
 
  for (;;)
 ;

 This form will generate a compiler warning, because it looks like a
missing loop body.  You can silence the warning by this form:

 for (;;) {}

 This makes it clear that you have an explicit body containing no
statements.

Please fix the style man page then, and make sure bde approves!

Chris
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r240549 - head/sys/arm/tegra

2012-09-16 Thread Ian Lepore
On Sun, 2012-09-16 at 18:30 +0100, Chris Rees wrote:
 On 16 Sep 2012 16:19, David Chisnall thera...@freebsd.org wrote:
 
  On 16 Sep 2012, at 10:37, Chris Rees wrote:
 
   Actually:
  
   for (;;)
  ;
 
  This form will generate a compiler warning, because it looks like a
 missing loop body.  You can silence the warning by this form:
 
  for (;;) {}
 
  This makes it clear that you have an explicit body containing no
 statements.
 
 Please fix the style man page then, and make sure bde approves!

One of the examples allows

for (;;)
stmt;

Using continue; as the statement is consistant with that.

-- Ian


___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r240549 - head/sys/arm/tegra

2012-09-16 Thread Chris Rees
On 16 September 2012 18:41, Ian Lepore free...@damnhippie.dyndns.org wrote:
 On Sun, 2012-09-16 at 18:30 +0100, Chris Rees wrote:
 On 16 Sep 2012 16:19, David Chisnall thera...@freebsd.org wrote:
 
  On 16 Sep 2012, at 10:37, Chris Rees wrote:
 
   Actually:
  
   for (;;)
  ;
 
  This form will generate a compiler warning, because it looks like a
 missing loop body.  You can silence the warning by this form:
 
  for (;;) {}
 
  This makes it clear that you have an explicit body containing no
 statements.

 Please fix the style man page then, and make sure bde approves!

 One of the examples allows

 for (;;)
 stmt;

 Using continue; as the statement is consistant with that.

Ok, so with approval from a docs/src guy I'd like to commit [1] to
update the style page to use continue; instead of a lone ;

Anyone like to approve/commit?

Chris

[1] http://www.bayofrum.net/~crees/patches/style-empty-loop.diff
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r240549 - head/sys/arm/tegra

2012-09-16 Thread Alexey Dokuchaev
On Sun, Sep 16, 2012 at 06:45:30PM +0100, Chris Rees wrote:
 On 16 September 2012 18:41, Ian Lepore free...@damnhippie.dyndns.org wrote:
  One of the examples allows
 
  for (;;)
  stmt;
 
  Using continue; as the statement is consistant with that.
 
 Ok, so with approval from a docs/src guy I'd like to commit [1] to
 update the style page to use continue; instead of a lone ;
 
 Anyone like to approve/commit?

I personally like you patch, but I'd really want to get bde@'s blessing.
(Maybe that nothing in comment should be replaced with do nothing, hmm...
Bruce, where are you?)

./danfe

 [1] http://www.bayofrum.net/~crees/patches/style-empty-loop.diff
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r240549 - head/sys/arm/tegra

2012-09-16 Thread Eitan Adler
On 16 September 2012 13:45, Chris Rees utis...@gmail.com wrote:
 On 16 September 2012 18:41, Ian Lepore free...@damnhippie.dyndns.org wrote:
 On Sun, 2012-09-16 at 18:30 +0100, Chris Rees wrote:
 On 16 Sep 2012 16:19, David Chisnall thera...@freebsd.org wrote:
 
  On 16 Sep 2012, at 10:37, Chris Rees wrote:
 
   Actually:
  
   for (;;)
  ;
 
  This form will generate a compiler warning, because it looks like a
 missing loop body.  You can silence the warning by this form:
 
  for (;;) {}
 
  This makes it clear that you have an explicit body containing no
 statements.

 Please fix the style man page then, and make sure bde approves!

 One of the examples allows

 for (;;)
 stmt;

 Using continue; as the statement is consistant with that.

 Ok, so with approval from a docs/src guy I'd like to commit [1] to
 update the style page to use continue; instead of a lone ;

 Anyone like to approve/commit?

+1 to your patch, though I prefer do nothing to nothing.


 Chris

 [1] http://www.bayofrum.net/~crees/patches/style-empty-loop.diff




-- 
Eitan Adler
Source  Ports committer
X11, Bugbusting teams
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r240549 - head/sys/arm/tegra

2012-09-16 Thread Julian Elischer

On 9/16/12 3:07 AM, Chris Rees wrote:



On 16 Sep 2012 10:53, Alexey Dokuchaev da...@freebsd.org 
mailto:da...@freebsd.org wrote:


 On Sun, Sep 16, 2012 at 10:37:56AM +0100, Chris Rees wrote:
  On 16 September 2012 10:28, Alexey Dokuchaev da...@freebsd.org 
mailto:da...@freebsd.org wrote:

   I thought preferred and more style(9) compliant way to code [empty
   endless loop] is:
  
   for (;;)
   continue;
 
  Actually:
 
  for (;;)
  ;

 Explicit continue is supposed to tell reviewer that original 
author did
 not make a typo, but indeed knew what he was doing.  Lonely 
semicolon is too

 ambiguous in this case.

 ./danfe




for (;;) {}


That's not what man style says...

Chris



___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r240549 - head/sys/arm/tegra

2012-09-16 Thread Bruce Evans

On Sun, 16 Sep 2012, Chris Rees wrote:


On 16 September 2012 18:41, Ian Lepore free...@damnhippie.dyndns.org wrote:

On Sun, 2012-09-16 at 18:30 +0100, Chris Rees wrote:

On 16 Sep 2012 16:19, David Chisnall thera...@freebsd.org wrote:


On 16 Sep 2012, at 10:37, Chris Rees wrote:


Actually:

for (;;)
   ;


This form will generate a compiler warning, because it looks like a

missing loop body.  You can silence the warning by this form:


for (;;) {}

This makes it clear that you have an explicit body containing no

statements.


This is forbidden by style(9) (it has excessive braces).


Please fix the style man page then, and make sure bde approves!


One of the examples allows

for (;;)
stmt;

Using continue; as the statement is consistant with that.


So is using a null statement.  Actually, the informal grammar in the
example is buggy.  In more formal grammars, the semicolon is part of
a statement (unless the statement is compound).  So the above should
really be:

for (;;)
statement

but that looks strange, and we know what the current version means.


Ok, so with approval from a docs/src guy I'd like to commit [1] to
update the style page to use continue; instead of a lone ;
...
[1] http://www.bayofrum.net/~crees/patches/style-empty-loop.diff


I don't like this.  The style is whatever it was, not what you want
it to be.  However, I couldn't find a single example in /usr/src/*bin
or libc that has an empty for loop.  Normal code just doesn't do that.
It would be better to remove the example of the empty loop in style(9),
so that style(9) doesn't require any particular style for rarely-written
code.

Oops.  The loop that you changed is not the above fully empty one, but
one with control statements but no body.  I couldn't find any like
the above, and ones with control statements are too hard to grep for.
The one that you changed is basically strlen(), and an example of
existing (mal)practice was in the 4.4BSD version of strlen.c:

% size_t
% strlen(str)
%   const char *str;
% {
%   const char *s;
% 
% 	for (s = str; *s; ++s);

%   return(s - str);
% }

It doesn't even put the semicolon on a new line.  strlen.c is now
recomplicated, so it no longer provides a bad example.  strlen() is also
in KR, with better style but a while loop:

while (s[i] != '\0')
i++;

and of course the classic obfuscated idiom for strcpy is to do all the
work in the control statment.  This obfuscation is done fairly well in
4.4BSD again:

for (; *to = *from; ++from, ++to);

(why not *to++, etc?).

I use a single semicolon for fully empty loops, but not put all of the
work in the control statement for loops that do something, so that the
never have an empty body.  Adding 'continue /* nothing */' to the old
BSD code wouldn't improve it.  Its only good point is that it is concise,
and this is defeated by redundant addiitons.

Bruce
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org