public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] /* inside comment in libfdt.h
@ 2008-01-02 12:46 Matthias Fuchs
  2008-01-02 13:13 ` Jerry Van Baren
  2008-01-02 15:01 ` Wolfgang Denk
  0 siblings, 2 replies; 11+ messages in thread
From: Matthias Fuchs @ 2008-01-02 12:46 UTC (permalink / raw)
  To: u-boot

Hi,

I just tested the current master branch after Wolfgang recent custodian merge
and noticed some errors that are caused by comments inside comments.

Possibly this can be switched of by a compiler switch or the code has never passed
compilation. With ELDK's gcc 4.0.0 (ELDK 4.1.0) at least I run into trouble.

What about this solution:

diff --git a/include/libfdt.h b/include/libfdt.h
index 8253ccf..8050049 100644
--- a/include/libfdt.h
+++ b/include/libfdt.h
@@ -544,7 +544,7 @@ int fdt_parent_offset(const void *fdt, int nodeoffset);
  *     offset = fdt_node_offset_by_prop_value(fdt, -1, propname,
  *                                            propval, proplen);
  *     while (offset != -FDT_ERR_NOTFOUND) {
- *             /* other code here */
+ *             ... other code here ...
  *             offset = fdt_node_offset_by_prop_value(fdt, offset, propname,
  *                                                    propval, proplen);
  *     }
@@ -629,7 +629,7 @@ int fdt_node_check_compatible(const void *fdt, int nodeoffset,
  * idiom can be used:
  *     offset = fdt_node_offset_by_compatible(fdt, -1, compatible);
  *     while (offset != -FDT_ERR_NOTFOUND) {
- *             /* other code here */
+ *             ... other code here ...
  *             offset = fdt_node_offset_by_compatible(fdt, offset, compatible);
  *     }
  *

Matthias
-- 
-----------------------------------------------------------------------
Dipl.-Ing. Matthias Fuchs             esd electronic system design gmbh
http://www.esd-electronics.com                    Vahrenwalder Str. 207
phone: +49-511-37298-0, fax: -68                30165 Hannover, Germany
-----------------------------------------------------------------------

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

* [U-Boot-Users] /* inside comment in libfdt.h
  2008-01-02 12:46 [U-Boot-Users] /* inside comment in libfdt.h Matthias Fuchs
@ 2008-01-02 13:13 ` Jerry Van Baren
  2008-01-02 13:49   ` Matthias Fuchs
  2008-01-03 19:28   ` Jon Loeliger
  2008-01-02 15:01 ` Wolfgang Denk
  1 sibling, 2 replies; 11+ messages in thread
From: Jerry Van Baren @ 2008-01-02 13:13 UTC (permalink / raw)
  To: u-boot

Matthias Fuchs wrote:
> Hi,
> 
> I just tested the current master branch after Wolfgang recent custodian merge
> and noticed some errors that are caused by comments inside comments.
> 
> Possibly this can be switched of by a compiler switch or the code has never passed
> compilation. With ELDK's gcc 4.0.0 (ELDK 4.1.0) at least I run into trouble.
> 
> What about this solution:
> 
> diff --git a/include/libfdt.h b/include/libfdt.h
> index 8253ccf..8050049 100644
> --- a/include/libfdt.h
> +++ b/include/libfdt.h
> @@ -544,7 +544,7 @@ int fdt_parent_offset(const void *fdt, int nodeoffset);
>   *     offset = fdt_node_offset_by_prop_value(fdt, -1, propname,
>   *                                            propval, proplen);
>   *     while (offset != -FDT_ERR_NOTFOUND) {
> - *             /* other code here */
> + *             ... other code here ...
>   *             offset = fdt_node_offset_by_prop_value(fdt, offset, propname,
>   *                                                    propval, proplen);
>   *     }
> @@ -629,7 +629,7 @@ int fdt_node_check_compatible(const void *fdt, int nodeoffset,
>   * idiom can be used:
>   *     offset = fdt_node_offset_by_compatible(fdt, -1, compatible);
>   *     while (offset != -FDT_ERR_NOTFOUND) {
> - *             /* other code here */
> + *             ... other code here ...
>   *             offset = fdt_node_offset_by_compatible(fdt, offset, compatible);
>   *     }
>   *
> 
> Matthias

Yes, nested comments is something that should not be done and should be 
fixed.  This was inherited from the original code, although the current 
version uses // for the embedded comment which avoids the issue (but 
causes "no C++ comments" people to break out in rashes).

<http://jdl.com/git_repos/?p=dtc.git;a=blob;f=libfdt/libfdt.h;h=ac0f5c3d1b41a1f6a8a5637a11d3ae4b9b6e6ed4;hb=3e516d961a45a2a410a9dc8f61fbdd62641b5ca0#l547>

Hmm, interesting, the original appears to have always used //, so it 
would appear that we (u-booties) did the change to /* */.
<http://jdl.com/git_repos/?p=dtc.git;a=commitdiff;h=53acf491e9d576519f97b62984762498f9453cb4>
I'll have to look at this further.

My inclination is to change to embedded // comments to avoid drifting 
from the original due to aesthetics rather than due to necessary 
functionality differences.

The alternative would be to convince David Gibson (/jdl) to adopt the 
...other code here... change.  I prefer the ... change if it matters - 
if somebody blindly cuts and pastes the example code, it won't compile 
until he understands and edits what he pasted.

Thanks,
gvb

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

* [U-Boot-Users] /* inside comment in libfdt.h
  2008-01-02 13:13 ` Jerry Van Baren
@ 2008-01-02 13:49   ` Matthias Fuchs
  2008-01-03 19:28   ` Jon Loeliger
  1 sibling, 0 replies; 11+ messages in thread
From: Matthias Fuchs @ 2008-01-02 13:49 UTC (permalink / raw)
  To: u-boot

On Wednesday 02 January 2008 14:13, Jerry Van Baren wrote:

C++ style comments inside comments are no comments :-)

I could life with //, but if people do cut'n'paste we get //
in our code - and 'ubooties' know not to use C++ style comments.

When the original source uses //, we should keep that in order to stay
in sync with that code. If the U-Boot community will start to stone
us, the solution is ....

Wolfgang, do you accept the change back to //?

Matthias


> Yes, nested comments is something that should not be done and should be 
> fixed.  This was inherited from the original code, although the current 
> version uses // for the embedded comment which avoids the issue (but 
> causes "no C++ comments" people to break out in rashes).
> 
> <http://jdl.com/git_repos/?p=dtc.git;a=blob;f=libfdt/libfdt.h;h=ac0f5c3d1b41a1f6a8a5637a11d3ae4b9b6e6ed4;hb=3e516d961a45a2a410a9dc8f61fbdd62641b5ca0#l547>
> 
> Hmm, interesting, the original appears to have always used //, so it 
> would appear that we (u-booties) did the change to /* */.
> <http://jdl.com/git_repos/?p=dtc.git;a=commitdiff;h=53acf491e9d576519f97b62984762498f9453cb4>
> I'll have to look at this further.
> 
> My inclination is to change to embedded // comments to avoid drifting 
> from the original due to aesthetics rather than due to necessary 
> functionality differences.
> 
> The alternative would be to convince David Gibson (/jdl) to adopt the 
> ...other code here... change.  I prefer the ... change if it matters - 
> if somebody blindly cuts and pastes the example code, it won't compile 
> until he understands and edits what he pasted.
> 
> Thanks,
> gvb
> 
> 

-- 
-----------------------------------------------------------------------
Dipl.-Ing. Matthias Fuchs             esd electronic system design gmbh
http://www.esd-electronics.com                    Vahrenwalder Str. 207
phone: +49-511-37298-0, fax: -68                30165 Hannover, Germany
-----------------------------------------------------------------------

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

* [U-Boot-Users] /* inside comment in libfdt.h
  2008-01-02 12:46 [U-Boot-Users] /* inside comment in libfdt.h Matthias Fuchs
  2008-01-02 13:13 ` Jerry Van Baren
@ 2008-01-02 15:01 ` Wolfgang Denk
  1 sibling, 0 replies; 11+ messages in thread
From: Wolfgang Denk @ 2008-01-02 15:01 UTC (permalink / raw)
  To: u-boot

In message <200801021347.01153.matthias.fuchs@esd-electronics.com> you wrote:
> 
> I just tested the current master branch after Wolfgang recent custodian merge
> and noticed some errors that are caused by comments inside comments.
> 
> Possibly this can be switched of by a compiler switch or the code has never passed
> compilation. With ELDK's gcc 4.0.0 (ELDK 4.1.0) at least I run into trouble.

You are right, mea culpa. Fix is checked in.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
There is nothing in this world constant but inconstancy.      - Swift

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

* [U-Boot-Users] /* inside comment in libfdt.h
  2008-01-02 13:13 ` Jerry Van Baren
  2008-01-02 13:49   ` Matthias Fuchs
@ 2008-01-03 19:28   ` Jon Loeliger
  2008-01-03 19:35     ` Scott Wood
                       ` (2 more replies)
  1 sibling, 3 replies; 11+ messages in thread
From: Jon Loeliger @ 2008-01-03 19:28 UTC (permalink / raw)
  To: u-boot

On Wed, 2008-01-02 at 07:13, Jerry Van Baren wrote:

> Yes, nested comments is something that should not be done and should be 
> fixed.  This was inherited from the original code, although the current 
> version uses // for the embedded comment which avoids the issue (but 
> causes "no C++ comments" people to break out in rashes).
> 
> <http://jdl.com/git_repos/?p=dtc.git;a=blob;f=libfdt/libfdt.h;h=ac0f5c3d1b41a1f6a8a5637a11d3ae4b9b6e6ed4;hb=3e516d961a45a2a410a9dc8f61fbdd62641b5ca0#l547>

Woah, hey!  That's me!

Uh...


> Hmm, interesting, the original appears to have always used //, so it 
> would appear that we (u-booties) did the change to /* */.
> <http://jdl.com/git_repos/?p=dtc.git;a=commitdiff;h=53acf491e9d576519f97b62984762498f9453cb4>
> I'll have to look at this further.
> 
> My inclination is to change to embedded // comments to avoid drifting 
> from the original due to aesthetics rather than due to necessary 
> functionality differences.
> 
> The alternative would be to convince David Gibson (/jdl) to adopt the 
> ...other code here... change.  I prefer the ... change if it matters - 
> if somebody blindly cuts and pastes the example code, it won't compile 
> until he understands and edits what he pasted.

Oh man....

OK.  For the record, I'm all for only comments like this:

    /*
     *
     */

Clearly lax, I'll start enforcing it on the DTC sources more.

Sorry.

jdl

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

* [U-Boot-Users] /* inside comment in libfdt.h
  2008-01-03 19:28   ` Jon Loeliger
@ 2008-01-03 19:35     ` Scott Wood
  2008-01-03 19:47     ` Jerry Van Baren
  2008-01-04 10:24     ` Matthias Fuchs
  2 siblings, 0 replies; 11+ messages in thread
From: Scott Wood @ 2008-01-03 19:35 UTC (permalink / raw)
  To: u-boot

Jon Loeliger wrote:
> Oh man....
> 
> OK.  For the record, I'm all for only comments like this:
> 
>     /*
>      *
>      */
> 
> Clearly lax, I'll start enforcing it on the DTC sources more.
> 
> Sorry.

Yes, because putting up with the inability to nest comments is clearly 
worth avoiding something that came from a language with cooties.

-Scott

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

* [U-Boot-Users] /* inside comment in libfdt.h
  2008-01-03 19:28   ` Jon Loeliger
  2008-01-03 19:35     ` Scott Wood
@ 2008-01-03 19:47     ` Jerry Van Baren
  2008-01-03 23:41       ` David Gibson
  2008-01-04 10:24     ` Matthias Fuchs
  2 siblings, 1 reply; 11+ messages in thread
From: Jerry Van Baren @ 2008-01-03 19:47 UTC (permalink / raw)
  To: u-boot

Jon Loeliger wrote:
> On Wed, 2008-01-02 at 07:13, Jerry Van Baren wrote:
> 
>> Yes, nested comments is something that should not be done and should be 
>> fixed.  This was inherited from the original code, although the current 
>> version uses // for the embedded comment which avoids the issue (but 
>> causes "no C++ comments" people to break out in rashes).
>>
>> <http://jdl.com/git_repos/?p=dtc.git;a=blob;f=libfdt/libfdt.h;h=ac0f5c3d1b41a1f6a8a5637a11d3ae4b9b6e6ed4;hb=3e516d961a45a2a410a9dc8f61fbdd62641b5ca0#l547>
> 
> Woah, hey!  That's me!
> 
> Uh...

Stop.  Take a deep breath.  It really wasn't you, just had your 
fingerprints because you touched it last.  I referenced your repository 
as the convenient/canonical repository for dtc/libfdt.

[snip]

> Oh man....
> 
> OK.  For the record, I'm all for only comments like this:
> 
>     /*
>      *
>      */
> 
> Clearly lax, I'll start enforcing it on the DTC sources more.
> 
> Sorry.
> 
> jdl

FWIIW, the misdeed was the sample code embedded inside the comment had a 
(sample) commented line "// add code here" which was done with a C++ // 
comment so that it didn't run afoul of the C compiler's no nested 
comments rule.  A certain dignitary who breaks out in a rash when he 
sees // comments made a "trivial" change to a /* */ comment, which then 
caused the C compiler to throw a hissy fit because it now *was* a nested 
comment.

All in all, a comedy of good intentions.  No Code Was Harmed(R) in the 
making of this patch sequence.

HTH,
gvb

(R)
<http://www.americanhumane.org/site/PageServer?pagename=faqs_film_end_credit>

P.S. :-D, but you knew that already.

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

* [U-Boot-Users] /* inside comment in libfdt.h
  2008-01-03 19:47     ` Jerry Van Baren
@ 2008-01-03 23:41       ` David Gibson
  0 siblings, 0 replies; 11+ messages in thread
From: David Gibson @ 2008-01-03 23:41 UTC (permalink / raw)
  To: u-boot

On Thu, Jan 03, 2008 at 02:47:11PM -0500, Jerry Van Baren wrote:
> Jon Loeliger wrote:
>> On Wed, 2008-01-02 at 07:13, Jerry Van Baren wrote:
>> Oh man....
>> OK.  For the record, I'm all for only comments like this:
>>     /*
>>      *
>>      */
>> Clearly lax, I'll start enforcing it on the DTC sources more.
>> Sorry.
>> jdl
>
> FWIIW, the misdeed was the sample code embedded inside the comment had a 
> (sample) commented line "// add code here" which was done with a C++ // 
> comment so that it didn't run afoul of the C compiler's no nested comments 
> rule.  A certain dignitary who breaks out in a rash when he sees // 
> comments made a "trivial" change to a /* */ comment, which then caused the 
> C compiler to throw a hissy fit because it now *was* a nested comment.
>
> All in all, a comedy of good intentions.  No Code Was Harmed(R) in the 
> making of this patch sequence.

Oh dear.  Yes, I believe those '//' were deliberate to avoid nested
comments.  Think of them as pseudo-code, not C++ if that makes it any
more palatable.

-- 
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] 11+ messages in thread

* [U-Boot-Users] /* inside comment in libfdt.h
  2008-01-03 19:28   ` Jon Loeliger
  2008-01-03 19:35     ` Scott Wood
  2008-01-03 19:47     ` Jerry Van Baren
@ 2008-01-04 10:24     ` Matthias Fuchs
  2008-01-04 12:43       ` Jerry Van Baren
  2008-01-04 16:22       ` Jon Loeliger
  2 siblings, 2 replies; 11+ messages in thread
From: Matthias Fuchs @ 2008-01-04 10:24 UTC (permalink / raw)
  To: u-boot

Hi you guys,

I love reading this list. Thanks Matthias - for making this thread possible.

Wolfgang, what about a 'best thread of the month/year' award.

:-)
Matthias

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

* [U-Boot-Users] /* inside comment in libfdt.h
  2008-01-04 10:24     ` Matthias Fuchs
@ 2008-01-04 12:43       ` Jerry Van Baren
  2008-01-04 16:22       ` Jon Loeliger
  1 sibling, 0 replies; 11+ messages in thread
From: Jerry Van Baren @ 2008-01-04 12:43 UTC (permalink / raw)
  To: u-boot

Matthias Fuchs wrote:
> Hi you guys,
> 
> I love reading this list. Thanks Matthias - for making this thread possible.
> 
> Wolfgang, what about a 'best thread of the month/year' award.
> 
> :-)
> Matthias

Calvin: "I try to make everyone's day a little more surreal."
The Essential Calvin and Hobbes, p152-3
<http://www.calvin-and-hobbes.org/information/quotes>

:-D
gvb

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

* [U-Boot-Users] /* inside comment in libfdt.h
  2008-01-04 10:24     ` Matthias Fuchs
  2008-01-04 12:43       ` Jerry Van Baren
@ 2008-01-04 16:22       ` Jon Loeliger
  1 sibling, 0 replies; 11+ messages in thread
From: Jon Loeliger @ 2008-01-04 16:22 UTC (permalink / raw)
  To: u-boot

On Fri, 2008-01-04 at 04:24, Matthias Fuchs wrote:
> Hi you guys,
> 
> I love reading this list. Thanks Matthias - for making this thread possible.
> 
> Wolfgang, what about a 'best thread of the month/year' award.
> 
> :-)
> Matthias

Man, we're only 3 or 4 days into the year and
I'm already participating in Award Nominatable
Mail Threads!

Sweet.

jdl

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

end of thread, other threads:[~2008-01-04 16:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-02 12:46 [U-Boot-Users] /* inside comment in libfdt.h Matthias Fuchs
2008-01-02 13:13 ` Jerry Van Baren
2008-01-02 13:49   ` Matthias Fuchs
2008-01-03 19:28   ` Jon Loeliger
2008-01-03 19:35     ` Scott Wood
2008-01-03 19:47     ` Jerry Van Baren
2008-01-03 23:41       ` David Gibson
2008-01-04 10:24     ` Matthias Fuchs
2008-01-04 12:43       ` Jerry Van Baren
2008-01-04 16:22       ` Jon Loeliger
2008-01-02 15:01 ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox