summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-08-25 09:11:25 -0400
committerGitHub <noreply@github.com>2021-08-25 09:11:25 -0400
commitcc4f8bc65e7dfc6673b83645b2f323bf555088e8 (patch)
tree366395042e966b3f027ddcc96d5b0f10c915f396
parentc8f4b5699ad0e7f57f0c0b82c1149efc0926e083 (diff)
parent40f3702cb19410afaaef1772a9174029db2fef21 (diff)
downloadlibgit2-cc4f8bc65e7dfc6673b83645b2f323bf555088e8.tar.gz
Merge pull request #6005 from boretrk/c11-warnings
C11 warnings
-rw-r--r--CMakeLists.txt1
-rw-r--r--src/hash.c10
-rw-r--r--src/hash.h2
3 files changed, 7 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ff3411928..96bdb4cf0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -233,6 +233,7 @@ ELSE ()
enable_warnings(unused-const-variable)
enable_warnings(unused-function)
enable_warnings(int-conversion)
+ enable_warnings(c11-extensions)
# MinGW uses gcc, which expects POSIX formatting for printf, but
# uses the Windows C library, which uses its own format specifiers.
diff --git a/src/hash.c b/src/hash.c
index d33423660..5a7278e42 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -16,7 +16,7 @@ int git_hash_ctx_init(git_hash_ctx *ctx)
{
int error;
- if ((error = git_hash_sha1_ctx_init(&ctx->sha1)) < 0)
+ if ((error = git_hash_sha1_ctx_init(&ctx->ctx.sha1)) < 0)
return error;
ctx->algo = GIT_HASH_ALGO_SHA1;
@@ -28,7 +28,7 @@ void git_hash_ctx_cleanup(git_hash_ctx *ctx)
{
switch (ctx->algo) {
case GIT_HASH_ALGO_SHA1:
- git_hash_sha1_ctx_cleanup(&ctx->sha1);
+ git_hash_sha1_ctx_cleanup(&ctx->ctx.sha1);
return;
default:
/* unreachable */ ;
@@ -39,7 +39,7 @@ int git_hash_init(git_hash_ctx *ctx)
{
switch (ctx->algo) {
case GIT_HASH_ALGO_SHA1:
- return git_hash_sha1_init(&ctx->sha1);
+ return git_hash_sha1_init(&ctx->ctx.sha1);
default:
/* unreachable */ ;
}
@@ -51,7 +51,7 @@ int git_hash_update(git_hash_ctx *ctx, const void *data, size_t len)
{
switch (ctx->algo) {
case GIT_HASH_ALGO_SHA1:
- return git_hash_sha1_update(&ctx->sha1, data, len);
+ return git_hash_sha1_update(&ctx->ctx.sha1, data, len);
default:
/* unreachable */ ;
}
@@ -63,7 +63,7 @@ int git_hash_final(git_oid *out, git_hash_ctx *ctx)
{
switch (ctx->algo) {
case GIT_HASH_ALGO_SHA1:
- return git_hash_sha1_final(out, &ctx->sha1);
+ return git_hash_sha1_final(out, &ctx->ctx.sha1);
default:
/* unreachable */ ;
}
diff --git a/src/hash.h b/src/hash.h
index 017bb286c..87305cc79 100644
--- a/src/hash.h
+++ b/src/hash.h
@@ -27,7 +27,7 @@ typedef enum {
typedef struct git_hash_ctx {
union {
git_hash_sha1_ctx sha1;
- };
+ } ctx;
git_hash_algo_t algo;
} git_hash_ctx;