FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-106797: Remove warning logs from Python/generated_cases.c.h by corona10 · Pull Request #106798 · python/cpython · GitHub

/ cpython Public

gh-106797: Remove warning logs from Python/generated_cases.c.h - #106798

Merged
corona10 merged 5 commits into
python:mainfrom
corona10:gh-106797
Jul 17, 2023
Merged

gh-106797: Remove warning logs from Python/generated_cases.c.h#106798
corona10 merged 5 commits into
python:mainfrom
corona10:gh-106797

Conversation

corona10 commented Jul 16, 2023
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

Copy link
Copy Markdown
Member Author
In file included from Python/ceval.c:770:
Python/generated_cases.c.h:3437:48: warning: code will never be executed [-Wunreachable-code]
            if (0) { stack_pointer[-(1 + 0)] = res2; }
                                               ^~~~
Python/generated_cases.c.h:3437:17: note: silence by adding parentheses to mark code as explicitly dead
            if (0) { stack_pointer[-(1 + 0)] = res2; }
                ^
                /* DISABLES CODE */ ( )
Python/generated_cases.c.h:3415:48: warning: code will never be executed [-Wunreachable-code]
            if (0) { stack_pointer[-(1 + 0)] = res2; }
                                               ^~~~
Python/generated_cases.c.h:3415:17: note: silence by adding parentheses to mark code as explicitly dead
            if (0) { stack_pointer[-(1 + 0)] = res2; }
                ^
                /* DISABLES CODE */ ( )
clang -c -fno-strict-overflow -Wsign-compa

Warning logs are reduced, but not sure this is a safe way.

Copy link
Copy Markdown
Member

The if (0) and if (1) can easily be simplified too. It's these lines in assign():

            stmt = f"{dst.name} = {cast}{src.name};"
            if src.cond:
                stmt = f"if ({src.cond}) {{ {stmt} }}"
            self.emit(stmt)

corona10 changed the title gh-106797: Reduce warning logs from Python/generated_cases.c.h gh-106797: Remove warning logs from Python/generated_cases.c.h Jul 16, 2023

corona10 commented Jul 16, 2023
edited
Loading

Copy link
Copy Markdown
Member Author

@gvanrossum

It works and it will introduce another warning :)
This issue should be solved separately

Python/generated_cases.c.h:3394:23: warning: unused variable 'res2' [-Wunused-variable]
            PyObject *res2 = NULL;

corona10 requested a review from gvanrossum July 16, 2023 04:58

corona10 commented Jul 16, 2023
edited
Loading

Copy link
Copy Markdown
Member Author

It looks like it needs a keyword for res2 if (0) case, which unused keyword can not replace.

corona10 changed the title gh-106797: Remove warning logs from Python/generated_cases.c.h gh-106797: Reduce warning logs from Python/generated_cases.c.h Jul 16, 2023
corona10 changed the title gh-106797: Reduce warning logs from Python/generated_cases.c.h gh-106797: Remove warning logs from Python/generated_cases.c.h Jul 16, 2023

corona10 commented Jul 16, 2023
edited
Loading

Copy link
Copy Markdown
Member Author

It looks like it needs a keyword for res2 if (0) case, which unused keyword can not replace.

I solved the issue by using the same approach which was used for assigning rule :)

gvanrossum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks -- that should do it, merge it!

corona10 merged commit 48956cc into python:main Jul 17, 2023
corona10 deleted the gh-106797 branch July 17, 2023 00:09
gvanrossum added a commit that referenced this pull request Jul 18, 2023
These repair nits I found in PR gh-106798 (issue gh-106797) and in PR gh-106716 (issue gh-106706).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL