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

Remove redundant const keyword #189

Merged
merged 1 commit into from
Aug 8, 2022
Merged

Remove redundant const keyword #189

merged 1 commit into from
Aug 8, 2022

Conversation

bojanserafimov
Copy link

Everything compiles fine on our linux builds, but the compiler in our osx builds emits a incompatible-function-pointer-types warning:

/Users/runner/work/neon/neon//vendor/postgres/contrib/neon/libpagestore.c:438:15: warning: incompatible function pointer types assigning to 'dbsize_hook_type' (aka 'const long (*)(unsigned int)') from 'int64 (Oid)' (aka 'long (unsigned int)') [-Wincompatible-function-pointer-types]
4609
                dbsize_hook = zenith_dbsize;
4610
                            ^ ~~~~~~~~~~~~~
4611
1 warning generated.
4612

To me it looks like the const keyword in typedef const int64 (*dbsize_hook_type) (Oid dbOid); is redundant. An int64 returned as rvalue is const anyway, it's not a pointer. So maybe the compiler on linux ignores the const and compiles this, while the compiler on osx gets confused and emits a warning. I'm not sure if it's only confused in theory, or if it's confused enough to have undefined behavior, so I'd rather correct the definition and remove the const keyword.

I checked that this patch fixes the warning on OSx.

Should we also fail CI on compiler warnings?

@bojanserafimov bojanserafimov merged commit 0a9045c into main Aug 8, 2022
@bojanserafimov bojanserafimov deleted the remove-const branch August 8, 2022 11:25
MMeent pushed a commit that referenced this pull request Aug 18, 2022
lubennikovaav pushed a commit that referenced this pull request Nov 21, 2022
MMeent pushed a commit that referenced this pull request Feb 10, 2023
MMeent pushed a commit that referenced this pull request Feb 10, 2023
MMeent pushed a commit that referenced this pull request May 11, 2023
tristan957 pushed a commit that referenced this pull request Aug 10, 2023
tristan957 pushed a commit that referenced this pull request Nov 8, 2023
tristan957 pushed a commit that referenced this pull request Nov 8, 2023
tristan957 pushed a commit that referenced this pull request Feb 5, 2024
tristan957 pushed a commit that referenced this pull request Feb 5, 2024
tristan957 pushed a commit that referenced this pull request Feb 6, 2024
tristan957 pushed a commit that referenced this pull request May 10, 2024
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.

2 participants