Merge pull request #192 from pesco/compiler-fixes

merging this to see what Travis says
This commit is contained in:
pesco 2019-11-23 22:06:11 +01:00 committed by GitHub
commit cc733ffb77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

View file

@ -420,6 +420,12 @@ void h_lr_parse_start(HSuspendedParser *s)
s->backend_state = engine; s->backend_state = engine;
} }
// cf. comment before run_trace in regex.c
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wclobbered"
#endif
bool h_lr_parse_chunk(HSuspendedParser* s, HInputStream *stream) bool h_lr_parse_chunk(HSuspendedParser* s, HInputStream *stream)
{ {
HLREngine *engine = s->backend_state; HLREngine *engine = s->backend_state;
@ -457,6 +463,10 @@ bool h_lr_parse_chunk(HSuspendedParser* s, HInputStream *stream)
*stream = engine->input; *stream = engine->input;
return !run; // done if engine no longer running return !run; // done if engine no longer running
} }
// Reenable -Wclobber
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
HParseResult *h_lr_parse_finish(HSuspendedParser *s) HParseResult *h_lr_parse_finish(HSuspendedParser *s)
{ {

View file

@ -223,7 +223,7 @@ bool svm_stack_ensure_cap(HAllocator *mm__, HSVMContext *ctx, size_t addl) {
* the second return; here, the only variables that could matter for * the second return; here, the only variables that could matter for
* are arena and ctx (because they're referenced in "goto fail"). * are arena and ctx (because they're referenced in "goto fail").
*/ */
#ifdef __GNUC__ #if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-pragmas" #pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wclobbered" #pragma GCC diagnostic ignored "-Wclobbered"
@ -311,7 +311,7 @@ HParseResult *run_trace(HAllocator *mm__, HRVMProg *orig_prog, HRVMTrace *trace,
return NULL; return NULL;
} }
// Reenable -Wclobber // Reenable -Wclobber
#ifdef __GNUC__ #if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif

View file

@ -1,4 +1,8 @@
#ifdef __OpenBSD__
#define _BSD_SOURCE // to obtain asprintf/vasprintf
#else
#define _GNU_SOURCE // to obtain asprintf/vasprintf #define _GNU_SOURCE // to obtain asprintf/vasprintf
#endif
#include "platform.h" #include "platform.h"
#include <stdio.h> #include <stdio.h>