Skip to content

bug with __has_include and valgrind header #168

Description

@lucas-mior

The following program does not compile:

// chibicc

void function(void) {
    // this function is here just to show that the problem is not on line 1
}

#if defined(__has_include) && __has_include(<valgrind/valgrind.h>)
#include <valgrind/valgrind.h>
#endif

#include "stdio.h"

int main(void) {
    printf("This program should compile.\n");
    return 0;
}

The error message is:

main.c:1: 0
          ^ not a function

Also note that the error message says line 1, independent of where the valgrind macro directive is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions