public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
To: law@cygnus.com
Cc: bothner@cygnus.com, egcs@cygnus.com
Subject: Re:  bcopy -> memcpy/memmove transition proposal
Date: Sat, 19 Sep 1998 12:03:00 -0000	[thread overview]
Message-ID: <199809191524.LAA06097@caip.rutgers.edu> (raw)

 > From: Per Bothner <bothner@cygnus.com>
 > 
 > It is really ridiculous that gcc still uses the non-ANSI functions
 > (such as bcopy), rather than the standard ANSI functions.  We all
 > (I hope) agree this is bogus, but fixing them all is a hassle.
 > Here is a concrete suggestion for how we can deal with a mix
 > of both styles, and fix them as convenient.


Per,

	I have a couple of comments/questions.

1.  Wasn't using the BSD style a GNU coding convention at some point?
I don't care really, but if it did exist I wanted to know why before
we chuck it.  I also want to make sure if we violate the coding
standards, we do so consciously/intentionally rather than by oversight.

	Was the BSD style merely preference on RMS' part?  Did this
convention go away?  I briefly scanned a recent copy of the standards
and couldn't find it.  But I also can't shake the recollection that
its true.  In fact, I recall something on gcc2 within the last 1-1.5
years where someone asked kenner if it was time to switch and he
rejected it for some reason.




 > 
 > 1) Add memcpy, memmove, memzero, strchr, and strrchr to
 > the list of functions in the AC_CHECK_FUNCS macro in configure.in.
 > 
 > 2) Add a new file string.c, which is always linked in.
 > This would look something like:
 > 


	Your proposal looks like you are reimplementing parts of
libiberty inside gcc.  Why not just go all the way and use libiberty?
There are serious issues involved, but I would suggest biting the
bullet and doing it completely.  More on that below.




 > 
 > There are some issues I'm not sure about:
 > 
 > 1) Do we need to add prototypes for bcopy, memmove and/or memcpy
 > to some header file, if they are "missing"?


	Already done for the b* style ones in system.h.  If we go with
your approach, we might as well prototype the mem* ones too.


 > 
 > I don't see any necessity, or reason why it would be desirable,
 > but may be missing something.


	If you do "foo = memcpy()" I think you lose if
sizeof(int)!=sizeof(ptr) and no prototype exists.  There may be other
reasons.  I see no reason why not to do this given that the support
and infrastructure for doing so already exists.



 > 
 > 2) Is there a problem with build vs host?  Is is the difference
 > between auto-host.h and auto-config.h?  I'm not clear on how
 > this happens;  perhaps we may need to compile string.c twice,
 > once for build and once for host.
 > 
 > Comments?  This suituation has been bugging for a long time, and
 > I think it is time to fix it.
 > 	--Per Bothner


	While this issue alone doesn't particularly bother me, I am
frustrated by the libiberty situation in general.  The main obstacle
AFAICT is that in order to use libiberty correctly, you have to
include libiberty.h which includes ansidecl.h.  The ansidecl.h from
libiberty conflicts with gansidecl.h from gcc.  E.g. ansidecl.h
defines PROTO as an obsolete macro to mean something other than what
gansidecl.h does.  One is encouraged to use PARAMS instead.

	Also, it seems that libiberty.h only prototypes original
functions it provides, not replacements for missing ones.  I think
this may have been done to avoid conflicts with system headers in the
event that the function is *not* missing.  But this decision may have
been made before common use of the autoconf macro GCC_NEED_DECLARATION
which makes this problem go away.

	I know the scope is vastly larger, but we've done a lot of
hacks to avoid undertaking libiberty, your proposal being the latest
in a long series.  (I'm way guilty of this too.)  Recalling those and
the fact that they are growing is what bugs me the most.  So I'd like
to seriously consider libiberty now.  I'll outline the steps as I see
them and I'd like to get comments.

	Libiberty conversion steps:

1.  Resolve conflicts between gansidecl.h and ansidecl.h in gcc's source
code.  I.e. s/PROTO/PARAMS/, etc.  (I believe we should follow the
libiberty convention, although this requires lots of busy work changes
in gcc's source.  It *would* be a good time to resolve all the
formatting differences though.  E.g.  "PROTO((" vs "PROTO ((".)

2.  Move any extra stuff from gansidecl.h to ansidecl.h.

3.  Nuke the gansidecl.h file and all references to including it.

4.  Have *config.h in gcc include ansidecl.h from libiberty.

5.  (Have system.h include libiberty.h?)  Add missing prototypes for
remaining system functions provided by libiberty based on whether
GCC_NEED_DECLARATION indicates we should.  Stop defining the b*
functions in terms of the mem* ones in system.h.  (No longer needed.)

6.  Setup Makefiles to build two copies of libiberty, "host" and
"build", and link appropriately with executables.

7.  Nuke stuff in gcc's source locally that's now provided by
libiberty.  E.g. local xmalloc definitions, prototypes, etc.

8.  Cross our fingers. :-)

I don't think it all has to be done at once.  We could do it in stages. 

	I'd welcome any comments.

		--Kaveh
--
Kaveh R. Ghazi			Engagement Manager / Project Services
ghazi@caip.rutgers.edu		Icon CMT Corp.

             reply	other threads:[~1998-09-19 12:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-09-19 12:03 Kaveh R. Ghazi [this message]
1998-09-19 17:40 ` Per Bothner
1998-09-19 22:27   ` Jeffrey A Law
1998-09-20  6:39 ` Jeffrey A Law
  -- strict thread matches above, loose matches on Subject: below --
1998-09-20 13:58 Kaveh R. Ghazi
1998-09-20 13:45 Kaveh R. Ghazi
1998-09-19 20:44 N8TM
1998-09-17  9:59 Per Bothner
1998-09-18  4:02 ` Carlo Wood
1998-09-18 23:53 ` Jeffrey A Law
1998-09-19  8:07 ` John Carr
1998-09-19 20:44   ` Jeffrey A Law
1998-09-20 10:48     ` John Carr
1998-09-20 10:55       ` Jeffrey A Law
1998-09-20 10:48     ` Carlo Wood
1998-09-20 13:55       ` Jeffrey A Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199809191524.LAA06097@caip.rutgers.edu \
    --to=ghazi@caip.rutgers.edu \
    --cc=bothner@cygnus.com \
    --cc=egcs@cygnus.com \
    --cc=law@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).