diff mbox

turn on -std=c99

Message ID 1418387512-914-1-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov Dec. 12, 2014, 12:31 p.m. UTC
Define _POSIX_C_SOURCE and _BSD_SOURCE to make gcc accept
system calls and turn on -std=c99.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 configure.ac | 2 ++
 1 file changed, 2 insertions(+)

Comments

Bill Fischofer Dec. 12, 2014, 12:38 p.m. UTC | #1
Are we really ready to do this?  I thought the idea was we were going to
have each routine that needed it include the BSD/POSIX #defines so that
they document their need for this on a case-by-case basis.

On Fri, Dec 12, 2014 at 6:31 AM, Maxim Uvarov <maxim.uvarov@linaro.org>
wrote:
>
> Define _POSIX_C_SOURCE and _BSD_SOURCE to make gcc accept
> system calls and turn on -std=c99.
>
> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
> ---
>  configure.ac | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/configure.ac b/configure.ac
> index 2f27261..d9167a5 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -179,6 +179,8 @@ ODP_CFLAGS="$ODP_CFLAGS -Wmissing-declarations
> -Wold-style-definition -Wpointer-
>  ODP_CFLAGS="$ODP_CFLAGS -Wcast-align -Wnested-externs -Wcast-qual
> -Wformat-nonliteral"
>  ODP_CFLAGS="$ODP_CFLAGS -Wformat-security -Wundef -Wwrite-strings"
>
> +ODP_CFLAGS="$ODP_CFLAGS -std=c99 -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L"
> +
>  ##########################################################################
>  # Default include setup
>  ##########################################################################
> --
> 1.8.5.1.163.gd7aced9
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Maxim Uvarov Dec. 12, 2014, 12:48 p.m. UTC | #2
On 12/12/2014 03:38 PM, Bill Fischofer wrote:
> Are we really ready to do this?  I thought the idea was we were going 
> to have each routine that needed it include the BSD/POSIX #defines so 
> that they document their need for this on a case-by-case basis.

Might be it was better to send this as RFC as discussion patch.

Most of linux-generic implementation will need posix defines. I'm not 
sure if that 2 options overlap each other or not. But I think all code 
should follow the same posix standard.

Maxim.

>
> On Fri, Dec 12, 2014 at 6:31 AM, Maxim Uvarov <maxim.uvarov@linaro.org 
> <mailto:maxim.uvarov@linaro.org>> wrote:
>
>     Define _POSIX_C_SOURCE and _BSD_SOURCE to make gcc accept
>     system calls and turn on -std=c99.
>
>     Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org
>     <mailto:maxim.uvarov@linaro.org>>
>     ---
>     configure.ac <http://configure.ac> | 2 ++
>      1 file changed, 2 insertions(+)
>
>     diff --git a/configure.ac <http://configure.ac> b/configure.ac
>     <http://configure.ac>
>     index 2f27261..d9167a5 100644
>     --- a/configure.ac <http://configure.ac>
>     +++ b/configure.ac <http://configure.ac>
>     @@ -179,6 +179,8 @@ ODP_CFLAGS="$ODP_CFLAGS -Wmissing-declarations
>     -Wold-style-definition -Wpointer-
>      ODP_CFLAGS="$ODP_CFLAGS -Wcast-align -Wnested-externs -Wcast-qual
>     -Wformat-nonliteral"
>      ODP_CFLAGS="$ODP_CFLAGS -Wformat-security -Wundef -Wwrite-strings"
>
>     +ODP_CFLAGS="$ODP_CFLAGS -std=c99 -D_BSD_SOURCE
>     -D_POSIX_C_SOURCE=200809L"
>     +
>      ##########################################################################
>      # Default include setup
>      ##########################################################################
>     --
>     1.8.5.1.163.gd7aced9
>
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     http://lists.linaro.org/mailman/listinfo/lng-odp
>
Mike Holmes Dec. 12, 2014, 1:02 p.m. UTC | #3
On 12 December 2014 at 07:48, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
>
> On 12/12/2014 03:38 PM, Bill Fischofer wrote:
>
>> Are we really ready to do this?  I thought the idea was we were going to
>> have each routine that needed it include the BSD/POSIX #defines so that
>> they document their need for this on a case-by-case basis.
>>
>
> Might be it was better to send this as RFC as discussion patch.
>

I think we need to wait until the code catches up and this CI job
<https://ci.linaro.org/view/odp-ci/job/odp-api-check-native-c99/buildhw=x86_64,label=build/19/console>
runs clean, then turning on c99 will enforce it going forward.

If we want to change what our future flags will be, lets add them to this
job first.

Obviously  -std=c99  is a no brainer addition and it there already, however
the blanket adding of _BSD_SOURCE may not be the best idea.
I think I saw a way on a forum somewhere that we can add this flags effect
per API used - that way we would better document what we depend on for
linux-generic - if there is no such mechanism lets add _BSD_SOURCE to the
CI job.


> Most of linux-generic implementation will need posix defines. I'm not sure
> if that 2 options overlap each other or not. But I think all code should
> follow the same posix standard.
>

> Maxim.
>
>
>> On Fri, Dec 12, 2014 at 6:31 AM, Maxim Uvarov <maxim.uvarov@linaro.org
>> <mailto:maxim.uvarov@linaro.org>> wrote:
>>
>>     Define _POSIX_C_SOURCE and _BSD_SOURCE to make gcc accept
>>     system calls and turn on -std=c99.
>>
>>     Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org
>>     <mailto:maxim.uvarov@linaro.org>>
>>     ---
>>     configure.ac <http://configure.ac> | 2 ++
>>      1 file changed, 2 insertions(+)
>>
>>     diff --git a/configure.ac <http://configure.ac> b/configure.ac
>>     <http://configure.ac>
>>     index 2f27261..d9167a5 100644
>>     --- a/configure.ac <http://configure.ac>
>>     +++ b/configure.ac <http://configure.ac>
>>     @@ -179,6 +179,8 @@ ODP_CFLAGS="$ODP_CFLAGS -Wmissing-declarations
>>     -Wold-style-definition -Wpointer-
>>      ODP_CFLAGS="$ODP_CFLAGS -Wcast-align -Wnested-externs -Wcast-qual
>>     -Wformat-nonliteral"
>>      ODP_CFLAGS="$ODP_CFLAGS -Wformat-security -Wundef -Wwrite-strings"
>>
>>     +ODP_CFLAGS="$ODP_CFLAGS -std=c99 -D_BSD_SOURCE
>>     -D_POSIX_C_SOURCE=200809L"
>>     +
>>      ############################################################
>> ##############
>>      # Default include setup
>>      ############################################################
>> ##############
>>     --
>>     1.8.5.1.163.gd7aced9
>>
>>
>>     _______________________________________________
>>     lng-odp mailing list
>>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>>     http://lists.linaro.org/mailman/listinfo/lng-odp
>>
>>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Bill Fischofer Dec. 12, 2014, 2:52 p.m. UTC | #4
The problem with adding _BSD_SOURCE globally is that it's too easy for
people to not be aware of their use of non-compliant routines unless they
get a per-module warning which they can then document by including such
overrides themselves.  So I agree that we want c99 to be set globally, but
I'd prefer to see the overrides done on  per-module basis.

On Fri, Dec 12, 2014 at 7:02 AM, Mike Holmes <mike.holmes@linaro.org> wrote:
>
>
>
> On 12 December 2014 at 07:48, Maxim Uvarov <maxim.uvarov@linaro.org>
> wrote:
>>
>> On 12/12/2014 03:38 PM, Bill Fischofer wrote:
>>
>>> Are we really ready to do this?  I thought the idea was we were going to
>>> have each routine that needed it include the BSD/POSIX #defines so that
>>> they document their need for this on a case-by-case basis.
>>>
>>
>> Might be it was better to send this as RFC as discussion patch.
>>
>
> I think we need to wait until the code catches up and this CI job
> <https://ci.linaro.org/view/odp-ci/job/odp-api-check-native-c99/buildhw=x86_64,label=build/19/console>
> runs clean, then turning on c99 will enforce it going forward.
>
> If we want to change what our future flags will be, lets add them to this
> job first.
>
> Obviously  -std=c99  is a no brainer addition and it there already,
> however the blanket adding of _BSD_SOURCE may not be the best idea.
> I think I saw a way on a forum somewhere that we can add this flags effect
> per API used - that way we would better document what we depend on for
> linux-generic - if there is no such mechanism lets add _BSD_SOURCE to the
> CI job.
>
>
>> Most of linux-generic implementation will need posix defines. I'm not
>> sure if that 2 options overlap each other or not. But I think all code
>> should follow the same posix standard.
>>
>
>> Maxim.
>>
>>
>>> On Fri, Dec 12, 2014 at 6:31 AM, Maxim Uvarov <maxim.uvarov@linaro.org
>>> <mailto:maxim.uvarov@linaro.org>> wrote:
>>>
>>>     Define _POSIX_C_SOURCE and _BSD_SOURCE to make gcc accept
>>>     system calls and turn on -std=c99.
>>>
>>>     Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org
>>>     <mailto:maxim.uvarov@linaro.org>>
>>>     ---
>>>     configure.ac <http://configure.ac> | 2 ++
>>>      1 file changed, 2 insertions(+)
>>>
>>>     diff --git a/configure.ac <http://configure.ac> b/configure.ac
>>>     <http://configure.ac>
>>>     index 2f27261..d9167a5 100644
>>>     --- a/configure.ac <http://configure.ac>
>>>     +++ b/configure.ac <http://configure.ac>
>>>     @@ -179,6 +179,8 @@ ODP_CFLAGS="$ODP_CFLAGS -Wmissing-declarations
>>>     -Wold-style-definition -Wpointer-
>>>      ODP_CFLAGS="$ODP_CFLAGS -Wcast-align -Wnested-externs -Wcast-qual
>>>     -Wformat-nonliteral"
>>>      ODP_CFLAGS="$ODP_CFLAGS -Wformat-security -Wundef -Wwrite-strings"
>>>
>>>     +ODP_CFLAGS="$ODP_CFLAGS -std=c99 -D_BSD_SOURCE
>>>     -D_POSIX_C_SOURCE=200809L"
>>>     +
>>>      ############################################################
>>> ##############
>>>      # Default include setup
>>>      ############################################################
>>> ##############
>>>     --
>>>     1.8.5.1.163.gd7aced9
>>>
>>>
>>>     _______________________________________________
>>>     lng-odp mailing list
>>>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>>>     http://lists.linaro.org/mailman/listinfo/lng-odp
>>>
>>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>>
>
>
> --
> *Mike Holmes*
> Linaro  Sr Technical Manager
> LNG - ODP
>
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index 2f27261..d9167a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -179,6 +179,8 @@  ODP_CFLAGS="$ODP_CFLAGS -Wmissing-declarations -Wold-style-definition -Wpointer-
 ODP_CFLAGS="$ODP_CFLAGS -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral"
 ODP_CFLAGS="$ODP_CFLAGS -Wformat-security -Wundef -Wwrite-strings"
 
+ODP_CFLAGS="$ODP_CFLAGS -std=c99 -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L"
+
 ##########################################################################
 # Default include setup
 ##########################################################################