summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-07-08 23:31:05 +0200
committerAki <please@ignore.pl>2022-07-08 23:32:33 +0200
commit976260d846b1c6512f310766798b3fa1cd2e680f (patch)
tree24f0407a0930b9c783461b7bf876f894cff2f5f2
parent9e041568f6269e259009efc3fb147a7e679e5153 (diff)
downloadpkgrel-976260d846b1c6512f310766798b3fa1cd2e680f.zip
pkgrel-976260d846b1c6512f310766798b3fa1cd2e680f.tar.gz
pkgrel-976260d846b1c6512f310766798b3fa1cd2e680f.tar.bz2
Enabled warnings and optimizations in default configuration
-rw-r--r--Makefile5
-rw-r--r--pkgrel.c8
2 files changed, 10 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 4fc93e6..1b01e85 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
-CFLAGS=`pkg-config --cflags libgit2`
-LDLIBS=`pkg-config --libs libgit2`
+CFLAGS?=-Wall -Wextra -Wpedantic -O3
+CFLAGS+=`pkg-config --cflags libgit2`
+LDLIBS+=`pkg-config --libs libgit2`
PREFIX?=/usr/local
BINDIR?=$(PREFIX)/bin
diff --git a/pkgrel.c b/pkgrel.c
index 89ce797..ecbfcea 100644
--- a/pkgrel.c
+++ b/pkgrel.c
@@ -94,6 +94,8 @@ try_git(const int err, const char* msg)
int
match_line(const git_diff_delta* delta, const git_diff_hunk* hunk, const git_diff_line* line, void* payload)
{
+ (void) delta;
+ (void) hunk;
static const char* const PKGVER = "pkgver";
static const size_t PKGVER_LEN = 6;
enum match_result* match = (enum match_result*) payload;
@@ -105,7 +107,6 @@ match_line(const git_diff_delta* delta, const git_diff_hunk* hunk, const git_dif
else if (MATCH_RESULT_PKGVER != *match)
*match = MATCH_RESULT_ANYTHING;
break;
- default:
}
return 0;
}
@@ -114,6 +115,8 @@ match_line(const git_diff_delta* delta, const git_diff_hunk* hunk, const git_dif
int
main(int argc, char* argv[])
{
+ (void) argc;
+ (void) argv;
FILE* file = fopen("PKGBUILD", "r");
if (NULL == file) {
dprintf(2, "PKGBUILD not found or cannot be opened\n");
@@ -123,7 +126,10 @@ main(int argc, char* argv[])
git_libgit2_init();
git_repository* repo = NULL;
try_git(git_repository_open_ext(&repo, NULL, GIT_REPOSITORY_OPEN_FROM_ENV, NULL), "opening repo");
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
+#pragma GCC diagnostic pop
diffopts.pathspec.strings = (char*[1]){relative_path_in_current_dir(repo, "PKGBUILD")};
diffopts.pathspec.count = 1;
diffopts.flags |= GIT_DIFF_SHOW_UNTRACKED_CONTENT;