summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;