-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
lib: fix gcc warning in certain debug builds #13800
Closed
Closed
Conversation
This file contains 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
``` curl/lib/http_aws_sigv4.c:536:10: error: 'clock' may be used uninitialized [-Werror=maybe-uninitialized] 536 | time_t clock; | ^~~~~ ``` Ref: https://github.com/curl/curl/actions/runs/9158755123/job/25177765000#step:13:79 Closes #xxxxx
2 tasks
vszakats
added a commit
that referenced
this pull request
May 27, 2024
…uilds It affected cmake-unity shared-curltool curldebug mingw-w64 gcc builds when building the `testdeps` target. Apply the solution already used in `lib/base64.c` and `lib/dynbuf.c` to fix it. Also update an existing GHA CI job to test the issue fixed. ``` In file included from curl/lib/version_win32.c:35, from curl/_bld/src/CMakeFiles/curl.dir/Unity/unity_0_c.c:145: curl/lib/memdebug.h:52:14: error: redundant redeclaration of 'curl_dbg_logfile' [-Werror=redundant-decls] 52 | extern FILE *curl_dbg_logfile; | ^~~~~~~~~~~~~~~~ In file included from curl/src/slist_wc.c:32, from curl/_bld/src/CMakeFiles/curl.dir/Unity/unity_0_c.c:4: curl/lib/memdebug.h:52:14: note: previous declaration of 'curl_dbg_logfile' with type 'FILE *' {aka 'struct _iobuf *'} 52 | extern FILE *curl_dbg_logfile; | ^~~~~~~~~~~~~~~~ curl/lib/memdebug.h:55:44: error: redundant redeclaration of 'curl_dbg_malloc' [-Werror=redundant-decls] 55 | CURL_EXTERN ALLOC_FUNC ALLOC_SIZE(1) void *curl_dbg_malloc(size_t size, | ^~~~~~~~~~~~~~~ curl/lib/memdebug.h:55:44: note: previous declaration of 'curl_dbg_malloc' with type 'void *(size_t, int, const char *)' {aka 'void *(long long unsigned int, int, const char *)'} 55 | CURL_EXTERN ALLOC_FUNC ALLOC_SIZE(1) void *curl_dbg_malloc(size_t size, | ^~~~~~~~~~~~~~~ [...] curl/lib/memdebug.h:110:17: error: redundant redeclaration of 'curl_dbg_fclose' [-Werror=redundant-decls] 110 | CURL_EXTERN int curl_dbg_fclose(FILE *file, int line, const char *source); | ^~~~~~~~~~~~~~~ curl/lib/memdebug.h:110:17: note: previous declaration of 'curl_dbg_fclose' with type 'int(FILE *, int, const char *)' {aka 'int(struct _iobuf *, int, const char *)'} 110 | CURL_EXTERN int curl_dbg_fclose(FILE *file, int line, const char *source); | ^~~~~~~~~~~~~~~ ``` Ref: https://ci.appveyor.com/project/curlorg/curl/builds/49840554/job/a4aoet17e9qnqx1a#L362 After: https://ci.appveyor.com/project/curlorg/curl/builds/49843735/job/hbo2uah2vj0ns523 Ref: #13689 (CI testing this PR with `DEBUGBUILD`/`CURLDEBUG`/shared-static combinations) Depends-on: #13694 Depends-on: #13800 Closes #13705
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
May 28, 2024
Following up on previous occurrences showing up as gcc warnings, replace the remaining few `time(&var)` calls with `= time(NULL)`, though these aren't specifically causing compiler warnings. All of these are in the TFTP client code (`lib/tftp.c`), except one which is in a debug branch in `lib/http_aws_sigv4`. What's unexplainable is that this patch seems to stabilize the TFTP tests regularly hanging or going into an infinite loop on GHA windows workflows with MSYS2, mingw-w64 and MSVC (Cygwin is unaffected): curl#13599 (comment) I figure it's something worth trying even if it turns out to be a dead end. `time()` docs: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/time-time32-time64 https://manpages.debian.org/bookworm/manpages-dev/time.2.en.html Follow-up to 58ca0a2 curl#13800 Follow-up to d0728c9 curl#13643 Closes #xxxxx
vszakats
added a commit
that referenced
this pull request
May 29, 2024
Following up on previous occurrences showing up as gcc warnings, replace the remaining `time(&var)` calls with `var = time(NULL)`, though these aren't specifically causing compiler warnings. These are in the TFTP client code (`lib/tftp.c`), except one which is in a debug branch in `lib/http_aws_sigv4.c`. What's unexplainable is that this patch seems to mitigate TFTP tests often hanging or going into an infinite loop on GHA windows workflows with MSYS2, mingw-w64 and MSVC (Cygwin is unaffected): #13599 (comment) TFTP hangs did not entirely disappear though, so could be unrelated. `time()` docs: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/time-time32-time64 https://manpages.debian.org/bookworm/manpages-dev/time.2.en.html Follow-up to 58ca0a2 #13800 Follow-up to d0728c9 #13643 Closes #13815
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ref: https://github.com/curl/curl/actions/runs/9158755123/job/25177765000#step:13:79
Cherry-picked from #13718
Closes #13800