Warning Flags Disappeared

Sebastian Huber sebastian.huber at embedded-brains.de
Tue May 8 09:18:09 UTC 2018


On 08/05/18 11:10, Chris Johns wrote:
> On 8/5/18 5:17 pm, Sebastian Huber wrote:
>> This change adds the warning flags. I don't know why CFLAGS is now present.
> What do you mean by this last sentence?

We have:

grep '\<CFLAGS\>' -n c/src/configure
640:CFLAGS
759:CFLAGS
1332:To assign environment variables (e.g., CC, CFLAGS...), specify them as
1434:  CFLAGS      C compiler flags
1445:  CCASFLAGS   assembler compiler flags (defaults to CFLAGS)
2023:ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
2024:ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS 
conftest.$ac_ext $LIBS >&5'
2843:# AC_ARG_VAR([CPU_CFLAGS],[CFLAGS specifying CPU-dependent features])
2844:# AC_ARG_VAR([CFLAGS_OPTIMIZE_V],[CFLAGS for building the OPTIMIZE 
variant])
2845:# AC_ARG_VAR([CFLAGS_DEBUG_V],[CFLAGS for building the DEBUG variant])
3070:# Was CFLAGS set?
3071:rtems_cv_CFLAGS_set="${CFLAGS+set}"
3073:CFLAGS="${CFLAGS-${CPU_CFLAGS} ${CFLAGS_OPTIMIZE_V}}"
3185:ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
3186:ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS 
conftest.$ac_ext $LIBS >&5'
3796:ac_test_CFLAGS=${CFLAGS+set}
3797:ac_save_CFLAGS=$CFLAGS
3806:   CFLAGS="-g"
3821:  CFLAGS=""
3837:    CFLAGS="-g"
3862:  CFLAGS=$ac_save_CFLAGS
3865:    CFLAGS="-g -O2"
3867:    CFLAGS="-g"
3871:    CFLAGS="-O2"
3873:    CFLAGS=
3968:ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
3969:ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS 
conftest.$ac_ext $LIBS >&5'
4102:ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
4103:ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS 
conftest.$ac_ext $LIBS >&5'
4233:ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
4234:ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS 
conftest.$ac_ext $LIBS >&5'
4325:# Was CFLAGS set?
4326:rtems_cv_CFLAGS_set="${CFLAGS+set}"
4392:# If CXXFLAGS is not set, default to CFLAGS
4394:  CXXFLAGS=${CXXFLAGS-${CFLAGS} -std=gnu++11}
4396:  CXXFLAGS=${CXXFLAGS-${CFLAGS}}
4716:ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
4717:ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS 
conftest.$ac_ext $LIBS >&5'
4977:ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
4978:ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS 
conftest.$ac_ext $LIBS >&5'
5131:test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
5440:# Append warning flags if CFLAGS wasn't set.
5442:  CFLAGS="$CFLAGS -Wall -Wmissing-prototypes 
-Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs"
5445:if test -n "${CFLAGS}"; then :
5447:ac_configure_args="$ac_configure_args 'CFLAGS=${CFLAGS}'"
5460:    save_CFLAGS=$CFLAGS
5461:    CFLAGS=-Werror
5486:    CFLAGS=$save_CFLAGS

This CFLAGS is not set before line 3071 in the script. The caller must 
have provided it. I don't know how the caller did achieve this and why.

>
>> There could be a problem somewhere else.
> The support was added back in 2011 )d71462b4eb38efbcda6d429a0a61749d7a89e195).
>
> I moved this:
>
>   # Was CFLAGS set?
>   rtems_cv_CFLAGS_set="${CFLAGS+set}"
>
> into aclocal/rtems-includes.m4 in the preinstall removal.
>
> Chris
>
>> diff --git a/c/src/configure.ac b/c/src/configure.ac
>> index f4428ed221..7e4986e03d 100644
>> --- a/c/src/configure.ac
>> +++ b/c/src/configure.ac
>> @@ -100,7 +100,7 @@ RTEMS_PROG_CCAS
>>   RTEMS_CANONICALIZE_TOOLS
>>
>>   # Append warning flags if CFLAGS wasn't set.
>> -AS_IF([test "$GCC" = yes && test "$rtems_cv_CFLAGS_set" != set],
>> +AS_IF([test "$GCC" = yes],
>>   [CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wimplicit-function-declaration
>> -Wstrict-prototypes -Wnested-externs"])
>>
>>   AS_IF([test -n "${CFLAGS}"],[
>>
>> On 19/04/18 15:18, Sebastian Huber wrote:
>>> The problem is in c/src/configure.ac:
>>>
>>> # Was CFLAGS set?
>>> rtems_cv_CFLAGS_set="${CFLAGS+set}"
>>>
>>> In this line CFLAGS is set. Later we have:
>>>
>>> # Append warning flags if CFLAGS wasn't set.
>>> AS_IF([test "$GCC" = yes && test "$rtems_cv_CFLAGS_set" != set],
>>> [CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wimplicit-function-declaration
>>> -Wstrict-prototypes -Wnested-externs"])
>>>

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the devel mailing list