Re: C99 compliance for src/port/snprintf.c

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: C99 compliance for src/port/snprintf.c
Дата
Msg-id 20180815222401.kxsupl5zie2jgi4x@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: C99 compliance for src/port/snprintf.c  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: C99 compliance for src/port/snprintf.c
Список pgsql-hackers
Hi,

On 2018-08-15 18:13:59 -0400, Tom Lane wrote:
> Experimenting here says that even reasonably modern gcc's won't take
> declarations-inside-for without "--std=c99" or such.  No idea about
> other compilers.  So we'd have a little bit of work to do on
> configuration before we could open the floodgates on this.

I think autoconf's magic knows about most of that:

 — Macro: AC_PROG_CC_C99

    If the C compiler is not in C99 mode by default, try to add an
    option to output variable CC to make it so. This macro tries various
    options that select C99 on some system or another. It considers the
    compiler to be in C99 mode if it handles _Bool, flexible arrays,
    inline, long long int, mixed code and declarations, named
    initialization of structs, restrict, varargs macros, variable
    declarations in for loops and variable length arrays.

    After calling this macro you can check whether the C compiler has
    been set to accept C99; if not, the shell variable ac_cv_prog_cc_c99
    is set to ‘no’. ~

I think we could get a start by adding that test to configure, without
relying on it for now (i.e. keeping mylodon with -Wc99-extensions
-Werror=c99-extensions alive). That'd tell us about which machines,
besides presumably gaur, we'd need to either kick to the curb or change.

Greetings,

Andres Freund


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Jonathan S. Katz"
Дата:
Сообщение: Re: xact_start meaning when dealing with procedures?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: C99 compliance for src/port/snprintf.c