mirror of https://github.com/flysand7/ciabatta.git
Compile with warnings and fix some warnings
This commit is contained in:
parent
2091450e32
commit
605412d34c
2
bake.cmd
2
bake.cmd
|
@ -1,7 +1,7 @@
|
||||||
@echo off
|
@echo off
|
||||||
setlocal enabledelayedexpansion
|
setlocal enabledelayedexpansion
|
||||||
|
|
||||||
set CIABATTA_OPTIONS=-Iinc -g -gcodeview -nodefaultlibs -D_CRT_SECURE_NO_WARNINGS
|
set CIABATTA_OPTIONS=-Iinc -Wall -g -gcodeview -nodefaultlibs -D_CRT_SECURE_NO_WARNINGS
|
||||||
set PLATFORM=win32
|
set PLATFORM=win32
|
||||||
if NOT "%1"=="fast" (
|
if NOT "%1"=="fast" (
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ inline static int FMT_FUNC_NAME (void *ctx, OutputFunc out, const FMT_CHAR_TYPE
|
||||||
|
|
||||||
if (isdigit(*fmt)) {
|
if (isdigit(*fmt)) {
|
||||||
// just a small atoi
|
// just a small atoi
|
||||||
|
// TODO: handle overflow, just in case(?)
|
||||||
while (isdigit(*fmt)) {
|
while (isdigit(*fmt)) {
|
||||||
precision *= 10u;
|
precision *= 10u;
|
||||||
precision += (*fmt - '0');
|
precision += (*fmt - '0');
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#include <_platform.h>
|
||||||
|
|
||||||
#define __STDC_WANT_LIB_EXT1__ 1
|
#define __STDC_WANT_LIB_EXT1__ 1
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ typedef unsigned intu;
|
||||||
#define inrange(start, c, end) ((start) <= (c) && (c) <= (end))
|
#define inrange(start, c, end) ((start) <= (c) && (c) <= (end))
|
||||||
|
|
||||||
static bool isbase(int c, int base) {
|
static bool isbase(int c, int base) {
|
||||||
int val;
|
int val = 0;
|
||||||
if(isdigit(c)) {
|
if(isdigit(c)) {
|
||||||
val = c-'0';
|
val = c-'0';
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ static bool strprefix_i(char const *restrict str, char const *restrict prefix) {
|
||||||
|
|
||||||
// Called only when isbase(c, base) for some base in range
|
// Called only when isbase(c, base) for some base in range
|
||||||
static long todigit(int c) {
|
static long todigit(int c) {
|
||||||
int val;
|
int val = 0;
|
||||||
if(isdigit(c)) {
|
if(isdigit(c)) {
|
||||||
val = c-'0';
|
val = c-'0';
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,7 @@ static intull strtoi_generic(const char *restrict nptr,
|
||||||
intull value = 0;
|
intull value = 0;
|
||||||
int digits_read = 0;
|
int digits_read = 0;
|
||||||
bool is_signed = (coefptr != NULL);
|
bool is_signed = (coefptr != NULL);
|
||||||
|
intl coef = 1;
|
||||||
// Find max{abs(int)}. Signed integers have negative,
|
// Find max{abs(int)}. Signed integers have negative,
|
||||||
// whose absolute value is 1 bigger than int_max.
|
// whose absolute value is 1 bigger than int_max.
|
||||||
intull int_abs_max = int_max;
|
intull int_abs_max = int_max;
|
||||||
|
@ -85,7 +86,6 @@ static intull strtoi_generic(const char *restrict nptr,
|
||||||
++str;
|
++str;
|
||||||
}
|
}
|
||||||
// Parse sign
|
// Parse sign
|
||||||
intl coef = 1;
|
|
||||||
if(is_signed) {
|
if(is_signed) {
|
||||||
if(*str == '-') {
|
if(*str == '-') {
|
||||||
coef = -1;
|
coef = -1;
|
||||||
|
|
|
@ -22,11 +22,9 @@ void *memcpy(void *restrict s1, const void *restrict s2, size_t n) {
|
||||||
|
|
||||||
void *memmove(void *s1, const void *s2, size_t n)
|
void *memmove(void *s1, const void *s2, size_t n)
|
||||||
{
|
{
|
||||||
byte *u1 = s1;
|
|
||||||
byte const *u2 = s2;
|
|
||||||
void *buffer = malloc(n);
|
void *buffer = malloc(n);
|
||||||
strcpy(buffer, s2);
|
memcpy(buffer, s2, n);
|
||||||
strcpy(s1, buffer);
|
memcpy(s1, buffer, n);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
return s1;
|
return s1;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +88,7 @@ int strcmp(const char *s1, const char *s2) {
|
||||||
|
|
||||||
int strncmp(const char *s1, const char *s2, size_t n)
|
int strncmp(const char *s1, const char *s2, size_t n)
|
||||||
{
|
{
|
||||||
int diff;
|
int diff = 0;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
if(n != 0) do {
|
if(n != 0) do {
|
||||||
diff = *s1 - *s2;
|
diff = *s1 - *s2;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "_platform.h"
|
#pragma once
|
||||||
|
|
||||||
int isalnum(int c);
|
int isalnum(int c);
|
||||||
int isalpha(int c);
|
int isalpha(int c);
|
||||||
|
|
|
@ -21,11 +21,10 @@ static size_t count_wide_chars(const wchar_t* str) {
|
||||||
static bool convert_wide_chars_to_ansi(char* out, const wchar_t* str, size_t len) {
|
static bool convert_wide_chars_to_ansi(char* out, const wchar_t* str, size_t len) {
|
||||||
for (size_t i = 0; i < len; i++) {
|
for (size_t i = 0; i < len; i++) {
|
||||||
wchar_t ch = *str++;
|
wchar_t ch = *str++;
|
||||||
if (ch <= 0 && ch > 0x7F) {
|
if (ch < 0 || 0x7F >= ch) {
|
||||||
*out++ = 0;
|
*out++ = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
*out++ = ch;
|
*out++ = ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ void *aligned_alloc(size_t alignment, size_t size) {
|
||||||
if(alignment > 8) {
|
if(alignment > 8) {
|
||||||
min_req_size += alignment;
|
min_req_size += alignment;
|
||||||
}
|
}
|
||||||
void *block_start = HeapAlloc(_heap, HEAP_ZERO_MEMORY, size+alignment);
|
void *block_start = HeapAlloc(_heap, HEAP_ZERO_MEMORY, min_req_size);
|
||||||
intptr_t block_start_i = (intptr_t)block_start;
|
intptr_t block_start_i = (intptr_t)block_start;
|
||||||
intptr_t aligned_block_start_i = align_forward(block_start_i, alignment);
|
intptr_t aligned_block_start_i = align_forward(block_start_i, alignment);
|
||||||
void *aligned_block_start = (void *)aligned_block_start_i;
|
void *aligned_block_start = (void *)aligned_block_start_i;
|
||||||
|
|
|
@ -8,6 +8,6 @@
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
uint64_t mynumber = 4;
|
uint64_t mynumber = 4;
|
||||||
printf("%"PRIu64"\n", mynumber);
|
printf("Hello, guys %"PRIu64"\n", mynumber);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue