All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Parse Error
@ 2015-04-07  6:24 Nejc Urbajs
  2015-04-07  6:42 ` Nejc Urbajs
  0 siblings, 1 reply; 11+ messages in thread
From: Nejc Urbajs @ 2015-04-07  6:24 UTC (permalink / raw)
  To: yocto

[-- Attachment #1: Type: text/html, Size: 277 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: Parse Error
@ 2015-04-07  6:47 Nejc Urbajs
  2015-04-07  6:52 ` Nejc Urbajs
  0 siblings, 1 reply; 11+ messages in thread
From: Nejc Urbajs @ 2015-04-07  6:47 UTC (permalink / raw)
  To: ross.burton; +Cc: yocto

[-- Attachment #1: Type: text/html, Size: 410 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Parse Error
@ 2015-04-05 14:43 Rickard Bremer
  2015-04-05 19:38 ` Burton, Ross
  0 siblings, 1 reply; 11+ messages in thread
From: Rickard Bremer @ 2015-04-05 14:43 UTC (permalink / raw)
  To: yocto

[-- Attachment #1: Type: text/plain, Size: 444 bytes --]

Hello,

Since this morning i've been starting up a new build from scratch. I cant figure out howto proceed :

$ bitbake core-image-minimal
ERROR: ParseError at /var/lib/jenkins/workspace/thesis-build-yocto/meta-openembedded/meta-oe/recipes-core/packagegroups/packagegroup-basic.bb:12: Could not inherit file classes/bluetooth.bbclass

Summary: There was 1 ERROR message shown, returning a non-zero exit code.


Best Regards
Rickard

[-- Attachment #2: Type: text/html, Size: 820 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread
* RE: parse error
@ 2004-09-27 15:58 Huber, George K RDECOM CERDEC STCD SRI
  0 siblings, 0 replies; 11+ messages in thread
From: Huber, George K RDECOM CERDEC STCD SRI @ 2004-09-27 15:58 UTC (permalink / raw)
  To: 'Ankit Jain', linux prg

Ankit wrote:

>i could not understand why compiler has put semi colon
>before else due t owhich this parse error comes....

>#define exch(x,y) { int tmp; tmp=x; x=y; y=tmp; }

Remember that macro expansion occures early in the compilation process 
(it occures in step 4 if I remember correctly).  In this case a simple
text replacement is performed.

>However that wouldn't work in some cases. The following code is 
>meant to be an if-statement with two branches:

  if(x>y)
    exch(x,y);          // Branch 1
  else  
    do_something();     // Branch 2

As written, assuming exch() is a function you would have a two branch
if statement.  However, because exch is a macro, this is what is passed
from the c preprocessor to the compiler (because exch(..) is replaced with
the body of the defination:

if(x>y)
  { int tmp; tmp=x; x=y; y=tmp;};
else
  do_something();

and you have a one-brance if statement along with a parse error of an 
unassociated elst statement.  There are two fixes to this problem.  The 
first is to remove the semi-colon after the if statement:

if(x>y)
  exch(x,y)
else
  do_something();

This will expand to what you expect.  This is probably the least 
satisfactory fix.  The better fix would be to wrap the entire macro in a 
do-while loop, leaving the semicolon in place (i.e. this construct allows 
a macro call to be treated like a function).

#define exch(x,y)  do{int tmp; tmp=x; x=y; y=tmp;}while(0)

if(x>y)
  do{int tmp; tmp=x; x=y; y=tmp;}while(0);
else
 ...


You should be aware that while macros are powerful, they can be tricky to 
use.  As an example, consifer what would happen with this statement

exch(a, b+4)

George

^ permalink raw reply	[flat|nested] 11+ messages in thread
* parse error
@ 2004-09-26 14:32 Ankit Jain
  2004-09-25  6:29 ` Elias Athanasopoulos
  0 siblings, 1 reply; 11+ messages in thread
From: Ankit Jain @ 2004-09-26 14:32 UTC (permalink / raw)
  To: linux prg

hi

i could not understand why compiler has put semi colon
before else due t owhich this parse error comes....

thanks

  
#define exch(x,y) { int tmp; tmp=x; x=y; y=tmp; }

However that wouldn't work in some cases. The
following code is meant to be an if-statement with two
branches:

  if(x>y)
    exch(x,y);          // Branch 1
  else  
    do_something();     // Branch 2

But it would be interpreted as an if-statement with
only one branch:

  if(x>y) {                     // Single-branch
if-statement!!!
    int tmp;            // The one and only branch
consists
    tmp = x;            // of the block.
    x = y;
    y = tmp;
  }
  ;                             // empty statement
  else                  // ERROR!!! "parse error
before else"
    do_something();


________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html

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

end of thread, other threads:[~2015-04-07  6:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-07  6:24 Parse Error Nejc Urbajs
2015-04-07  6:42 ` Nejc Urbajs
  -- strict thread matches above, loose matches on Subject: below --
2015-04-07  6:47 Nejc Urbajs
2015-04-07  6:52 ` Nejc Urbajs
2015-04-05 14:43 Rickard Bremer
2015-04-05 19:38 ` Burton, Ross
2004-09-27 15:58 parse error Huber, George K RDECOM CERDEC STCD SRI
2004-09-26 14:32 Ankit Jain
2004-09-25  6:29 ` Elias Athanasopoulos
2004-09-28  6:14   ` Jan-Benedict Glaw
2004-09-26 22:51     ` Elias Athanasopoulos

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.