Skip to content

Commit

Permalink
Fix build on ancient versions of gcc
Browse files Browse the repository at this point in the history
Default on gcc 4.6 was 'gnu90', which allows some c99 features
but not 'for (int n = 0, ...)'

Adds a -std=gnu90 build to the tests so we don't get caught by
this again.
  • Loading branch information
daviesrob authored and whitwham committed Nov 28, 2022
1 parent 8e43fb0 commit 58abf07
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ rocky_task:
LC_ALL: C
CIRRUS_CLONE_DEPTH: 1
USE_CONFIG: yes
CFLAGS: -std=gnu90

# NB: we could consider building a docker image with these
# preinstalled and specifying that instead, to speed up testing.
Expand Down
3 changes: 2 additions & 1 deletion vcf.c
Original file line number Diff line number Diff line change
Expand Up @@ -5097,6 +5097,7 @@ static int add_desc_to_buffer(char *buffer, size_t *offset, size_t maxbuffer, co
const char *bcf_strerror(int errorcode, char *buffer, size_t maxbuffer) {
size_t usedup = 0;
int ret = 0;
int idx;

if (!buffer || maxbuffer < 4)
return NULL; //invalid / insufficient buffer
Expand All @@ -5106,7 +5107,7 @@ const char *bcf_strerror(int errorcode, char *buffer, size_t maxbuffer) {
return buffer;
}

for (int idx = 0; idx < sizeof(errdesc_bcf) / sizeof(err_desc); ++idx) {
for (idx = 0; idx < sizeof(errdesc_bcf) / sizeof(err_desc); ++idx) {
if (errorcode & errdesc_bcf[idx].errorcode) { //error is set, add description
ret = add_desc_to_buffer(buffer, &usedup, maxbuffer, errdesc_bcf[idx].description);
if (ret < 0)
Expand Down

0 comments on commit 58abf07

Please sign in to comment.