Bump C std version to 11, and use static_assert
This commit is contained in:
parent
502ad833fc
commit
d4951e0a70
2
Makefile
2
Makefile
@ -2,7 +2,7 @@ MultiThread = Yes
|
||||
|
||||
PROGNAME = torrent-verify
|
||||
CC = cc
|
||||
CFLAGS = -Wall -std=gnu99 -I./subm/heapless-bencode -Werror -O3
|
||||
CFLAGS = -Wall -std=gnu11 -I./subm/heapless-bencode -Werror -O3
|
||||
CPPFLAGS = -DPROGRAM_NAME='"$(PROGNAME)"' -DBUILD_INFO \
|
||||
-DBUILD_HASH="\"`git rev-parse --abbrev-ref HEAD` -> `git rev-parse --short HEAD`\"" -DBUILD_DATE="\"`date -I`\""
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "metainfo.h"
|
||||
#include "verify.h"
|
||||
#include "showinfo.h"
|
||||
@ -11,6 +12,8 @@
|
||||
#define PROGRAM_NAME "torrent-verify"
|
||||
#endif
|
||||
|
||||
static_assert((sizeof(long long) >= 8), "Size of long long is less than 8, cannot compile");
|
||||
|
||||
void usage() {
|
||||
fprintf(stderr, "Usage: " PROGRAM_NAME " [-h | -i | -s] [-n] [-v data_path] [--] .torrent_file...\n");
|
||||
exit(EXIT_FAILURE);
|
||||
@ -43,11 +46,6 @@ BUILD_HASH " (" BUILD_DATE ")\n"
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if (sizeof(long int) < 8) {
|
||||
fprintf(stderr, "long int is less than 8 bytes. Create an issue please.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (opts_parse(argc, argv) == -1)
|
||||
usage();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user