Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 427031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:32:20+00:00 2026-05-12T19:32:20+00:00

When compiling my project with gcc and the -Wall option, I get a warning

  • 0

When compiling my project with gcc and the -Wall option, I get a warning about a statement with no effect in the non-existant last line of my flex file:

Warning:

gcc -Wall -O0 -ggdb3 -DNOSUDO -DJOBC -DDEBUG -c lex.yy.c
tokenizer.l: In function ‘yylex’:
tokenizer.l:179: warning: statement with no effect

Shell Command:

$ wc -l tokenizer.l
178 tokenizer.l

Last part of lex file:

; {
    return SEMI;
}

Anyone know why I might be getting this warning?

If I suppress all #line Directives, the error is:

lex.yy.c: In function ‘yylex’:
lex.yy.c:1021: warning: statement with no effect

Which refers to the ECHO line in:

case 30:
YY_RULE_SETUP
ECHO;
    YY_BREAK
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(inQuote):
case YY_STATE_EOF(inWord):
    yyterminate();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T19:32:21+00:00Added an answer on May 12, 2026 at 7:32 pm

    In general, you’ll get that error from any lex rule that has an unconditional ‘return’ in it, because flex ends up generating code that looks like (after macro expansion):

    case xxx:
        return SEMI;
        break;
    

    The problem being that the ‘break’ is unreachable. It needs to be there in case your rule does not return (so the code won’t fall through to the code for the next token, but will instead go on to recognize the next token.) Flex isn’t smart enough to actually parse your rule code and do flow analysis to determine when the break is unneeded, so it just always puts it there. In general, using -Wall on the output of flex (or bison) will give you lots of warnings like this…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running my first project that I'm compiling with flex builder. Before I used
When compiling my C++ .Net application I get 104 warnings of the type: Warning
I am receiving the following warning when compiling a Qt project, but ONLY on
I get the following error when compiling my project for the device, but not
I have the ActiveMQ-CPP 2.2.1 Visual Studio 2005 project compiling and running. In the
I've been hitting a java.lang.OutOfMemoryError: PermGen error when compiling a project with ant under
After compiling a simple C++ project using Visual Studio 2008 on vista, everything runs
I'm getting an error compiling my VSTO (Visual Studio Tools for Office) project in
somehow I managed to screw up my XCode project settings when compiling for the
Possible Duplicate: compiling project with jdk1.5 using maven2 I am trying to build java

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.