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

Fix various unsigned to signed comparison warnings. #17212

Conversation

benjaminp
Copy link
Contributor

@benjaminp benjaminp commented Jun 21, 2024

GCC aggressively emit warnings when comparing unsigned and signed integer types, which causes failures under protobuf's -Werror default. We can fix these often by switching to iterators, but sometimes it's easiest to add a cast or switch a variable type.

@benjaminp benjaminp requested review from a team as code owners June 21, 2024 22:49
@benjaminp benjaminp requested review from googleberg and deannagarcia and removed request for a team June 21, 2024 22:49
@benjaminp benjaminp force-pushed the unsigned-size-comparison-warnings branch from 420a4a4 to 23d306d Compare June 21, 2024 22:51
Copy link

We triage inactive PRs and issues in order to make it easier to find active work. If this PR should remain active, please add a comment.

This PR is labeled inactive because the last activity was over 90 days ago. This PR will be closed and archived after 14 additional days without activity.

@github-actions github-actions bot added the inactive Denotes the issue/PR has not seen activity in the last 90 days. label Sep 20, 2024
@tonyliaoss
Copy link
Member

Hi Benjamin,

Apologies for getting to this PR relatively late.

We're okay with accepting the range-based for loop changes. For anything else, we're probably not going to hold ourselves to maintain signed/unsigned casting -- internally we build with those warnings turned off.

GCC aggressively emit warnings when comparing unsigned and signed integer types, which causes failures under protobuf's -Werror default. We can fix these often by switching to iterators, but sometimes it's easiest to add a cast or switch a variable type.
@benjaminp benjaminp force-pushed the unsigned-size-comparison-warnings branch from 23d306d to 4b3c9c2 Compare September 20, 2024 20:37
@benjaminp
Copy link
Contributor Author

Okay, I've rebased and removed any lines that added static_cast<size_t>.

@github-actions github-actions bot removed the inactive Denotes the issue/PR has not seen activity in the last 90 days. label Sep 21, 2024
@tonyliaoss tonyliaoss self-requested a review September 27, 2024 00:45
@tonyliaoss tonyliaoss added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Sep 27, 2024
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Sep 27, 2024
copybara-service bot pushed a commit that referenced this pull request Sep 30, 2024
GCC aggressively emit warnings when comparing unsigned and signed integer types, which causes failures under protobuf's -Werror default. We can fix these often by switching to iterators, but sometimes it's easiest to add a cast or switch a variable type.

Closes #17212

COPYBARA_INTEGRATE_REVIEW=#17212 from benjaminp:unsigned-size-comparison-warnings 4b3c9c2
FUTURE_COPYBARA_INTEGRATE_REVIEW=#17212 from benjaminp:unsigned-size-comparison-warnings 4b3c9c2
PiperOrigin-RevId: 680638328
copybara-service bot pushed a commit that referenced this pull request Sep 30, 2024
GCC aggressively emit warnings when comparing unsigned and signed integer types, which causes failures under protobuf's -Werror default. We can fix these often by switching to iterators, but sometimes it's easiest to add a cast or switch a variable type.

Closes #17212

COPYBARA_INTEGRATE_REVIEW=#17212 from benjaminp:unsigned-size-comparison-warnings 4b3c9c2
FUTURE_COPYBARA_INTEGRATE_REVIEW=#17212 from benjaminp:unsigned-size-comparison-warnings 4b3c9c2
PiperOrigin-RevId: 680638328
copybara-service bot pushed a commit that referenced this pull request Sep 30, 2024
GCC aggressively emit warnings when comparing unsigned and signed integer types, which causes failures under protobuf's -Werror default. We can fix these often by switching to iterators, but sometimes it's easiest to add a cast or switch a variable type.

Closes #17212

COPYBARA_INTEGRATE_REVIEW=#17212 from benjaminp:unsigned-size-comparison-warnings 4b3c9c2
FUTURE_COPYBARA_INTEGRATE_REVIEW=#17212 from benjaminp:unsigned-size-comparison-warnings 4b3c9c2
PiperOrigin-RevId: 680638328
copybara-service bot pushed a commit that referenced this pull request Sep 30, 2024
GCC aggressively emit warnings when comparing unsigned and signed integer types, which causes failures under protobuf's -Werror default. We can fix these often by switching to iterators, but sometimes it's easiest to add a cast or switch a variable type.

Closes #17212

COPYBARA_INTEGRATE_REVIEW=#17212 from benjaminp:unsigned-size-comparison-warnings 4b3c9c2
FUTURE_COPYBARA_INTEGRATE_REVIEW=#17212 from benjaminp:unsigned-size-comparison-warnings 4b3c9c2
PiperOrigin-RevId: 680638328
copybara-service bot pushed a commit that referenced this pull request Oct 1, 2024
GCC aggressively emit warnings when comparing unsigned and signed integer types, which causes failures under protobuf's -Werror default. We can fix these often by switching to iterators, but sometimes it's easiest to add a cast or switch a variable type.

Closes #17212

COPYBARA_INTEGRATE_REVIEW=#17212 from benjaminp:unsigned-size-comparison-warnings 4b3c9c2
FUTURE_COPYBARA_INTEGRATE_REVIEW=#17212 from benjaminp:unsigned-size-comparison-warnings 4b3c9c2
PiperOrigin-RevId: 680638328
copybara-service bot pushed a commit that referenced this pull request Oct 1, 2024
GCC aggressively emit warnings when comparing unsigned and signed integer types, which causes failures under protobuf's -Werror default. We can fix these often by switching to iterators, but sometimes it's easiest to add a cast or switch a variable type.

Closes #17212

COPYBARA_INTEGRATE_REVIEW=#17212 from benjaminp:unsigned-size-comparison-warnings 4b3c9c2
FUTURE_COPYBARA_INTEGRATE_REVIEW=#17212 from benjaminp:unsigned-size-comparison-warnings 4b3c9c2
PiperOrigin-RevId: 680638328
copybara-service bot pushed a commit that referenced this pull request Oct 1, 2024
GCC aggressively emit warnings when comparing unsigned and signed integer types, which causes failures under protobuf's -Werror default. We can fix these often by switching to iterators, but sometimes it's easiest to add a cast or switch a variable type.

Closes #17212

COPYBARA_INTEGRATE_REVIEW=#17212 from benjaminp:unsigned-size-comparison-warnings 4b3c9c2
FUTURE_COPYBARA_INTEGRATE_REVIEW=#17212 from benjaminp:unsigned-size-comparison-warnings 4b3c9c2
PiperOrigin-RevId: 680638328
copybara-service bot pushed a commit that referenced this pull request Oct 2, 2024
GCC aggressively emit warnings when comparing unsigned and signed integer types, which causes failures under protobuf's -Werror default. We can fix these often by switching to iterators, but sometimes it's easiest to add a cast or switch a variable type.

Closes #17212

COPYBARA_INTEGRATE_REVIEW=#17212 from benjaminp:unsigned-size-comparison-warnings 4b3c9c2
FUTURE_COPYBARA_INTEGRATE_REVIEW=#17212 from benjaminp:unsigned-size-comparison-warnings 4b3c9c2
PiperOrigin-RevId: 680638328
@copybara-service copybara-service bot closed this in 67de087 Oct 2, 2024
@benjaminp benjaminp deleted the unsigned-size-comparison-warnings branch October 2, 2024 01:56
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.

3 participants