gcc/gcc
Paolo Carlini e24313f349 re PR c++/36870 (__has_nothrow_constructor violates the ODR)
/cp
2008-07-21  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/36870
	* semantics.c (classtype_has_nothrow_assign_or_copy_p): Use
	TYPE_NOTHROW_P, not TREE_NOTHROW.
	(trait_expr_value): Likewise.

/testsuite
2008-07-21  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/36870
	* g++.dg/ext/has_nothrow_assign_odr.C: New.
	* g++.dg/ext/has_nothrow_copy_odr.C: Likewise.
	* g++.dg/ext/has_nothrow_constructor_odr.C: Likewise.
	* g++.dg/ext/has_nothrow_assign.C: Adjust.
	* g++.dg/ext/has_nothrow_copy.C: Likewise.
	* g++.dg/ext/has_nothrow_constructor.C: Likewise.

From-SVN: r138024
2008-07-21 09:08:41 +00:00
..
ada * gnathtml.pl: New file. 2008-07-20 22:31:59 +02:00
config extend.texi (flatten attribute): Remove note about unit-at-a-time 2008-07-20 14:57:17 +00:00
cp re PR c++/36870 (__has_nothrow_constructor violates the ODR) 2008-07-21 09:08:41 +00:00
doc extend.texi (flatten attribute): Remove note about unit-at-a-time 2008-07-20 14:57:17 +00:00
fortran re PR fortran/36795 (crash with character allocatable array argument) 2008-07-19 20:29:18 +02:00
ginclude
java * lang.c (java_init_options): Enable unit-at-a-time by default. 2008-07-15 10:57:37 +00:00
objc objc-act.c (objc_start_class_interface, [...]): Avoid C++ keywords. 2008-07-18 17:16:25 +00:00
objcp tree.h (enum tree_code): Include all-tree.def, not tree.def. 2008-06-21 21:17:40 +00:00
po
testsuite re PR c++/36870 (__has_nothrow_constructor violates the ODR) 2008-07-21 09:08:41 +00:00
ABOUT-GCC-NLS
BASE-VER
COPYING
COPYING.LIB
COPYING3
COPYING3.LIB
ChangeLog [multiple changes] 2008-07-21 06:54:34 +00:00
ChangeLog-1997
ChangeLog-1998
ChangeLog-1999
ChangeLog-2000
ChangeLog-2001
ChangeLog-2002
ChangeLog-2003
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog.dataflow
ChangeLog.lib
ChangeLog.ptr
ChangeLog.tree-ssa
DATESTAMP Daily bump. 2008-07-21 00:16:30 +00:00
DEV-PHASE
FSFChangeLog
FSFChangeLog.10
FSFChangeLog.11
LANGUAGES
Makefile.in check_makefile_deps.sh: New file. 2008-07-14 18:40:35 +00:00
ONEWS
README.Portability
acinclude.m4 configure.ac: Drop unneeded backslash ending up in config.in. 2008-06-02 19:37:45 +00:00
aclocal.m4
addresses.h
alias.c alias.c (record_alias_subset, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:28:15 +00:00
alias.h
alloc-pool.c alloc-pool.c (hash_descriptor, [...]): Fix -Wc++-compat warnings. 2008-07-04 00:22:31 +00:00
alloc-pool.h
attribs.c alias.c (record_alias_subset, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:28:15 +00:00
auto-inc-dec.c rtlanal.c (add_reg_note): New function. 2008-07-02 18:01:18 +00:00
basic-block.h cfganal.c: Include vec.h and vecprim.h. 2008-06-26 20:06:49 +00:00
bb-reorder.c rtlanal.c (add_reg_note): New function. 2008-07-02 18:01:18 +00:00
bitmap.c alloc-pool.c (hash_descriptor, [...]): Fix -Wc++-compat warnings. 2008-07-04 00:22:31 +00:00
bitmap.h bitmap.h (bitmap_set_bit): Return bool. 2008-07-02 08:07:41 +00:00
bt-load.c bt-load.c (add_btr_def, [...]): Avoid C++ keywords. 2008-07-15 17:34:40 +00:00
builtin-attrs.def
builtin-types.def targhooks.h (struct gcc_target): New member unwind_word_mode. 2008-06-18 20:49:12 +00:00
builtins.c builtins.c (expand_builtin_int_roundingfn, [...]): Do not take subtarget argument; it is not useful. 2008-07-20 09:50:30 +00:00
builtins.def targhooks.h (struct gcc_target): New member unwind_word_mode. 2008-06-18 20:49:12 +00:00
c-aux-info.c
c-common.c c-common.c (c_stddef_cpp_builtins): Define __CHAR16_TYPE__ and __CHAR32_TYPE__. 2008-07-18 20:23:42 +00:00
c-common.def
c-common.h cpplib.h (NODE_CONDITIONAL): New. 2008-07-14 15:09:48 +10:00
c-config-lang.in
c-convert.c
c-cppbuiltin.c c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to 200805. 2008-06-06 15:01:54 +02:00
c-decl.c c-decl.c (merge_decls): Keep DECL_SOURCE_LOCATION and DECL_IN_SYSTEM_HEADER in sync. 2008-07-16 09:14:27 +00:00
c-dump.c
c-errors.c
c-format.c c-format.c (handle_format_attribute): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-27 16:53:54 +00:00
c-format.h c-lex.c (narrowest_unsigned_type): Change itk to int. 2008-06-22 14:56:08 +00:00
c-gimplify.c
c-lang.c tree.h (enum tree_code): Include all-tree.def, not tree.def. 2008-06-21 21:17:40 +00:00
c-lex.c re PR c/34867 (valgrind error indication in testsuite from c-lex.c:996:c_lex_with_flags for gcc.dg/cpp/charconst.c) 2008-06-27 12:29:55 +00:00
c-objc-common.c
c-objc-common.h
c-omp.c c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to 200805. 2008-06-06 15:01:54 +02:00
c-opts.c c-opts.c (c_common_post_options): PCH is not compatible with no-unit-at-a-time. 2008-06-18 19:07:51 +00:00
c-parser.c c-common.h (enum rid): Add RID_CXX_COMPAT_WARN. 2008-07-11 18:16:26 +00:00
c-pch.c c-pch.c (get_ident): Avoid C++ keywords. 2008-07-16 17:55:42 +00:00
c-ppoutput.c
c-pragma.c c-format.c (handle_format_attribute): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-27 16:53:54 +00:00
c-pragma.h c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to 200805. 2008-06-06 15:01:54 +02:00
c-pretty-print.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
c-pretty-print.h
c-semantics.c
c-tree.h c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to 200805. 2008-06-06 15:01:54 +02:00
c-typeck.c c-common.c (c_stddef_cpp_builtins): Define __CHAR16_TYPE__ and __CHAR32_TYPE__. 2008-07-18 20:23:42 +00:00
c.opt omp-low.c (extract_omp_for_data): Fix comment typo. 2008-06-15 09:55:56 +00:00
caller-save.c bt-load.c (add_btr_def, [...]): Avoid C++ keywords. 2008-07-15 17:34:40 +00:00
calls.c rtlanal.c (add_reg_note): New function. 2008-07-02 18:01:18 +00:00
cfg.c cfg.c (dump_reg_info): Avoid C++ keywords. 2008-07-16 17:49:20 +00:00
cfganal.c cfganal.c: Include vec.h and vecprim.h. 2008-06-26 20:06:49 +00:00
cfgbuild.c rtl.h (emit_clobber, [...]): Declare. 2008-06-01 09:47:28 +00:00
cfgcleanup.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
cfgexpand.c rtlanal.c (add_reg_note): New function. 2008-07-02 18:01:18 +00:00
cfghooks.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
cfghooks.h
cfglayout.c rtlanal.c (add_reg_note): New function. 2008-07-02 18:01:18 +00:00
cfglayout.h
cfgloop.c
cfgloop.h
cfgloopanal.c
cfgloopmanip.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
cfgrtl.c rtlanal.c (add_reg_note): New function. 2008-07-02 18:01:18 +00:00
cgraph.c cgraph.c (cgraph_add_new_function): Do early local passes. 2008-07-20 16:06:51 +00:00
cgraph.h cgraph.h (varpool_empty_needed_queue): Declare. 2008-07-16 21:38:15 +00:00
cgraphbuild.c re PR c++/36523 (OpenMP task construct fails to instantiate copy constructor) 2008-06-20 04:18:07 +02:00
cgraphunit.c cgraph.h (varpool_empty_needed_queue): Declare. 2008-07-16 21:38:15 +00:00
collect2.c collect2.c (scan_prog_file, [...]): Use CONST_CAST instead of bare conversion to cast const-ness away. 2008-07-16 16:20:31 +00:00
collect2.h
combine-stack-adj.c c-pch.c (get_ident): Avoid C++ keywords. 2008-07-16 17:55:42 +00:00
combine.c bt-load.c (add_btr_def, [...]): Avoid C++ keywords. 2008-07-15 17:34:40 +00:00
common.opt cgraph.c (cgraph_add_new_function): Do early local passes. 2008-07-20 16:06:51 +00:00
conditions.h
config.build
config.gcc config.gcc (arm*-*-eabi*): Include arm/eabi.h and use additional option file arm/eabi.opt. 2008-07-14 21:01:42 +00:00
config.host config.gcc (mips64el-st-linux-gnu): Use mips/st.h and mips/t-st. 2008-06-18 08:28:07 +00:00
config.in configure, config.in: Rebuilt. 2008-07-07 23:56:05 +00:00
configure Makefile.in (LOOSE_WARN, [...]): Update comments. 2008-07-10 18:45:25 +00:00
configure.ac Makefile.in (LOOSE_WARN, [...]): Update comments. 2008-07-10 18:45:25 +00:00
convert.c
convert.h
coretypes.h cpplib.h (NODE_CONDITIONAL): New. 2008-07-14 15:09:48 +10:00
coverage.c alias.c (record_alias_subset, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:28:15 +00:00
coverage.h
cppdefault.c
cppdefault.h
cppspec.c
crtstuff.c
cse.c bt-load.c (add_btr_def, [...]): Avoid C++ keywords. 2008-07-15 17:34:40 +00:00
cselib.c alias.c (record_alias_subset, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:28:15 +00:00
cselib.h Remove libcall notes. 2008-06-17 05:57:04 +00:00
cstamp-h.in
dbgcnt.c alias.c (record_alias_subset, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:28:15 +00:00
dbgcnt.def Fix PR tree-optimization/23455 Fix PR tree-optimization/35286 Fix PR tree-optimization/35287 2008-07-08 16:11:06 +00:00
dbgcnt.h
dbxout.c alias.c (record_alias_subset, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:28:15 +00:00
dbxout.h
dce.c df.h (struct df_ref): Replace 'insn' field with 'insn_info' field. 2008-06-18 05:42:23 +00:00
dce.h
ddg.c df.h (struct df_ref): Replace 'insn' field with 'insn_info' field. 2008-06-18 05:42:23 +00:00
ddg.h
debug.c
debug.h
defaults.h tm.texi (MALLOC_ABI_ALIGNMENT): New macro. 2008-07-19 17:49:18 +00:00
df-byte-scan.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
df-core.c On behalf of Tianwei, for the following change: 2008-07-08 17:08:40 +00:00
df-problems.c df-problems.c (df_set_note): Avoid C++ keywords. 2008-07-15 17:51:00 +00:00
df-scan.c df-problems.c (df_set_note): Avoid C++ keywords. 2008-07-15 17:51:00 +00:00
df.h alias.c (record_alias_subset, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:28:15 +00:00
dfp.c dfp.h, [...]: Remove references to IEEE 754R. 2008-06-19 11:13:53 +10:00
dfp.h dfp.h, [...]: Remove references to IEEE 754R. 2008-06-19 11:13:53 +10:00
diagnostic.c
diagnostic.def
diagnostic.h
dojump.c
dominance.c alias.c (record_alias_subset, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:28:15 +00:00
domwalk.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
domwalk.h
double-int.c
double-int.h
dse.c df-problems.c (df_set_note): Avoid C++ keywords. 2008-07-15 17:51:00 +00:00
dse.h
dummy-checksum.c
dwarf.h
dwarf2.h
dwarf2asm.c cfg.c (dump_reg_info): Avoid C++ keywords. 2008-07-16 17:49:20 +00:00
dwarf2asm.h
dwarf2out.c dwarf2out.c (add_subscript_info): New explicit COLLAPSE_P argument... 2008-07-19 06:41:30 +00:00
dwarf2out.h
ebitmap.c dwarf2out.c (new_cfi, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:25:08 +00:00
ebitmap.h
emit-rtl.c df-problems.c (df_set_note): Avoid C++ keywords. 2008-07-15 17:51:00 +00:00
emit-rtl.h
emutls.c
errors.c
errors.h
et-forest.c dwarf2out.c (new_cfi, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:25:08 +00:00
et-forest.h
except.c cfg.c (dump_reg_info): Avoid C++ keywords. 2008-07-16 17:49:20 +00:00
except.h * except.h: Correct checks for when SJLJ exceptions must be used. 2008-06-08 19:06:49 +00:00
exec-tool.in exec-tool.in: Use an environment variable (private) instead of a file (shared) as a semaphore... 2008-05-30 15:19:45 -04:00
explow.c df-problems.c (df_set_note): Avoid C++ keywords. 2008-07-15 17:51:00 +00:00
expmed.c cfg.c (dump_reg_info): Avoid C++ keywords. 2008-07-16 17:49:20 +00:00
expr.c expr.c (emit_block_move_via_movmem): Fix expected_align parameter. 2008-07-08 22:17:07 +00:00
expr.h config.gcc (extra_headers): Add cross-stdarg.h for target x86_64-*-* and i?86-*-*. 2008-07-06 16:51:58 +02:00
final.c c-pch.c (get_ident): Avoid C++ keywords. 2008-07-16 17:55:42 +00:00
fix-header.c re PR fortran/18428 (No preprocessing option -cpp for gfortran) 2008-05-25 18:37:41 -04:00
fixed-value.c
fixed-value.h
fixproto
flags.h invoke.texi (Option Summary): Mention new option -Wdisallowed-function-list=... 2008-07-09 08:23:48 +00:00
fold-const.c ptrmemfield.C: New testcase. 2008-07-05 12:37:48 -07:00
fp-test.c
function.c re PR middle-end/36858 (Incorrect alignment attribute on stack parameter) 2008-07-18 08:42:59 -07:00
function.h cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
fwprop.c re PR middle-end/36753 (Forward propagation interacts badly with global register variable) 2008-07-17 09:07:31 +00:00
gbl-ctors.h
gcc.c gcc.c (print_sysroot): New. 2008-07-07 18:20:06 +00:00
gcc.h
gccbug.in
gccspec.c
gcov-dump.c
gcov-io.c dwarf2out.c (new_cfi, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:25:08 +00:00
gcov-io.h
gcov-iov.c
gcov.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
gcse.c df-problems.c (df_set_note): Avoid C++ keywords. 2008-07-15 17:51:00 +00:00
gdbinit.in
gen-protos.c
genattr.c
genattrtab.c genattrtab.c (insert_right_side, [...]): Avoid C++ keywords. 2008-07-09 06:45:21 +00:00
genautomata.c cse.c (approx_reg_cost_1, cse_insn): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:22:12 +00:00
gencheck.c tree.h (enum tree_code): Include all-tree.def, not tree.def. 2008-06-21 21:17:40 +00:00
genchecksum.c
gencodes.c
genconditions.c
genconfig.c
genconstants.c
genemit.c genattrtab.c (insert_right_side, [...]): Avoid C++ keywords. 2008-07-09 06:45:21 +00:00
genextract.c cse.c (approx_reg_cost_1, cse_insn): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:22:12 +00:00
genflags.c
gengenrtl.c
gengtype-lex.l cse.c (approx_reg_cost_1, cse_insn): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:22:12 +00:00
gengtype-parse.c
gengtype.c genattrtab.c (insert_right_side, [...]): Avoid C++ keywords. 2008-07-09 06:45:21 +00:00
gengtype.h genattrtab.c (insert_right_side, [...]): Avoid C++ keywords. 2008-07-09 06:45:21 +00:00
genmddeps.c
genmodes.c
genmultilib
genopinit.c
genoutput.c genattrtab.c (insert_right_side, [...]): Avoid C++ keywords. 2008-07-09 06:45:21 +00:00
genpeep.c
genpreds.c cse.c (approx_reg_cost_1, cse_insn): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:22:12 +00:00
genrecog.c genattrtab.c (insert_right_side, [...]): Avoid C++ keywords. 2008-07-09 06:45:21 +00:00
gensupport.c genattrtab.c (insert_right_side, [...]): Avoid C++ keywords. 2008-07-09 06:45:21 +00:00
gensupport.h
ggc-common.c configure.ac: Check for caddr_t, define to char * if not defined. 2008-07-06 22:28:30 +02:00
ggc-none.c
ggc-page.c ggc-page.c (alloc_page): Substituting xmalloc... 2008-07-11 18:07:15 +00:00
ggc-zone.c ggc-zone.c (lookup_page_table_if_allocated, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-07-04 04:47:55 +00:00
ggc.h ggc.h (GGC_RESIZEVAR): New, reorder macros. 2008-06-20 18:34:07 +00:00
gimple-low.c c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to 200805. 2008-06-06 15:01:54 +02:00
gimplify.c gimplify.c (struct gimplify_ctx): Move to tree-gimple.h. 2008-07-09 21:32:54 +02:00
glimits.h
global.c cfg.c (dump_reg_info): Avoid C++ keywords. 2008-07-16 17:49:20 +00:00
graph.c cfg.c (dump_reg_info): Avoid C++ keywords. 2008-07-16 17:49:20 +00:00
graph.h
graphds.c
graphds.h
gstab.h
gsyms.h
gsyslimits.h
gthr-aix.h
gthr-dce.h
gthr-gnat.c
gthr-gnat.h
gthr-lynx.h cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
gthr-mipssde.h
gthr-nks.h
gthr-posix.c
gthr-posix.h
gthr-posix95.h
gthr-rtems.h
gthr-single.h
gthr-solaris.h
gthr-tpf.h
gthr-vxworks.h
gthr-win32.h
gthr.h
haifa-sched.c rtlanal.c (add_reg_note): New function. 2008-07-02 18:01:18 +00:00
hard-reg-set.h
hooks.c c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to 200805. 2008-06-06 15:01:54 +02:00
hooks.h c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to 200805. 2008-06-06 15:01:54 +02:00
host-default.c
hosthooks-def.h
hosthooks.h
hwint.h cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
ifcvt.c ifcvt.c (cond_move_process_if_block): Free vectors on false return. 2008-06-30 19:31:42 +00:00
incpath.c cpplib.h (struct cpp_dir): Add new field, canonical_name. 2008-05-30 00:57:56 +00:00
incpath.h re PR fortran/18428 (No preprocessing option -cpp for gfortran) 2008-05-25 18:37:41 -04:00
init-regs.c
input.h
insn-addr.h
insn-notes.def
integrate.c driver-i386.c (detect_caches_amd, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:18:25 +00:00
integrate.h
intl.c alloc-pool.c (create_alloc_pool): Fix -Wc++-compat warnings. 2008-06-29 04:39:16 +00:00
intl.h
ipa-cp.c ipa-cp.c (ipcp_print_all_lattices): New variable info... 2008-07-17 15:23:32 +02:00
ipa-inline.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
ipa-prop.c ipa-cp.c (ipcp_print_all_lattices): New variable info... 2008-07-17 15:23:32 +02:00
ipa-prop.h ipa-cp.c (ipcp_print_all_lattices): New variable info... 2008-07-17 15:23:32 +02:00
ipa-pure-const.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
ipa-reference.c
ipa-reference.h
ipa-struct-reorg.c driver-i386.c (detect_caches_amd, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:18:25 +00:00
ipa-struct-reorg.h cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
ipa-type-escape.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
ipa-type-escape.h
ipa-utils.c
ipa-utils.h
ipa.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
jump.c rtlanal.c (add_reg_note): New function. 2008-07-02 18:01:18 +00:00
lambda-code.c
lambda-mat.c
lambda-trans.c
lambda.h
langhooks-def.h c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to 200805. 2008-06-06 15:01:54 +02:00
langhooks.c re PR middle-end/36811 (endless (?) loop building with -O3) 2008-07-13 17:28:26 +00:00
langhooks.h c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to 200805. 2008-06-06 15:01:54 +02:00
lcm.c df-problems.c (df_set_note): Avoid C++ keywords. 2008-07-15 17:51:00 +00:00
libada-mk.in
libfuncs.h libfuncs.h (LTI_synchronize): New libfunc_index. 2008-06-26 21:28:30 +00:00
libgcc-std.ver Fix conflict with another recent patch. 2008-07-03 19:42:41 +00:00
libgcc2.c MAINTAINERS (mt port): Remove. 2008-06-07 19:00:15 +01:00
libgcc2.h
libgcov.c
limitx.h
limity.h
lists.c
local-alloc.c cfg.c (dump_reg_info): Avoid C++ keywords. 2008-07-16 17:49:20 +00:00
longlong.h longlong.h (__arm__): Define count_leading_zeros. 2008-06-12 17:29:47 +00:00
loop-doloop.c rtlanal.c (add_reg_note): New function. 2008-07-02 18:01:18 +00:00
loop-init.c
loop-invariant.c driver-i386.c (detect_caches_amd, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:18:25 +00:00
loop-iv.c driver-i386.c (detect_caches_amd, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:18:25 +00:00
loop-unroll.c driver-i386.c (detect_caches_amd, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:18:25 +00:00
loop-unswitch.c rtlanal.c (add_reg_note): New function. 2008-07-02 18:01:18 +00:00
lower-subreg.c df-problems.c (df_set_note): Avoid C++ keywords. 2008-07-15 17:51:00 +00:00
machmode.def
machmode.h
main.c
matrix-reorg.c driver-i386.c (detect_caches_amd, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:18:25 +00:00
mips-tdump.c
mips-tfile.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
mkconfig.sh
mkmap-flat.awk cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
mkmap-symver.awk re PR target/36669 (Wrong versioning for __float128) 2008-07-02 08:59:19 -07:00
mode-classes.def
mode-switching.c df-problems.c (df_set_note): Avoid C++ keywords. 2008-07-15 17:51:00 +00:00
modulo-sched.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
omega.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
omega.h
omp-builtins.def c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to 200805. 2008-06-06 15:01:54 +02:00
omp-low.c re PR middle-end/36877 (-O0 -fopenmp -march=i386 atomics) 2008-07-19 21:22:51 +02:00
opt-functions.awk
opt-gather.awk
optabs.c cfg.c (dump_reg_info): Avoid C++ keywords. 2008-07-16 17:49:20 +00:00
optabs.h cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
optc-gen.awk
opth-gen.awk
opts-common.c driver-i386.c (detect_caches_amd, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:18:25 +00:00
opts.c extend.texi (flatten attribute): Remove note about unit-at-a-time 2008-07-20 14:57:17 +00:00
opts.h
output.h
params.c driver-i386.c (detect_caches_amd, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:18:25 +00:00
params.def Makefile.in (tree-switch-conversion.o): Add. 2008-07-01 10:54:18 +02:00
params.h Makefile.in (tree-switch-conversion.o): Add. 2008-07-01 10:54:18 +02:00
passes.c cgraph.c (cgraph_add_new_function): Do early local passes. 2008-07-20 16:06:51 +00:00
pointer-set.c
pointer-set.h
postreload-gcse.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
postreload.c cfg.c (dump_reg_info): Avoid C++ keywords. 2008-07-16 17:49:20 +00:00
predict.c PR 35736 -- use void_type_node for PREDICT_EXPR tree 2008-07-03 16:22:12 +00:00
predict.def
predict.h
prefix.c
prefix.h
pretty-print.c
pretty-print.h cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
print-rtl.c
print-tree.c
profile.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
protoize.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
ra-conflict.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
ra.h cfg.c (dump_reg_info): Avoid C++ keywords. 2008-07-16 17:49:20 +00:00
read-rtl.c
real.c dfp.h, [...]: Remove references to IEEE 754R. 2008-06-19 11:13:53 +10:00
real.h dfp.h, [...]: Remove references to IEEE 754R. 2008-06-19 11:13:53 +10:00
recog.c [multiple changes] 2008-07-21 06:54:34 +00:00
recog.h reload.c: (find_reloads): Skip alternatives according to the "enabled" attribute. 2008-05-27 11:46:45 +00:00
reg-notes.def Remove libcall notes. 2008-06-17 05:57:04 +00:00
reg-stack.c cfg.c (dump_reg_info): Avoid C++ keywords. 2008-07-16 17:49:20 +00:00
regclass.c cfg.c (dump_reg_info): Avoid C++ keywords. 2008-07-16 17:49:20 +00:00
regmove.c rtlanal.c (add_reg_note): New function. 2008-07-02 18:01:18 +00:00
regrename.c cfg.c (dump_reg_info): Avoid C++ keywords. 2008-07-16 17:49:20 +00:00
regs.h cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
regstat.c ra.h (add_neighbor): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:12:56 +00:00
reload.c re PR target/36780 (Wrong reload generated for subreg address on SH) 2008-07-19 12:14:13 +01:00
reload.h c-pch.c (get_ident): Avoid C++ keywords. 2008-07-16 17:55:42 +00:00
reload1.c c-pch.c (get_ident): Avoid C++ keywords. 2008-07-16 17:55:42 +00:00
reorg.c rtlanal.c (add_reg_note): New function. 2008-07-02 18:01:18 +00:00
resource.c resource.c (mark_referenced_resources): Look inside UNSPEC_VOLATILEs and ASM_INPUTs. 2008-07-02 18:05:42 +00:00
resource.h
rtl-error.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
rtl-factoring.c ra.h (add_neighbor): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:12:56 +00:00
rtl.c ra.h (add_neighbor): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:12:56 +00:00
rtl.def
rtl.h rtlanal.c (add_reg_note): New function. 2008-07-02 18:01:18 +00:00
rtlanal.c recog.c (validate_change_1, [...]): Avoid C++ keywords. 2008-07-16 17:52:19 +00:00
rtlhooks-def.h
rtlhooks.c recog.c (validate_change_1, [...]): Avoid C++ keywords. 2008-07-16 17:52:19 +00:00
sbitmap.c ra.h (add_neighbor): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:12:56 +00:00
sbitmap.h
scan-decls.c
scan-types.sh
scan.c
scan.h cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
sched-deps.c Remove libcall notes. 2008-06-17 05:57:04 +00:00
sched-ebb.c recog.c (validate_change_1, [...]): Avoid C++ keywords. 2008-07-16 17:52:19 +00:00
sched-int.h Remove libcall notes. 2008-06-17 05:57:04 +00:00
sched-rgn.c recog.c (validate_change_1, [...]): Avoid C++ keywords. 2008-07-16 17:52:19 +00:00
sched-vis.c
sdbout.c c-format.c (handle_format_attribute): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-27 16:53:54 +00:00
sdbout.h
see.c ra.h (add_neighbor): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:12:56 +00:00
simplify-rtx.c re PR middle-end/36447 (simplify_subreg ICE with right shift more than length type AVR) 2008-06-09 22:38:34 +00:00
sort-protos
sparseset.c
sparseset.h
sreal.c
sreal.h
stab.def
stack-ptr-mod.c
statistics.c ra.h (add_neighbor): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:12:56 +00:00
statistics.h
stmt.c ra.h (add_neighbor): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:12:56 +00:00
stor-layout.c recog.c (validate_change_1, [...]): Avoid C++ keywords. 2008-07-16 17:52:19 +00:00
stringpool.c ra.h (add_neighbor): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:12:56 +00:00
stub-objc.c
sync-builtins.def
sys-protos.h
sys-types.h
system.h optabs.c (libfunc_decl_hash, [...]): Fix -Wcast-qual warnings. 2008-06-29 05:36:20 +00:00
target-def.h target.h (struct gcc_target): Add hard_regno_scratch_ok field. 2008-07-09 17:43:11 +04:00
target.h target.h (struct gcc_target): Add hard_regno_scratch_ok field. 2008-07-09 17:43:11 +04:00
targhooks.c c-pch.c (get_ident): Avoid C++ keywords. 2008-07-16 17:55:42 +00:00
targhooks.h target.h (struct gcc_target): Add hard_regno_scratch_ok field. 2008-07-09 17:43:11 +04:00
timevar.c
timevar.def tree-switch-conversion.c: Included timevar.h 2008-07-02 11:59:34 +02:00
timevar.h
tlink.c collect2.c (main, [...]): Fix for -Wc++-compat. 2008-06-20 03:46:09 +00:00
toplev.c
toplev.h
tracer.c ggc.h (GGC_RESIZEVAR): New, reorder macros. 2008-06-20 18:34:07 +00:00
tree-affine.c ggc.h (GGC_RESIZEVAR): New, reorder macros. 2008-06-20 18:34:07 +00:00
tree-affine.h
tree-browser.c tree.h (enum tree_code): Include all-tree.def, not tree.def. 2008-06-21 21:17:40 +00:00
tree-browser.def
tree-call-cdce.c re PR testsuite/36440 (FAIL: g++.dg/cdce3.C on powerpc-apple-darwin8.5.0) 2008-07-13 22:27:58 +00:00
tree-cfg.c re PR debug/36617 (Debug info for OpenMP code is almost non-existent) 2008-06-27 21:42:32 +02:00
tree-cfgcleanup.c
tree-chrec.c
tree-chrec.h
tree-complex.c ggc.h (GGC_RESIZEVAR): New, reorder macros. 2008-06-20 18:34:07 +00:00
tree-data-ref.c ra.h (add_neighbor): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:12:56 +00:00
tree-data-ref.h
tree-dfa.c tree-ssa-structalias.c (callused_id, [...]): Add. 2008-06-28 13:17:20 +00:00
tree-dump.c tree-ssa-structalias.c (compute_points_to_sets): Add call to dump_constraint_graph. 2008-07-07 20:17:37 +00:00
tree-dump.h
tree-eh.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
tree-flow-inline.h tree-ssa-sccvn.c (pre_info): Remove. 2008-07-14 15:38:49 +00:00
tree-flow.h tree-ssa-sccvn.c (pre_info): Remove. 2008-07-14 15:38:49 +00:00
tree-gimple.c c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to 200805. 2008-06-06 15:01:54 +02:00
tree-gimple.h gimplify.c (struct gimplify_ctx): Move to tree-gimple.h. 2008-07-09 21:32:54 +02:00
tree-if-conv.c ggc.h (GGC_RESIZEVAR): New, reorder macros. 2008-06-20 18:34:07 +00:00
tree-inline.c gimplify.c (struct gimplify_ctx): Move to tree-gimple.h. 2008-07-09 21:32:54 +02:00
tree-inline.h
tree-into-ssa.c tree-into-ssa (insert_phi_nodes_for): 'var' must be a DECL at this point, so assert that. 2008-06-26 20:11:07 +00:00
tree-iterator.c ggc.h (GGC_RESIZEVAR): New, reorder macros. 2008-06-20 18:34:07 +00:00
tree-iterator.h
tree-loop-distribution.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
tree-loop-linear.c
tree-mudflap.c gimplify.c (struct gimplify_ctx): Move to tree-gimple.h. 2008-07-09 21:32:54 +02:00
tree-mudflap.h
tree-nested.c ggc.h (GGC_RESIZEVAR): New, reorder macros. 2008-06-20 18:34:07 +00:00
tree-nomudflap.c
tree-nrv.c cgraph.c (cgraph_add_new_function): Do early local passes. 2008-07-20 16:06:51 +00:00
tree-object-size.c
tree-optimize.c cgraph.c (cgraph_add_new_function): Do early local passes. 2008-07-20 16:06:51 +00:00
tree-outof-ssa.c re PR target/36713 (r137252 breaks -O2 optimization on x86_64-unknown-linux-gnu) 2008-07-07 15:11:29 +00:00
tree-parloops.c ggc.h (GGC_RESIZEVAR): New, reorder macros. 2008-06-20 18:34:07 +00:00
tree-pass.h Makefile.in (tree-switch-conversion.o): Add. 2008-07-01 10:54:18 +02:00
tree-phinodes.c ggc.h (GGC_RESIZEVAR): New, reorder macros. 2008-06-20 18:34:07 +00:00
tree-predcom.c ggc.h (GGC_RESIZEVAR): New, reorder macros. 2008-06-20 18:34:07 +00:00
tree-pretty-print.c Fix PR tree-optimization/23455 Fix PR tree-optimization/35286 Fix PR tree-optimization/35287 2008-07-08 16:11:06 +00:00
tree-profile.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
tree-scalar-evolution.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
tree-scalar-evolution.h re PR tree-optimization/34244 (VRP/SCEV miscompiles Firefox) 2008-05-31 13:01:10 +00:00
tree-sra.c gimplify.c (struct gimplify_ctx): Move to tree-gimple.h. 2008-07-09 21:32:54 +02:00
tree-ssa-address.c re PR tree-optimization/36245 (internal compiler error: in build2_stat, at tree.c:3116) 2008-05-27 13:10:18 +00:00
tree-ssa-alias-warnings.c re PR tree-optimization/36345 (TBAA-pruning of points-to sets ineffective) 2008-06-12 10:21:45 +00:00
tree-ssa-alias.c re PR tree-optimization/36765 (Revision 137573 miscompiles 464.h264ref in SPEC CPU 2006) 2008-07-11 12:44:26 +00:00
tree-ssa-ccp.c tree-ssa-sccvn.c (pre_info): Remove. 2008-07-14 15:38:49 +00:00
tree-ssa-coalesce.c cgraph.c (cgraph_add_new_function): Do early local passes. 2008-07-20 16:06:51 +00:00
tree-ssa-copy.c
tree-ssa-copyrename.c
tree-ssa-dce.c
tree-ssa-dom.c Fix PR tree-optimization/23455 Fix PR tree-optimization/35286 Fix PR tree-optimization/35287 2008-07-08 16:11:06 +00:00
tree-ssa-dse.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
tree-ssa-forwprop.c tree-ssa-forwprop.c (can_propagate_from): Exclude loads from decls explicitly. 2008-07-02 11:25:26 +00:00
tree-ssa-ifcombine.c tree-ssa-ifcombine.c (get_name_for_bit_test): Use CONVERT_EXPR_P. 2008-06-02 11:45:27 +02:00
tree-ssa-live.c cgraph.c (cgraph_add_new_function): Do early local passes. 2008-07-20 16:06:51 +00:00
tree-ssa-live.h cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
tree-ssa-loop-ch.c
tree-ssa-loop-im.c ggc.h (GGC_RESIZEVAR): New, reorder macros. 2008-06-20 18:34:07 +00:00
tree-ssa-loop-ivcanon.c
tree-ssa-loop-ivopts.c tree-flow.h (loop_only_exit_p): Declare. 2008-07-03 22:02:18 +00:00
tree-ssa-loop-manip.c
tree-ssa-loop-niter.c tree-flow.h (loop_only_exit_p): Declare. 2008-07-03 22:02:18 +00:00
tree-ssa-loop-prefetch.c re PR tree-optimization/36504 (ICE when building xorg-server with -O3 -fprefetch-loop-arrays) 2008-06-24 12:06:17 +02:00
tree-ssa-loop-unswitch.c
tree-ssa-loop.c
tree-ssa-math-opts.c
tree-ssa-operands.c tree-ssa-structalias.c (callused_id, [...]): Add. 2008-06-28 13:17:20 +00:00
tree-ssa-operands.h
tree-ssa-phiopt.c ra.h (add_neighbor): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-26 00:12:56 +00:00
tree-ssa-phiprop.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
tree-ssa-pre.c re PR bootstrap/36864 (Yet another bootstrap failure on i686-apple-darwin9) 2008-07-19 22:02:29 +02:00
tree-ssa-propagate.c tree-ssa-propagate.c (set_rhs): Preserve the histogram and the eh region information. 2008-05-28 20:15:10 +00:00
tree-ssa-propagate.h
tree-ssa-reassoc.c
tree-ssa-sccvn.c re PR bootstrap/36864 (Yet another bootstrap failure on i686-apple-darwin9) 2008-07-19 22:02:29 +02:00
tree-ssa-sccvn.h re PR bootstrap/36864 (Yet another bootstrap failure on i686-apple-darwin9) 2008-07-19 22:02:29 +02:00
tree-ssa-sink.c tree-flow.h (may_point_to_global_var): Declare. 2008-06-11 09:22:27 +00:00
tree-ssa-structalias.c tree-ssa-structalias.c (compute_points_to_sets): Add call to dump_constraint_graph. 2008-07-07 20:17:37 +00:00
tree-ssa-structalias.h tree-ssa-structalias.c (compute_points_to_sets): Add call to dump_constraint_graph. 2008-07-07 20:17:37 +00:00
tree-ssa-ter.c cgraph.c (cgraph_add_new_function): Do early local passes. 2008-07-20 16:06:51 +00:00
tree-ssa-threadedge.c Fix PR tree-optimization/23455 Fix PR tree-optimization/35286 Fix PR tree-optimization/35287 2008-07-08 16:11:06 +00:00
tree-ssa-threadupdate.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
tree-ssa-uncprop.c
tree-ssa.c tree-ssa-structalias.c (callused_id, [...]): Add. 2008-06-28 13:17:20 +00:00
tree-ssanames.c
tree-stdarg.c config.gcc (extra_headers): Add cross-stdarg.h for target x86_64-*-* and i?86-*-*. 2008-07-06 16:51:58 +02:00
tree-stdarg.h
tree-switch-conversion.c re PR tree-optimization/36879 (undefined reference to a variable) 2008-07-20 10:51:48 -07:00
tree-tailcall.c re PR target/36713 (r137252 breaks -O2 optimization on x86_64-unknown-linux-gnu) 2008-07-07 15:11:29 +00:00
tree-vect-analyze.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
tree-vect-generic.c
tree-vect-patterns.c
tree-vect-transform.c re PR tree-optimization/36648 (segfault in global constructor with -O3) 2008-06-30 11:43:55 +00:00
tree-vectorizer.c ggc.h (GGC_RESIZEVAR): New, reorder macros. 2008-06-20 18:34:07 +00:00
tree-vectorizer.h
tree-vrp.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
tree.c re PR middle-end/36369 (may_alias broken with previous uses of non attributed type in some cases) 2008-07-15 15:07:46 +00:00
tree.def Fix PR tree-optimization/23455 Fix PR tree-optimization/35286 Fix PR tree-optimization/35287 2008-07-08 16:11:06 +00:00
tree.h cgraph.c (assembler_name_hash): New static var. 2008-07-13 10:06:19 +00:00
treestruct.def Fix PR tree-optimization/23455 Fix PR tree-optimization/35286 Fix PR tree-optimization/35287 2008-07-08 16:11:06 +00:00
tsystem.h
typeclass.h
unwind-c.c
unwind-compat.c
unwind-compat.h
unwind-dw2-fde-compat.c
unwind-dw2-fde-darwin.c
unwind-dw2-fde-glibc.c
unwind-dw2-fde.c cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
unwind-dw2-fde.h
unwind-dw2.c
unwind-dw2.h
unwind-generic.h targhooks.h (struct gcc_target): New member unwind_word_mode. 2008-06-18 20:49:12 +00:00
unwind-pe.h re PR target/34780 (Bootstrapping libstdc++-v3 failed) 2008-07-07 18:16:04 +00:00
unwind-sjlj.c
unwind.inc cgraph.c: Fix typos in comments. 2008-06-06 05:42:00 +00:00
value-prof.c ggc.h (GGC_RESIZEVAR): New, reorder macros. 2008-06-20 18:34:07 +00:00
value-prof.h tree-ssa-propagate.c (set_rhs): Preserve the histogram and the eh region information. 2008-05-28 20:15:10 +00:00
var-tracking.c ggc.h (GGC_RESIZEVAR): New, reorder macros. 2008-06-20 18:34:07 +00:00
varasm.c c-pch.c (get_ident): Avoid C++ keywords. 2008-07-16 17:55:42 +00:00
varpool.c cgraph.h (varpool_empty_needed_queue): Declare. 2008-07-16 21:38:15 +00:00
varray.c alloc-pool.c (hash_descriptor, [...]): Fix -Wc++-compat warnings. 2008-07-04 00:22:31 +00:00
varray.h
vec.c ggc.h (GGC_RESIZEVAR): New, reorder macros. 2008-06-20 18:34:07 +00:00
vec.h re PR bootstrap/33304 (Bootstrap failure on solaris2 using cc due to empty macro arguments) 2008-07-03 10:31:03 +00:00
vecprim.h
version.c
version.h
vmsdbg.h
vmsdbgout.c alpha.c (alpha_need_linkage, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-07-02 06:43:45 +00:00
web.c df.h (struct df_ref): Replace 'insn' field with 'insn_info' field. 2008-06-18 05:42:23 +00:00
xcoff.h
xcoffout.c c-format.c (handle_format_attribute): Fix -Wc++-compat and/or -Wcast-qual warnings. 2008-06-27 16:53:54 +00:00
xcoffout.h

README.Portability

Copyright (C) 2000, 2003 Free Software Foundation, Inc.

This file is intended to contain a few notes about writing C code
within GCC so that it compiles without error on the full range of
compilers GCC needs to be able to compile on.

The problem is that many ISO-standard constructs are not accepted by
either old or buggy compilers, and we keep getting bitten by them.
This knowledge until know has been sparsely spread around, so I
thought I'd collect it in one useful place.  Please add and correct
any problems as you come across them.

I'm going to start from a base of the ISO C90 standard, since that is
probably what most people code to naturally.  Obviously using
constructs introduced after that is not a good idea.

For the complete coding style conventions used in GCC, please read
http://gcc.gnu.org/codingconventions.html


String literals
---------------

Irix6 "cc -n32" and OSF4 "cc" have problems with constant string
initializers with parens around it, e.g.

const char string[] = ("A string");

This is unfortunate since this is what the GNU gettext macro N_
produces.  You need to find a different way to code it.

Some compilers like MSVC++ have fairly low limits on the maximum
length of a string literal; 509 is the lowest we've come across.  You
may need to break up a long printf statement into many smaller ones.


Empty macro arguments
---------------------

ISO C (6.8.3 in the 1990 standard) specifies the following:

If (before argument substitution) any argument consists of no
preprocessing tokens, the behavior is undefined.

This was relaxed by ISO C99, but some older compilers emit an error,
so code like

#define foo(x, y) x y
foo (bar, )

needs to be coded in some other way.


free and realloc
----------------

Some implementations crash upon attempts to free or realloc the null
pointer.  Thus if mem might be null, you need to write

  if (mem)
    free (mem);


Trigraphs
---------

You weren't going to use them anyway, but some otherwise ISO C
compliant compilers do not accept trigraphs.


Suffixes on Integer Constants
-----------------------------

You should never use a 'l' suffix on integer constants ('L' is fine),
since it can easily be confused with the number '1'.


			Common Coding Pitfalls
			======================

errno
-----

errno might be declared as a macro.


Implicit int
------------

In C, the 'int' keyword can often be omitted from type declarations.
For instance, you can write

  unsigned variable;

as shorthand for

  unsigned int variable;

There are several places where this can cause trouble.  First, suppose
'variable' is a long; then you might think

  (unsigned) variable

would convert it to unsigned long.  It does not.  It converts to
unsigned int.  This mostly causes problems on 64-bit platforms, where
long and int are not the same size.

Second, if you write a function definition with no return type at
all:

  operate (int a, int b)
  {
    ...
  }

that function is expected to return int, *not* void.  GCC will warn
about this.

Implicit function declarations always have return type int.  So if you
correct the above definition to

  void
  operate (int a, int b)
  ...

but operate() is called above its definition, you will get an error
about a "type mismatch with previous implicit declaration".  The cure
is to prototype all functions at the top of the file, or in an
appropriate header.

Char vs unsigned char vs int
----------------------------

In C, unqualified 'char' may be either signed or unsigned; it is the
implementation's choice.  When you are processing 7-bit ASCII, it does
not matter.  But when your program must handle arbitrary binary data,
or fully 8-bit character sets, you have a problem.  The most obvious
issue is if you have a look-up table indexed by characters.

For instance, the character '\341' in ISO Latin 1 is SMALL LETTER A
WITH ACUTE ACCENT.  In the proper locale, isalpha('\341') will be
true.  But if you read '\341' from a file and store it in a plain
char, isalpha(c) may look up character 225, or it may look up
character -31.  And the ctype table has no entry at offset -31, so
your program will crash.  (If you're lucky.)

It is wise to use unsigned char everywhere you possibly can.  This
avoids all these problems.  Unfortunately, the routines in <string.h>
take plain char arguments, so you have to remember to cast them back
and forth - or avoid the use of strxxx() functions, which is probably
a good idea anyway.

Another common mistake is to use either char or unsigned char to
receive the result of getc() or related stdio functions.  They may
return EOF, which is outside the range of values representable by
char.  If you use char, some legal character value may be confused
with EOF, such as '\377' (SMALL LETTER Y WITH UMLAUT, in Latin-1).
The correct choice is int.

A more subtle version of the same mistake might look like this:

  unsigned char pushback[NPUSHBACK];
  int pbidx;
  #define unget(c) (assert(pbidx < NPUSHBACK), pushback[pbidx++] = (c))
  #define get(c) (pbidx ? pushback[--pbidx] : getchar())
  ...
  unget(EOF);

which will mysteriously turn a pushed-back EOF into a SMALL LETTER Y
WITH UMLAUT.


Other common pitfalls
---------------------

o Expecting 'plain' char to be either sign or unsigned extending.

o Shifting an item by a negative amount or by greater than or equal to
  the number of bits in a type (expecting shifts by 32 to be sensible
  has caused quite a number of bugs at least in the early days).

o Expecting ints shifted right to be sign extended.

o Modifying the same value twice within one sequence point.

o Host vs. target floating point representation, including emitting NaNs
  and Infinities in a form that the assembler handles.

o qsort being an unstable sort function (unstable in the sense that
  multiple items that sort the same may be sorted in different orders
  by different qsort functions).

o Passing incorrect types to fprintf and friends.

o Adding a function declaration for a module declared in another file to
  a .c file instead of to a .h file.