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

Handle Duff's device and other unstructured switch statements #459

Merged
merged 5 commits into from
Nov 9, 2022

Commits on Sep 27, 2022

  1. Revised passing of options to Parse.preprocessed_file

    Instead of passing a string that encodes the optional source-to-source
    transformations to perform, just pass one optional, named argument for
    each transformation.  It is clearer and easier to extend this way.
    xavierleroy committed Sep 27, 2022
    Configuration menu
    Copy the full SHA
    efc51af View commit details
    Browse the repository at this point in the history

Commits on Oct 29, 2022

  1. Unblock: never put debug info before a label

    This ensures that normalized switch statements remain normalized.
    However, if the label and the labeled statement are on different lines,
    add an extra line directive corresponding to the label before the labeled
    statement.
    xavierleroy committed Oct 29, 2022
    Configuration menu
    Copy the full SHA
    dfc6b66 View commit details
    Browse the repository at this point in the history
  2. Handle unstructured 'switch' statements such as Duff's device

    - New elaboration pass: SwitchNorm
        - recognizes structured 'switch' statements and puts them in a
          normalized form;
        - if selected, transforms unstructured 'switch' statements into a
          structured switch with goto actions + the original switch body
          with appropriate labels and gotos.
    
    - C2C treatment of 'switch' statements is simplified accordingly.
    
    - New language support option `-funstructured-switch`.
    
    - Some tests were added (test/regression/switch3.c).
    xavierleroy committed Oct 29, 2022
    Configuration menu
    Copy the full SHA
    a1dabb4 View commit details
    Browse the repository at this point in the history

Commits on Nov 3, 2022

  1. Update man-page for -funstructured-switch (also for new -std opti…

    …on, `-finput-charset` and other small fixes)
    m-schmidt committed Nov 3, 2022
    Configuration menu
    Copy the full SHA
    8eadd08 View commit details
    Browse the repository at this point in the history
  2. Ignore debug statements before the first case of a switch

    This can occur in debug mode if there are declarations before the
    first case, as in
    ```
      switch (x) {
        int x;
       case 0:
        ...
      }
    ```
    Without this commit, the code above is a structured switch if -g is not given,
    and a non-structured switch if -g is given.
    
    Co-authored-by: Michael Schmidt <github@mschmidt.me>
    xavierleroy and m-schmidt committed Nov 3, 2022
    Configuration menu
    Copy the full SHA
    5a9f24b View commit details
    Browse the repository at this point in the history