diff mbox

nios2-linux: add missing cpp specs

Message ID 1432742409-23547-1-git-send-email-vapier@gentoo.org
State New
Headers show

Commit Message

Mike Frysinger May 27, 2015, 4 p.m. UTC
Define CPP_SPEC for nios2 linux targets so that -posix & -pthread work
like on all other linux targets.

2015-05-27  Mike Frysinger  <vapier@gentoo.org>

	* config/nios2/linux.h (CPP_SPEC): Define.
---
 gcc/config/nios2/linux.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Sandra Loosemore May 29, 2015, 2:44 p.m. UTC | #1
On 05/27/2015 10:00 AM, Mike Frysinger wrote:
> Define CPP_SPEC for nios2 linux targets so that -posix & -pthread work
> like on all other linux targets.
>
> 2015-05-27  Mike Frysinger  <vapier@gentoo.org>
>
> 	* config/nios2/linux.h (CPP_SPEC): Define.

I see that -posix is not documented at all in invoke.texi and -pthread 
is documented only for RS6000 and Solaris (which is not Linux).  What, 
exactly, are these options supposed to do on "all other linux targets"? 
  If these options are supposed to be generic to all Linux targets, 
can't they be handled in some common way instead of duplicating the 
CPP_SPEC code in all the individual back ends?

-Sandra
Mike Frysinger May 29, 2015, 5:36 p.m. UTC | #2
On 29 May 2015 08:44, Sandra Loosemore wrote:
> On 05/27/2015 10:00 AM, Mike Frysinger wrote:
> > Define CPP_SPEC for nios2 linux targets so that -posix & -pthread work
> > like on all other linux targets.
> >
> > 2015-05-27  Mike Frysinger  <vapier@gentoo.org>
> >
> > 	* config/nios2/linux.h (CPP_SPEC): Define.
> 
> I see that -posix is not documented at all in invoke.texi and -pthread 
> is documented only for RS6000 and Solaris (which is not Linux).  What, 
> exactly, are these options supposed to do on "all other linux targets"? 
>   If these options are supposed to be generic to all Linux targets, 
> can't they be handled in some common way instead of duplicating the 
> CPP_SPEC code in all the individual back ends?

please see my other threads/patches
-mike
Sandra Loosemore May 29, 2015, 6:32 p.m. UTC | #3
On 05/29/2015 11:36 AM, Mike Frysinger wrote:
> On 29 May 2015 08:44, Sandra Loosemore wrote:
>> On 05/27/2015 10:00 AM, Mike Frysinger wrote:
>>> Define CPP_SPEC for nios2 linux targets so that -posix & -pthread work
>>> like on all other linux targets.
>>>
>>> 2015-05-27  Mike Frysinger  <vapier@gentoo.org>
>>>
>>> 	* config/nios2/linux.h (CPP_SPEC): Define.
>>
>> I see that -posix is not documented at all in invoke.texi and -pthread
>> is documented only for RS6000 and Solaris (which is not Linux).  What,
>> exactly, are these options supposed to do on "all other linux targets"?
>>    If these options are supposed to be generic to all Linux targets,
>> can't they be handled in some common way instead of duplicating the
>> CPP_SPEC code in all the individual back ends?
>
> please see my other threads/patches

(Sorry, I am a few days behind in mailing list traffic, was just trying 
to respond to the review request that was CC'ed to me directly.)

Do you mean this one?

https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02708.html

That addresses my concern about not duplicating this in every back end, 
but I still don't see any documentation and don't really understand what 
these flags are supposed to do or why I might need to add them to my 
command line.  Taking off my nios2 maintainer hat and putting on the 
docs maintainer one instead, I think proper documentation for these 
options is a requirement here....

-Sandra
Mike Frysinger May 30, 2015, 3:28 a.m. UTC | #4
On 29 May 2015 12:32, Sandra Loosemore wrote:
> On 05/29/2015 11:36 AM, Mike Frysinger wrote:
> > On 29 May 2015 08:44, Sandra Loosemore wrote:
> >> On 05/27/2015 10:00 AM, Mike Frysinger wrote:
> >>> Define CPP_SPEC for nios2 linux targets so that -posix & -pthread work
> >>> like on all other linux targets.
> >>>
> >>> 2015-05-27  Mike Frysinger  <vapier@gentoo.org>
> >>>
> >>> 	* config/nios2/linux.h (CPP_SPEC): Define.
> >>
> >> I see that -posix is not documented at all in invoke.texi and -pthread
> >> is documented only for RS6000 and Solaris (which is not Linux).  What,
> >> exactly, are these options supposed to do on "all other linux targets"?
> >>    If these options are supposed to be generic to all Linux targets,
> >> can't they be handled in some common way instead of duplicating the
> >> CPP_SPEC code in all the individual back ends?
> >
> > please see my other threads/patches
> 
> (Sorry, I am a few days behind in mailing list traffic, was just trying 
> to respond to the review request that was CC'ed to me directly.)
> 
> Do you mean this one?
> 
> https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02708.html

yes

> That addresses my concern about not duplicating this in every back end, 
> but I still don't see any documentation and don't really understand what 
> these flags are supposed to do or why I might need to add them to my 
> command line.  Taking off my nios2 maintainer hat and putting on the 
> docs maintainer one instead, I think proper documentation for these 
> options is a requirement here....

i'm not familiar with the history.  i'm merely cleaning up some of the mess.
both defines are respected by glibc and make a difference to compilation.
-mike
Sandra Loosemore May 30, 2015, 3:38 p.m. UTC | #5
On 05/29/2015 09:28 PM, Mike Frysinger wrote:
> On 29 May 2015 12:32, Sandra Loosemore wrote:
>> On 05/29/2015 11:36 AM, Mike Frysinger wrote:
>>> On 29 May 2015 08:44, Sandra Loosemore wrote:
>>>> On 05/27/2015 10:00 AM, Mike Frysinger wrote:
>>>>> Define CPP_SPEC for nios2 linux targets so that -posix & -pthread work
>>>>> like on all other linux targets.
>>>>>
>>>>> 2015-05-27  Mike Frysinger  <vapier@gentoo.org>
>>>>>
>>>>> 	* config/nios2/linux.h (CPP_SPEC): Define.
>>>>
>>>> I see that -posix is not documented at all in invoke.texi and -pthread
>>>> is documented only for RS6000 and Solaris (which is not Linux).  What,
>>>> exactly, are these options supposed to do on "all other linux targets"?
>>>>     If these options are supposed to be generic to all Linux targets,
>>>> can't they be handled in some common way instead of duplicating the
>>>> CPP_SPEC code in all the individual back ends?
>>>
>>> please see my other threads/patches
>>
>> (Sorry, I am a few days behind in mailing list traffic, was just trying
>> to respond to the review request that was CC'ed to me directly.)
>>
>> Do you mean this one?
>>
>> https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02708.html
>
> yes
>
>> That addresses my concern about not duplicating this in every back end,
>> but I still don't see any documentation and don't really understand what
>> these flags are supposed to do or why I might need to add them to my
>> command line.  Taking off my nios2 maintainer hat and putting on the
>> docs maintainer one instead, I think proper documentation for these
>> options is a requirement here....
>
> i'm not familiar with the history.  i'm merely cleaning up some of the mess.
> both defines are respected by glibc and make a difference to compilation.

I see that the glibc manual does document the preprocessor macros, but 
it doesn't look like glibc either uses or documents the use of special 
GCC command-line options, so I am still confused about why we need these 
options.  However, if using these command-line options on targets where 
they previously have existed is common practice, I have no real 
objection to adding them to nios2 as well.

But, please note that the GCC coding conventions

https://gcc.gnu.org/codingconventions.html#Documentation

explicitly requires documentation for all command-line options.

So, if you are cleaning up the mess to generalize the implementation of 
these options so that they are no longer confined to a few specific 
targets, you must also move the documentation for these options out of 
the back-end-specific part of the manual and make sure it accurately 
reflects the current purpose and usage of these options.

-Sandra
Mike Frysinger May 30, 2015, 4:24 p.m. UTC | #6
On 30 May 2015 09:38, Sandra Loosemore wrote:
> On 05/29/2015 09:28 PM, Mike Frysinger wrote:
> > On 29 May 2015 12:32, Sandra Loosemore wrote:
> >> On 05/29/2015 11:36 AM, Mike Frysinger wrote:
> >>> On 29 May 2015 08:44, Sandra Loosemore wrote:
> >>>> On 05/27/2015 10:00 AM, Mike Frysinger wrote:
> >>>>> Define CPP_SPEC for nios2 linux targets so that -posix & -pthread work
> >>>>> like on all other linux targets.
> >>>>>
> >>>>> 2015-05-27  Mike Frysinger  <vapier@gentoo.org>
> >>>>>
> >>>>> 	* config/nios2/linux.h (CPP_SPEC): Define.
> >>>>
> >>>> I see that -posix is not documented at all in invoke.texi and -pthread
> >>>> is documented only for RS6000 and Solaris (which is not Linux).  What,
> >>>> exactly, are these options supposed to do on "all other linux targets"?
> >>>>     If these options are supposed to be generic to all Linux targets,
> >>>> can't they be handled in some common way instead of duplicating the
> >>>> CPP_SPEC code in all the individual back ends?
> >>>
> >>> please see my other threads/patches
> >>
> >> (Sorry, I am a few days behind in mailing list traffic, was just trying
> >> to respond to the review request that was CC'ed to me directly.)
> >>
> >> Do you mean this one?
> >>
> >> https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02708.html
> >
> > yes
> >
> >> That addresses my concern about not duplicating this in every back end,
> >> but I still don't see any documentation and don't really understand what
> >> these flags are supposed to do or why I might need to add them to my
> >> command line.  Taking off my nios2 maintainer hat and putting on the
> >> docs maintainer one instead, I think proper documentation for these
> >> options is a requirement here....
> >
> > i'm not familiar with the history.  i'm merely cleaning up some of the mess.
> > both defines are respected by glibc and make a difference to compilation.
> 
> I see that the glibc manual does document the preprocessor macros, but 
> it doesn't look like glibc either uses or documents the use of special 
> GCC command-line options, so I am still confused about why we need these 
> options.  However, if using these command-line options on targets where 
> they previously have existed is common practice, I have no real 
> objection to adding them to nios2 as well.
> 
> But, please note that the GCC coding conventions
> 
> https://gcc.gnu.org/codingconventions.html#Documentation
> 
> explicitly requires documentation for all command-line options.
> 
> So, if you are cleaning up the mess to generalize the implementation of 
> these options so that they are no longer confined to a few specific 
> targets, you must also move the documentation for these options out of 
> the back-end-specific part of the manual and make sure it accurately 
> reflects the current purpose and usage of these options.

it's not that i disagree with anything you're saying wrt documentation -- the 
situation is pretty bad.  it's that i think it's not directly impacted by my
changes.  my cleanups also do not really move them out of the back end ...
they still only work for gnu/linux type targets.  so while we should see about 
fixing the docs, i don't think my patch should depend on that considering (1) 
it's an obvious (imo) improvement and (2) the docs have always been broken.
-mike
diff mbox

Patch

diff --git a/gcc/config/nios2/linux.h b/gcc/config/nios2/linux.h
index 41cad94..f43f655 100644
--- a/gcc/config/nios2/linux.h
+++ b/gcc/config/nios2/linux.h
@@ -26,6 +26,9 @@ 
     }                                           \
   while (0)
 
+#undef CPP_SPEC
+#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
+
 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-nios2.so.1"
 
 #undef LINK_SPEC