chibicc icon indicating copy to clipboard operation
chibicc copied to clipboard

FreeBSD stdarg support

Open ppenzin opened this issue 5 years ago • 3 comments

FreeBSD gives out this rather excluding message when including stdio.h:

/usr/include/sys/_types.h:135: #error "No support for your compiler for stdargs"

It is triggered by is this condition in cdefs.h not being met (and the guarded macros not getting set):

#if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#define	__GNUCLIKE_BUILTIN_VARARGS 1
#define	__GNUCLIKE_BUILTIN_STDARG 1
#define	__GNUCLIKE_BUILTIN_VAALIST 1
#endif

ppenzin avatar Oct 27 '20 02:10 ppenzin

I'll eventually define __GNUC__ macro, and I think that should fix this problem. I'm not doing it right now because it opens a can of warms. If you define __GNUC__, the stdlib headers expect that your compiler supports all GCC extensions, such as various kinds of __attribute__. So, I'll do that after the extensions are implemented.

rui314 avatar Oct 29 '20 07:10 rui314

Right, setting __GNUC __ yields this:

/usr/include/sys/cdefs.h:228: #define	__aligned(x)	__attribute__((__aligned__(x)))
                                                 ^ expected ','

Edit: I've tried setting a breakpoint at the point where that error should be produced, but did not realize chibicc relaunches itself at first.

ppenzin avatar Oct 30 '20 01:10 ppenzin

What do you use to write code? Is it a diary?

qq528134537 avatar Oct 30 '20 18:10 qq528134537