diff mbox

Add GNU -bsd option from specs to new gnu.opt

Message ID Pine.LNX.4.64.1101280005040.9520@digraph.polyomino.org.uk
State New
Headers show

Commit Message

Joseph Myers Jan. 28, 2011, 12:06 a.m. UTC
In preparation for the driver only accepting options listed in .opt
files, and not other options that simply happen to match some spec,
this patch adds the -bsd option accepted by specs in gnu.h to a new
gnu.opt file.  (Other options are not added to this file because
<http://gcc.gnu.org/ml/gcc-patches/2011-01/msg02024.html> adds them to
gnu-user.opt, but this patch does not depend on that one; the two
patches could go in in either order.)

Tested building cc1 and xgcc for cross to i686-gnu.  OK to commit?

2011-01-27  Joseph Myers  <joseph@codesourcery.com>

	* config/gnu.opt: New.
	* config.gcc (*-*-gnu*): Use gnu.opt.

Comments

Joseph Myers Feb. 3, 2011, 4:13 p.m. UTC | #1
Ping.  This patch 
<http://gcc.gnu.org/ml/gcc-patches/2011-01/msg02072.html> is pending 
review.
Thomas Schwinge Feb. 7, 2011, 12:13 a.m. UTC | #2
Hallo!

Roland, Thomas, Samuel: Do you have any comments on this (read below)?
(Originally: <http://gcc.gnu.org/ml/gcc-patches/2011-01/msg02072.html>,
<http://gcc.gnu.org/ml/gcc-patches/2011-02/msg00206.html>)


On Fri, Jan 28, 2011 at 12:06:48AM +0000, Joseph S. Myers wrote:
> In preparation for the driver only accepting options listed in .opt
> files, and not other options that simply happen to match some spec,
> this patch adds the -bsd option accepted by specs in gnu.h to a new
> gnu.opt file.

> (Other options are not added to this file because
> <http://gcc.gnu.org/ml/gcc-patches/2011-01/msg02024.html> adds them to
> gnu-user.opt

Ack.

> Index: gcc/config.gcc
> ===================================================================
> --- gcc/config.gcc	(revision 169317)
> +++ gcc/config.gcc	(working copy)
> @@ -561,6 +561,9 @@ case ${target} in
>    case $target in
>      *linux*)
>        extra_options="$extra_options linux.opt";;
> +    *-*-gnu*)
> +      tm_defines="$tm_defines SINGLE_LIBC"
> +      extra_options="$extra_options gnu.opt";;
>      *)
>        tm_defines="$tm_defines SINGLE_LIBC";;
>    esac

This would also match k*bsd-gnu*, etc. -- which don't have a -bsd option
as far as I can tell -- I only find it in three places:

    config/gnu.h:#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{bsd:-D_BSD_SOURCE}"
    config/gnu.h:#define LIB_SPEC "%{pthread:-lpthread} %{bsd:-lbsd-compat} %{pg|p|profile:-lc_p;:-lc}"
    config/i386/gnu.h:#define CPP_SPEC "%{pthread:-D_REENTRANT} %{posix:-D_POSIX_SOURCE} %{bsd:-D_BSD_SOURCE}"

So, I wondered what this -bsd option was actually about.  (I already
wondered months (uhm, years...) ago, but didn't look it up back then.)

This spec code was added with the original GNU/Hurd spec files commit by
Roland in 1994.  Roland, can you tell where you meant to / did use this
option (apart from a local command-line argument shortcut)?

The only place I can remotely find it referenced in core Hurd-related
source code is in glibc, and here it (that is, libbsd-compat) has been an
empty dummy library as of 1998-04-21.  [glibc]/NOTES has a description of
this in the ``Macro: _BSD_SOURCE'' section (but doesn't talk about a -bsd
option either).

There might be some third-party software that uses the -bsd option
(exclusively) for GNU/Hurd, but I don't think this is anywhere near
realistical, and if that softwares' builds failed loudly passing this
option to GCC (and be fixed afterwards), I'd consider that fine -- I
therefore propose removing this -bsd option right away instead of
spending any more time on it.


Grüße,
 Thomas
Roland McGrath Feb. 7, 2011, 5:55 a.m. UTC | #3
I don't think we need to support a -bsd command-line option.
diff mbox

Patch

Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc	(revision 169317)
+++ gcc/config.gcc	(working copy)
@@ -561,6 +561,9 @@  case ${target} in
   case $target in
     *linux*)
       extra_options="$extra_options linux.opt";;
+    *-*-gnu*)
+      tm_defines="$tm_defines SINGLE_LIBC"
+      extra_options="$extra_options gnu.opt";;
     *)
       tm_defines="$tm_defines SINGLE_LIBC";;
   esac
Index: gcc/config/gnu.opt
===================================================================
--- gcc/config/gnu.opt	(revision 0)
+++ gcc/config/gnu.opt	(revision 0)
@@ -0,0 +1,30 @@ 
+; GNU options, other than general GNU-userspace ones.
+
+; Copyright (C) 2011
+; Free Software Foundation, Inc.
+;
+; This file is part of GCC.
+;
+; GCC is free software; you can redistribute it and/or modify it under
+; the terms of the GNU General Public License as published by the Free
+; Software Foundation; either version 3, or (at your option) any later
+; version.
+;
+; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+; WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+; for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with GCC; see the file COPYING3.  If not see
+; <http://www.gnu.org/licenses/>.
+
+; See the GCC internals manual (options.texi) for a description of
+; this file's format.
+
+; Please try to keep this file in ASCII collating order.
+
+bsd
+Driver
+
+; This comment is to ensure we retain the blank line above.