Skip to content

Conversation

@corona10
Copy link
Member

@corona10corona10 commented Jul 16, 2023

@corona10
Copy link
MemberAuthor

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.

@gvanrossum
Copy link
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};"ifsrc.cond: stmt=f"if ({src.cond}){{{stmt} }}"self.emit(stmt)

@corona10corona10 changed the title gh-106797: Reduce warning logs from Python/generated_cases.c.hgh-106797: Remove warning logs from Python/generated_cases.c.hJul 16, 2023
@corona10
Copy link
MemberAuthor

corona10 commented Jul 16, 2023

@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; 

@corona10corona10 requested a review from gvanrossumJuly 16, 2023 04:58
@corona10
Copy link
MemberAuthor

corona10 commented Jul 16, 2023

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

@corona10corona10 changed the title gh-106797: Remove warning logs from Python/generated_cases.c.hgh-106797: Reduce warning logs from Python/generated_cases.c.hJul 16, 2023
@corona10corona10 changed the title gh-106797: Reduce warning logs from Python/generated_cases.c.hgh-106797: Remove warning logs from Python/generated_cases.c.hJul 16, 2023
@corona10
Copy link
MemberAuthor

corona10 commented Jul 16, 2023

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 :)

Copy link
Member

@gvanrossumgvanrossum left a comment

Choose a reason for hiding this comment

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

Thanks -- that should do it, merge it!

@corona10corona10 merged commit 48956cc into python:mainJul 17, 2023
@corona10corona10 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).
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@corona10@gvanrossum@bedevere-bot