Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address lex.yy.c compiler warnings #370

Merged
merged 4 commits into from
Mar 21, 2024

Conversation

mabruzzo
Copy link
Contributor

@mabruzzo mabruzzo commented Feb 28, 2024

Pull request summary

I made 2 tweaks to the lexer code in order to address compiler warnings

Detailed Description

The specific changes include:

  • I addressed the warning that the yyunput function is defined, but unused
    by adding the nounput option to parse.l
  • I addressed compiler warnings about strncpy the case when we try to
    copy a line of text into our line buffer, but the line is larger than our
    line buffer.
    • I vaguely recall that there may be some safeguards in other areas of
      the code that should stop the program before we execute the code that
      the compiler was warning about.
    • But just in case we do encounter this scenario, I added logic to
      print out a warning to explain to users what is happening. Even if
      this code is never executed, it should make things a little more clear
      for future readers of parse.l.

Finally, I used flex to regenerate lex.yy.c from parse.l

- addressed the warning that the yyunput function is defined, but unused
by adding the nounput option to parse.l
- I adopted a more complete solution for addressing the compiler warning
  from the prior commit.
  - Essentially, the compiler was warning about the bugs in the case where
    we encounter a line longer than our linebuffer.
  - I vaguely recall that there may be some safeguards in other areas of
    the code that should stop the program before we execute the code that
    the compiler was warning about.
  - But just in case we do encounter this scenario, I added logic to
    print out a warning to explain to users what is happening. Even if
    this doesn't happen, it should make things a little more clear for
    future readers of `parse.l`.

Finally, I used flex to regenerate `lex.yy.c` from `parse.l`
Copy link
Contributor

@jobordner jobordner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, free to merge.

@mabruzzo mabruzzo merged commit 7a8ecbc into enzo-project:main Mar 21, 2024
7 checks passed
@mabruzzo mabruzzo deleted the lex.yy.c-compiler-warnings branch March 21, 2024 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants