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 an enum comparison that was blowing up jenkins. #1901

Merged
merged 1 commit into from May 28, 2020

Conversation

Labels
None yet
Projects
None yet
3 participants
@asn-d6
Copy link
Member

@asn-d6 asn-d6 commented May 21, 2020

The warning was:
11:23:10 ../tor/src/feature/hs/hs_service.c: In function 'log_cant_upload_desc':
11:23:10 ../tor/src/feature/hs/hs_service.c:3118:3: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
See #34254 for more info.

I guess this means that gcc assigned an unsigned type to the
log_desc_upload_reason_t enum and it warned if we compared it against 0...

For now I think it's simpler to remove that check instead of turning the enum
to a signed type, or trying to hack it some other way.

From what it seems, enum is up to the compiler on whether it's signed/unsigned:
https://stackoverflow.com/questions/159034/are-c-enums-signed-or-unsigned

The warning was:
    11:23:10 ../tor/src/feature/hs/hs_service.c: In function 'log_cant_upload_desc':
    11:23:10 ../tor/src/feature/hs/hs_service.c:3118:3: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
See #34254 for more info.

I guess this means that gcc assigned an unsigned type to the
`log_desc_upload_reason_t` enum and it warned if we compared it against 0...

For now I think it's simpler to remove that check instead of turning the enum
to a signed type, or trying to hack it some other way.

From what it seems, enum is up to the compiler on whether it's signed/unsigned:
     https://stackoverflow.com/questions/159034/are-c-enums-signed-or-unsigned
@coveralls
Copy link

@coveralls coveralls commented May 21, 2020

Pull Request Test Coverage Report for Build 8981

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.02%) to 64.217%

Files with Coverage Reduction New Missed Lines %
src/feature/hs/hs_common.c 1 84.48%
Totals Coverage Status
Change from base Build 8974: 0.02%
Covered Lines: 50945
Relevant Lines: 79333

💛 - Coveralls

@torproject-pusher torproject-pusher merged commit 5922087 into torproject:master May 28, 2020
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment