gcc/libiberty
Kaveh R. Ghazi d6f4ec5199 Warning fixes:
* Makefile.in (c-lang.o): Depend on c-tree.h, c-lex.h and toplev.h.
	(c-lex.o): Depend on output.h.
	(c-common.o): Likewise.
	(stmt.o): Likewise.
	(calls.o): Likewise.
	(integrate.o): Depend on toplev.h.
	(regclass.o): Depend on output.h.
	(final.o): Depend on reload.h.
	* c-common.c: Include output.h.
	(check_format_info): Remove unused variable `integral_format'.
	* c-decl.c (print_lang_decl): Mark parameters `file', `node' and
	`indent' with ATTRIBUTE_UNUSED.
	(print_lang_type): Likewise.
	(maybe_build_cleanup): Likewise for parameter `decl'.
	(copy_lang_decl): Likewise for parameter `node'.
	* c-lang.c: Include c-tree.h, c-lex.h and toplev.h.
	(lang_print_xnode): Mark parameters `file', `node' and `indent'
 	with ATTRIBUTE_UNUSED.
	(lookup_interface): Likewise for parameter `arg'.
	(is_class_name): Likewise.
	(maybe_objc_check_decl): Likewise for parameter `decl'.
	(maybe_objc_comptypes): Likewise for parameters `lhs', `rhs' and
	`reflexive'.
	(maybe_objc_method_name): Likewise for parameter `decl'.
	(build_objc_string): Likewise for parameters `len' and `str'.
	* c-lex.c: Include output.h.
	* c-lex.h (position_after_white_space): Correct typo in prototype.
	* c-tree.h (finish_file, c_expand_start_cond, c_expand_start_else,
 	c_expand_end_cond, init_iterators): Add prototypes.
	* caller-save.c (set_reg_live): Mark parameters `reg' and `setter'
	with ATTRIBUTE_UNUSED.
	* calls.c: Include output.h.
	* cccp.c (pipe_closed): Mark parameter `signo' with
 	ATTRIBUTE_UNUSED.
	* combine.c: Move inclusion of expr.h to after insn-config.h.
	* iris6.h (ASM_IDENTIFY_GCC, ASM_IDENTIFY_LANGUAGE): Don't define
	as empty, rather define as ((void)0).
	* sparc.c (sparc_check_64): Add braces around ambiguous `else'.
	Add parentheses around assignment used as truth value.
	* cplus-dem.c (squangle_mop_up): Change return type to void.
	(internal_cplus_demangle): Remove unused parameter `options'.
	All callers changed.
	(cplus_demangle_opname): Remove function wide variable `int i' and
 	replace with `size_t i' at each location where it is used.
	(cplus_demangle_opname): change type of `i' from int to size_t.
	* cppexp.c (right_shift): Mark parameter `pfile' with
	ATTRIBUTE_UNUSED.
	* cpphash.c (cpp_lookup): Likewise.
	(cpp_hash_cleanup): Likewise.
	* cpplib.c (parse_name): Add a prototype and make it static.
	(null_underflow): Mark parameter `pfile' with ATTRIBUTE_UNUSED.
	(null_cleanup): Likewise for parameters `pbuf' and `pfile'.
	(macro_cleanup): Likewise for parameter `pfile'.
	(file_cleanup): Likewise.
	* cpplib.h (cpp_reader_init, cpp_options_init, cpp_start_read,
 	cpp_read_check_assertion, skip_rest_of_line): Add prototypes.
	* crtstuff.c (force_to_data, __CTOR_LIST__, force_to_data,
	__DTOR_END__, __FRAME_END__): Mark with ATTRIBUTE_UNUSED.
	* cse.c (cse_check_loop_start): Mark parameter `set' with
 	ATTRIBUTE_UNUSED.
	* dbxout.c (flag_minimal_debug, have_used_extensions,
	source_label_number): Move inside macro wrapper check against
	defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO).
	* dwarf2out.c (gen_entry_point_die): Hide prototype and definition.
	* except.h (doing_eh): Provide prototype.
	* expr.c: Move inclusion of expr.h to after insn-config.h.
	* final.c: Include reload.h.
	(shorten_branches): Cast the first argument of bzero to char *.
	* fix-header.c (cpp_print_containing_files): Mark parameter
 	`pfile' with ATTRIBUTE_UNUSED.
	(cpp_fatal): Likewise.
	* flow.c (find_basic_blocks_1): Cast the first argument of bzero
	to char *.
	* genattrtab.c (make_length_attrs): Change the type of variable
	`i' from int to size_t.
	(zero_fn): Mark parameter `exp' with ATTRIBUTE_UNUSED.
	(one_fn): Likewise.
	* genextract.c (main): When generating insn-extract.c, mark
	variable `junk' with ATTRIBUTE_UNUSED.
	* gengenrtl.c (gencode): When generating genrtl.c, cast the first
	argument of bzero to char*.
	* integrate.c: Include toplev.h.
	* libgcc2.c: Wrap `struct exception_table' and
	`find_exception_handler' in macro DWARF2_UNWIND_INFO.
	* objc/Make-lang.in (objc-act.o): Depend on toplev.h.
	* objc/objc-act.c: Include toplev.h.
	(lang_print_xnode): Mark parameters `file', `node' and `indent'
	with ATTRIBUTE_UNUSED.
	(finish_protocol): Likewise for parameter `protocol'.
	* output.h (declare_weak): Add prototype.
	(decode_reg_name): Don't wrap with TREE_CODE macro.
	(assemble_alias): Add prototype.
	* regclass.c: Include output.h.
	* reload.h (reloads_conflict): Add prototype.
	* rtl.h (print_rtl_single, mark_elimiation, reg_class_subset_p,
	output_func_start_profiler): Add prototypes.
	* rtlanal.c (reg_set_p_1): Mark parameters `x' and `pat' with
 	ATTRIBUTE_UNUSED.
	* scan-decls.c: Include scan.h.
	* scan.h (recognized_function, recognized_extern): Add prototypes.
	* stmt.c: Include output.h.
	* toplev.c (error_for_asm, warning_for_asm): Remove prototypes.
	(output_lang_identify): Hide prototype and definition.
	(float_signal): Mark parameter `signo' with ATTRIBUTE_UNUSED.
	(pipe_closed): Likewise.
	* toplev.h (count_error, strip_off_ending, error_for_asm,
 	warning_for_asm): Add prototypes.

From-SVN: r19712
1998-05-13 12:40:39 +00:00
..
config cplus-dem.c (gnu_special): Don't get confused by .<digits> strings that are not actually lengths. 1998-02-22 09:53:40 -07:00
alloca-botch.h
alloca-norm.h alloca-norm.h (alloca, GCC case): Don't redefine alloca if it was alr eady defined previously. 1998-02-22 09:46:27 -07:00
alloca.c
argv.c typo typo fixes fixes 1998-05-06 15:09:07 -06:00
asprintf.c asprintf.c: Consistently use either stdarg or varargs. 1997-10-16 01:39:03 -06:00
atexit.c
basename.c
bcmp.c
bcopy.c
bzero.c
ChangeLog Warning fixes: 1998-05-13 12:40:39 +00:00
choose-temp.c Patched in the gcc directory: 1998-04-02 11:07:45 +00:00
clock.c
concat.c
config.h-vms
config.table config.table: Make locating frag files failsafe even for the special case if... 1998-03-05 00:28:10 +00:00
configure.bat
configure.in
COPYING.LIB Update address. 1998-02-23 14:57:23 -07:00
copysign.c
cplus-dem.c Warning fixes: 1998-05-13 12:40:39 +00:00
dummy.c
fdmatch.c
floatformat.c
fnmatch.c
functions.def vmsbuild.com [...]: Synchronized with Makefile.in: Add fnmatch.o and objalloc.o; remove vasprintf.o. 1998-02-22 09:55:25 -07:00
getcwd.c
getopt1.c getopt.c: Update to latest FSF version. 1998-02-22 09:44:13 -07:00
getopt.c getopt.c: Update to latest FSF version. 1998-02-22 09:44:13 -07:00
getpagesize.c
getruntime.c
hex.c
index.c
insque.c
makefile.dos
Makefile.in alloca-norm.h (alloca, GCC case): Don't redefine alloca if it was alr eady defined previously. 1998-02-22 09:46:27 -07:00
makefile.vms
memchr.c
memcmp.c
memcpy.c
memmove.c
memset.c
mpw-config.in
mpw-make.sed
mpw.c typo typo fixes fixes 1998-05-06 15:09:07 -06:00
msdos.c
objalloc.c
obstack.c
pexecute.c Add mingw32 support. 1998-01-17 14:30:39 -07:00
random.c
README cplus-dem.c (demangle_signature): Don't look for return types on constructors. 1997-10-14 15:10:45 -04:00
rename.c
rindex.c
sigsetmask.c
spaces.c
strcasecmp.c
strchr.c
strdup.c
strerror.c
strncasecmp.c
strrchr.c
strsignal.c typo in last delta. 1997-12-04 22:55:31 -07:00
strstr.c
strtod.c
strtol.c
strtoul.c
tmpnam.c
vasprintf.c cplus-dem.c (gnu_special): Don't get confused by .<digits> strings that are not actually lengths. 1998-02-22 09:53:40 -07:00
vfork.c
vfprintf.c
vmsbuild.com vmsbuild.com [...]: Synchronized with Makefile.in: Add fnmatch.o and objalloc.o; remove vasprintf.o. 1998-02-22 09:55:24 -07:00
vprintf.c
vsprintf.c
waitpid.c
xatexit.c
xexit.c
xmalloc.c Add mingw32 support. 1998-01-17 14:30:39 -07:00
xstrdup.c
xstrerror.c

This directory contains the -liberty library of free software.
It is a collection of subroutines used by various GNU programs.
Current members include:

	getopt -- get options from command line
	obstack -- stacks of arbitrarily-sized objects
	strerror -- error message strings corresponding to errno
	strtol -- string-to-long conversion
	strtoul -- string-to-unsigned-long conversion

We expect many of the GNU subroutines that are floating around to
eventually arrive here.

The library must be configured from the top source directory.  Don't
try to run configure in this directory.  Follow the configuration
instructions in ../README.

Please report bugs and fixes to "bug-gnu-utils@prep.ai.mit.edu".  Thank you.

ADDING A NEW FILE
=================

There are two sets of files:  Those that are "required" will be
included in the library for all configurations, while those
that are "optional" will be included in the library only if "needed."

To add a new required file, edit Makefile to add the source file
name to CFILES and the object file to REQUIRED_OFILES.

Adding a new optional file is more fragile.  As a general rule,
an optional file will be included in the library if it provides
functionality missing in the "standard" C library.
For most hosts, the Makefile automatically figures out which
functionality is missing by compiling and linking a dummy test
program, and examining the error messages.

So to get this to work, you should do the following:

1) Select one function defined in the file you're adding.
For example, the getcwd function.
2) Add that function to the list in the file functions.def.
3) The name of the new file must be the same as the function
you've chosen with the .c suffix added.  E.g. getcwd() must be
defined in getcwd.c.  (The file can define other functions as well.)
4) In Makefile.in, add the name of the source file (e.g. getcwd.c)
to CFILES.

The file you've added (e.g. getcwd.c) should compile and work
on all hosts where it is needed (e.g. not found when linking
the dummy.c program).  It does not have to work or even
compile on hosts where it is not needed.

HOW THE AUTOMATIC CONFIGURATION WORKS
=====================================

The libiberty.a target (in RULE1) depends on $(DO_ALSO).
For normal configurations, DO_ALSO=needed-list.

So needed-list is first made.  The needed-list rule compiles
dummy.c.  Because dummy.c includes functions.def, the
resulting object file will contain a call to each of the
optional functions (for simplicity assume each optional file
defines a single function).  This object file will be linked
against the standard libraries (as defined by using $(CC)
and various flags).  Any function missing will causes the
linker to emit an error message.  We assume the name
of the missing function(s) are in the error message(s).
The awk script find-needed.awk has been generated from
functions.def.  It is used to search the linker output
messages for words that match the functions listed in
functions.def.  The list of functions found is written
on a single line to the file needed-list.

After needed-list has been generated, the libiberty.a
target (in RULE1) just calls 'make' recursively.
It passes the contents of needed-list using the
definition (expanded) HOST_OFILES="`cat needed-list`".
It also tells the inferior 'make' to use RULE2.

The inferior 'make' is very conventional:  The main
rule is $(RULE2) (which is libiberty.a).  It depends
on a list of object files: $(REQUIRED_OFILES) $(HOST_OFILES)
(and $(EXTRA_OFILES), which is usually empty).  The superior
'make' passes in $(HOST_OFILES); the others are fixed
in the Makefile.

ADDING A NEW CONFIGURATION
==========================

On most hosts you should be able to use the scheme for automatically
figuring out which files are needed.  In that case, you probably
don't need a special Makefile stub for that configuration.

If the fully automatic scheme doesn't work, you may be able to get
by with defining EXTRA_OFILES in your Makefile stub.  This is
a list of object file names that should be treated as required
for this configuration - they will be included in libiberty.a,
regardless of whatever might be in the C library.  Moreover,
when the dummy.c program is linked, it will be linked with
$(EXTRA_OFILES).  Therefore, if a function in functions.def
is defined by one of the EXTRA_OFILES, it will not be listed as
"needed".  Thus if your hal9000 host needs a special implementation
of getcwd, you can just create hal9000-getcwd.c, and define:
	EXTRA_OFILES=hal9000-getcwd.o
Or if you want to use the libiberty version of strstr(),
even though there is a version in the C library (it might be
buggy or slow), just define:
	EXTRA_OFILES=strstr.o

You can create a "manual" host configuration FOO with a file
config/mh-FOO.  In it, the HOST_OFILES macro should explicitly
list that subset of the optional files that should be in the
library.  You should also set:
	DO_ALSO =
This overrides all of the magic needed to automatically
determine which files are "needed."  However, keeping that list
up to date is another matter...

HOW THE MANUAL CONFIGURATION WORKS
==================================

This also uses a recursive make, but the superior make
does not do anything interesting - it just calls the
inferior make with HOST_OFILES defined as $(HOST_OFILES),
which is the list you created in your configuration.

You probably don't want to depend on manual configuration,
because keeping the HOST_OFILES list up-to-date will be a pain.