Name Date Size #Lines LOC

..04-Apr-2024-

config/H08-May-2022-568,291414,185

cp/H08-May-2022-140,18097,690

doc/H30-Oct-2023-65,33854,582

f/H08-May-2022-164,386123,691

fixinc/H08-May-2022-27,93017,021

ginclude/H08-May-2022-828463

intl/H08-May-2022-8,9666,065

java/H08-May-2022-95,68672,907

objc/H08-May-2022-9,4846,745

po/H08-May-2022-244,715191,353

testsuite/H08-May-2022-251,513172,820

treelang/H08-May-2022-5,1573,679

ABOUT-GCC-NLSH A D08-May-20222 KiB4335

ABOUT-NLSH A D08-May-202218.4 KiB325283

COPYINGH A D08-May-202217.6 KiB341281

COPYING.LIBH A D08-May-202225.8 KiB

ChangeLogH A D08-May-2022680.8 KiB20,15814,872

ChangeLog.0H A D08-May-2022461.8 KiB13,0129,263

ChangeLog.1H A D08-May-2022577.7 KiB15,90411,671

ChangeLog.2H A D08-May-2022522.8 KiB14,47010,826

ChangeLog.3H A D08-May-2022604.4 KiB16,86112,872

ChangeLog.4H A D08-May-2022545.1 KiB15,26211,651

ChangeLog.5H A D08-May-2022512.9 KiB14,44710,728

ChangeLog.6H A D08-May-2022694.1 KiB19,20914,940

ChangeLog.7H A D08-May-2022772.4 KiB21,54416,697

ChangeLog.libH A D08-May-2022129.4 KiB

FSFChangeLogH A D08-May-2022104.8 KiB2,7061,956

FSFChangeLog.10H A D08-May-2022381.3 KiB10,1117,321

FSFChangeLog.11H A D08-May-2022550 KiB14,49410,559

LANGUAGESH A D08-May-20224 KiB9872

Makefile.inH A D08-May-2022151.7 KiB3,7692,667

ONEWSH A D08-May-202236.6 KiB987707

README-fixincH A D08-May-2022750 1512

README.PortabilityH A D08-May-202210.9 KiB392263

SERVICEH A D08-May-2022265 75

acconfig.hH A D08-May-20221.3 KiB4517

aclocal.m4H A D08-May-202249 KiB1,4571,361

alias.cH A D08-May-202285.2 KiB3,0051,887

attribs.cH A D08-May-202211.7 KiB412284

basic-block.hH A D08-May-202230.5 KiB835436

bb-reorder.cH A D08-May-20228 KiB323154

bitmap.cH A D08-May-202218.9 KiB848637

bitmap.hH A D08-May-202211.7 KiB357253

builtin-attrs.defH A D08-May-20228.3 KiB214180

builtin-types.defH A D08-May-20229.1 KiB206174

builtins.cH A D08-May-2022129.9 KiB4,4383,089

builtins.defH A D08-May-202224.1 KiB796736

c-aux-info.cH A D08-May-202221.4 KiB605324

c-bounded.cH A D08-May-202216.7 KiB513391

c-common.cH A D08-May-2022201.6 KiB6,8304,597

c-common.defH A D08-May-20224.9 KiB12697

c-common.hH A D08-May-202244.2 KiB1,259515

c-config-lang.inH A D08-May-20221.2 KiB2720

c-convert.cH A D08-May-20224 KiB11553

c-decl.cH A D08-May-2022222 KiB7,0804,548

c-dump.cH A D08-May-20224.7 KiB197142

c-errors.cH A D08-May-20221.4 KiB4418

c-format.cH A D08-May-202285.3 KiB2,5031,918

c-lang.cH A D08-May-20226.2 KiB221158

c-lex.cH A D08-May-202228.4 KiB1,085812

c-objc-common.cH A D08-May-202210.6 KiB431271

c-opts.cH A D30-Oct-202351.5 KiB1,8271,376

c-parse.inH A D08-May-2022108.3 KiB3,9293,513

c-pragma.cH A D08-May-202213.2 KiB515391

c-pragma.hH A D08-May-20222.1 KiB7030

c-pretty-print.cH A D08-May-202235.9 KiB1,4941,299

c-pretty-print.hH A D08-May-20226.8 KiB166111

c-semantics.cH A D08-May-202221.3 KiB881581

c-tree.hH A D08-May-202213.9 KiB327189

c-typeck.cH A D02-Feb-2023217 KiB7,2685,147

caller-save.cH A D08-May-202226.7 KiB881567

calls.cH A D08-May-2022151 KiB4,7392,916

cfg.cH A D08-May-202219.3 KiB847599

cfganal.cH A D08-May-202230.7 KiB1,185731

cfgbuild.cH A D08-May-202224.1 KiB864538

cfgcleanup.cH A D08-May-202252.2 KiB1,8541,216

cfglayout.cH A D08-May-202225.7 KiB1,028744

cfglayout.hH A D08-May-20221.5 KiB4216

cfgloop.cH A D08-May-202228.5 KiB1,203852

cfgrtl.cH A D08-May-202263.6 KiB2,4091,655

collect2.cH A D08-May-202294.2 KiB3,6532,706

collect2.hH A D08-May-20221.8 KiB5323

combine.cH A D08-May-2022436 KiB13,2518,519

conditions.hH A D08-May-20224.5 KiB11922

config.gccH A D08-May-202287.6 KiB3,1363,098

config.guessH A D08-May-2022159 52

config.inH A D08-May-202218.2 KiB641440

configureH A D08-May-2022259.1 KiB9,2837,532

configure.fragH A D08-May-20221.7 KiB7861

configure.inH A D08-May-202289.7 KiB2,9722,748

conflict.cH A D08-May-202214.6 KiB527267

convert.cH A D08-May-202216.1 KiB524329

convert.hH A D08-May-20221 KiB265

cppdefault.cH A D08-May-20222.9 KiB9053

cppdefault.hH A D08-May-20222.5 KiB7528

cpperror.cH A D08-May-20225.2 KiB193127

cppexp.cH A D08-May-202241.6 KiB1,6451,275

cppfiles.cH A D08-May-202232.6 KiB1,183790

cpphash.cH A D08-May-20223.8 KiB13075

cpphash.hH A D08-May-202219.6 KiB635350

cppinit.cH A D08-May-202243.5 KiB1,4931,039

cpplex.cH A D08-May-202257.5 KiB2,1871,627

cpplib.cH A D08-May-202255.1 KiB2,0081,445

cpplib.hH A D08-May-202226.6 KiB738386

cppmacro.cH A D08-May-202249.7 KiB1,7921,257

cppmain.cH A D08-May-202212.3 KiB433316

cppspec.cH A D08-May-20225.5 KiB225145

cpptrad.cH A D08-May-202232 KiB1,219869

crtstuff.cH A D08-May-202219.1 KiB548289

cse.cH A D08-May-2022249 KiB8,1795,039

cselib.cH A D08-May-202235.9 KiB1,444996

cselib.hH A D08-May-20222.4 KiB7232

cstamp-h.inH A D08-May-202210 21

dbxout.cH A D08-May-202288.3 KiB3,0122,019

dbxout.hH A D08-May-2022997 254

dbxstclass.hH A D08-May-2022427 1812

debug.cH A D08-May-20222.4 KiB9968

debug.hH A D08-May-20225.7 KiB14655

defaults.hH A D08-May-202218.5 KiB611390

df.cH A D08-May-202297.2 KiB3,9862,832

df.hH A D08-May-202211.3 KiB346219

diagnostic.cH A D08-May-202239.2 KiB1,4741,115

diagnostic.defH A D08-May-2022412 108

diagnostic.hH A D08-May-202212.5 KiB331149

doloop.cH A D08-May-202227.8 KiB900528

dominance.cH A D08-May-202223 KiB813541

doschk.cH A D08-May-20226.7 KiB361314

dummy-conditions.cH A D08-May-20221.3 KiB356

dwarf.hH A D08-May-202210 KiB320227

dwarf2.hH A D08-May-202216.4 KiB631516

dwarf2asm.cH A D08-May-202224 KiB908701

dwarf2asm.hH A D08-May-20222.6 KiB7943

dwarf2out.cH A D08-May-2022373.5 KiB12,9328,931

dwarf2out.hH A D08-May-20221.2 KiB297

dwarfout.cH A D08-May-2022224.4 KiB6,5623,596

emit-rtl.cH A D08-May-2022142.7 KiB5,6323,826

errors.cH A D08-May-20223.6 KiB13872

errors.hH A D08-May-20221.6 KiB4412

et-forest.cH A D08-May-202216.2 KiB681487

et-forest.hH A D08-May-20222.7 KiB8428

except.cH A D08-May-2022101.6 KiB3,8372,646

except.hH A D08-May-20226.8 KiB18480

explow.cH A D08-May-202248.1 KiB1,7511,143

expmed.cH A D08-May-2022149.7 KiB4,8093,298

expr.cH A D08-May-2022349.9 KiB11,3817,867

expr.hH A D08-May-202230.8 KiB802344

final.cH A D08-May-2022111.1 KiB4,1712,881

fix-header.cH A D08-May-202235.5 KiB1,326995

fixprotoH A D08-May-202210.3 KiB326208

flags.hH A D08-May-202222.7 KiB729191

floatlib.cH A D08-May-202216.9 KiB945637

flow.cH A D08-May-2022128.1 KiB4,4042,827

fold-const.cH A D08-May-2022234.6 KiB7,3725,127

fp-test.cH A D08-May-20225.4 KiB253187

function.cH A D08-May-2022241.7 KiB8,0455,137

function.hH A D08-May-202224.2 KiB629231

future.optionsH A D08-May-20221.1 KiB4135

gbl-ctors.hH A D08-May-20223.5 KiB9119

gcc.cH A D08-May-2022201.7 KiB7,3705,112

gcc.hH A D08-May-20223.2 KiB8940

gcc.hlpH A D08-May-202213.9 KiB404280

gccbug.inH A D08-May-202215.2 KiB552460

gccspec.cH A D08-May-20222.8 KiB11062

gcov-io.hH A D08-May-20227.1 KiB306192

gcov.cH A D08-May-202243.9 KiB1,6351,128

gcse.cH A D08-May-2022210.2 KiB7,5064,612

gdbinit.inH A D08-May-20222.2 KiB11288

gen-protos.cH A D08-May-20224.5 KiB196140

genattr.cH A D08-May-202217.3 KiB482375

genattrtab.cH A D08-May-2022169 KiB6,2694,469

genattrtab.hH A D08-May-20221.7 KiB4419

genautomata.cH A D08-May-2022312.2 KiB9,7437,574

gencheck.cH A D08-May-20221.7 KiB7341

gencodes.cH A D08-May-20222.8 KiB11766

genconditions.cH A D08-May-20226.4 KiB241158

genconfig.cH A D08-May-20229.5 KiB378246

genconstants.cH A D08-May-20222.4 KiB9042

genemit.cH A D08-May-202224.2 KiB900672

genextract.cH A D08-May-202213.1 KiB539368

genflags.cH A D08-May-20227.2 KiB305202

gengenrtl.cH A D08-May-20228.4 KiB368237

gengtype-lex.lH A D08-May-20227.5 KiB329258

gengtype-yacc.yH A D08-May-20226.6 KiB301257

gengtype.cH A D08-May-202266.7 KiB2,6262,158

gengtype.hH A D08-May-20225.2 KiB182114

genmultilibH A D08-May-202212.5 KiB377184

genopinit.cH A D08-May-202212.6 KiB369264

genoutput.cH A D08-May-202225.6 KiB1,041721

genpeep.cH A D08-May-202211.5 KiB461331

genpreds.cH A D08-May-20221.8 KiB6936

genrecog.cH A D08-May-202275.1 KiB2,8982,084

gensupport.cH A D08-May-202226.5 KiB1,162855

gensupport.hH A D08-May-20222.4 KiB7026

ggc-common.cH A D08-May-20229.9 KiB365242

ggc-none.cH A D08-May-20221.3 KiB5022

ggc-page.cH A D08-May-202249.5 KiB1,8121,104

ggc-simple.cH A D08-May-202210.6 KiB504330

ggc.hH A D08-May-20226.7 KiB18478

glimits.hH A D08-May-20222.7 KiB10471

global.cH A D08-May-202259.8 KiB1,9781,235

gmon.cH A D08-May-20228.4 KiB327218

graph.cH A D08-May-202210.4 KiB466365

graph.hH A D08-May-20221 KiB296

gstab.hH A D08-May-2022215 1510

gsyms.hH A D08-May-20221.2 KiB8778

gsyslimits.hH A D08-May-2022330 93

gthr-aix.hH A D08-May-20221.4 KiB398

gthr-dce.hH A D08-May-202210.9 KiB497348

gthr-posix.hH A D08-May-202212.3 KiB522368

gthr-rtems.hH A D08-May-20223.7 KiB13676

gthr-single.hH A D08-May-20225.2 KiB240137

gthr-solaris.hH A D08-May-202210.2 KiB479336

gthr-vxworks.hH A D08-May-20226.7 KiB311182

gthr-win32.hH A D08-May-202214.3 KiB605394

gthr.hH A D08-May-20223.5 KiB10619

haifa-sched.cH A D08-May-202274 KiB2,5261,557

hard-reg-set.hH A D08-May-202217.2 KiB497285

hashtable.cH A D08-May-20228.2 KiB329226

hashtable.hH A D08-May-20223 KiB9237

hooks.cH A D08-May-20222.9 KiB13288

hooks.hH A D08-May-20221.7 KiB4619

hwint.hH A D08-May-20225.3 KiB167129

ifcvt.cH A D08-May-202288 KiB3,2472,188

input.hH A D08-May-20221.6 KiB5014

insn-addr.hH A D08-May-20221.7 KiB5126

integrate.cH A D08-May-2022101.6 KiB3,2222,068

integrate.hH A D08-May-20228 KiB19572

intl.cH A D08-May-20221.3 KiB4717

intl.hH A D08-May-20221.5 KiB6235

jump.cH A D08-May-202262.5 KiB2,4771,685

langhooks-def.hH A D08-May-202210.8 KiB277213

langhooks.cH A D08-May-202211.9 KiB484282

langhooks.hH A D08-May-202214.7 KiB377113

lcm.cH A D08-May-202240.5 KiB1,351862

libfuncs.hH A D08-May-20227.9 KiB275203

libgcc-std.verH A D08-May-20223 KiB207195

libgcc2.cH A D08-May-202241.4 KiB1,9961,452

libgcc2.hH A D08-May-20229.9 KiB315216

limitx.hH A D08-May-2022455 135

limity.hH A D08-May-2022270 115

line-map.cH A D08-May-20226.1 KiB236145

line-map.hH A D08-May-20224.7 KiB12038

lists.cH A D08-May-20223.6 KiB14990

local-alloc.cH A D08-May-202276 KiB2,4851,429

location.hH A D08-May-20221.3 KiB399

longlong.hH A D08-May-202245 KiB1,3291,170

loop.cH A D08-May-2022326.4 KiB11,0337,146

loop.hH A D08-May-202216.2 KiB431198

machmode.defH A D08-May-20228.8 KiB177140

machmode.hH A D08-May-20226 KiB17873

main.cH A D08-May-20221.1 KiB3711

mbchar.cH A D08-May-20229.3 KiB335219

mbchar.hH A D08-May-20221.5 KiB4214

mips-tdump.cH A D08-May-202240.9 KiB1,5501,174

mips-tfile.cH A D08-May-2022155.9 KiB5,6243,749

mkconfig.shH A D08-May-20223 KiB11077

mkdeps.cH A D08-May-20226.2 KiB292206

mkdeps.hH A D08-May-20222.6 KiB6312

mkheaders.inH A D08-May-20223.1 KiB10259

mkinstalldirsH A D08-May-2022732 4123

mklibgcc.inH A D08-May-202216.1 KiB532413

mkmap-flat.awkH A D08-May-20221.7 KiB7938

mkmap-symver.awkH A D08-May-20222.5 KiB12479

move-if-changeH A D08-May-2022229 1814

optabs.cH A D08-May-2022159.3 KiB5,5763,897

optabs.hH A D08-May-202210.4 KiB341168

output.hH A D08-May-202221.2 KiB541207

params.cH A D08-May-20222.2 KiB8236

params.defH A D08-May-202210 KiB246216

params.hH A D08-May-20223.5 KiB11249

predict.cH A D08-May-202236.8 KiB1,283887

predict.defH A D08-May-20224.6 KiB11683

predict.hH A D08-May-20221.5 KiB5021

prefix.cH A D08-May-20228.7 KiB359220

prefix.hH A D08-May-20221.2 KiB325

pretty-print.hH A D08-May-20224.6 KiB10168

print-rtl.cH A D08-May-202218.5 KiB797617

print-tree.cH A D08-May-202221.8 KiB771619

profile.cH A D08-May-202239.4 KiB1,427952

profile.hH A D08-May-20221.6 KiB5512

protector.cH A D08-May-202268.4 KiB2,7521,940

protector.hH A D08-May-20221.8 KiB5411

protoize.cH A D08-May-2022141.2 KiB4,6712,851

ra-build.cH A D08-May-2022104 KiB3,2752,246

ra-colorize.cH A D08-May-202283.8 KiB2,7432,034

ra-debug.cH A D08-May-202230.6 KiB1,121948

ra-rewrite.cH A D08-May-202262 KiB1,9881,464

ra.cH A D08-May-202226.5 KiB900593

ra.hH A D08-May-202222.9 KiB625254

read-rtl.cH A D08-May-202218.4 KiB763560

real.cH A D08-May-202292.2 KiB4,4173,382

real.hH A D08-May-202211.5 KiB352187

recog.cH A D08-May-202292.2 KiB3,5122,389

recog.hH A D08-May-20229.5 KiB255135

reg-stack.cH A D08-May-202283.3 KiB2,9251,818

regclass.cH A D08-May-202279 KiB2,7561,759

regmove.cH A D08-May-202272.4 KiB2,5071,669

regrename.cH A D08-May-202253.1 KiB1,9311,436

regs.hH A D08-May-20228.4 KiB22969

reload.cH A D08-May-2022230.2 KiB7,0954,686

reload.hH A D08-May-202214.4 KiB388134

reload1.cH A D08-May-2022306.8 KiB9,6436,155

reorg.cH A D08-May-2022122 KiB3,8522,366

resource.cH A D08-May-202238.7 KiB1,310841

resource.hH A D08-May-20222 KiB5225

rtl-error.cH A D08-May-20224 KiB146102

rtl.cH A D08-May-202216.5 KiB627386

rtl.defH A D08-May-202251 KiB1,169940

rtl.hH A D08-May-202287.9 KiB2,3091,348

rtlanal.cH A D08-May-202286.2 KiB3,6252,546

sbitmap.cH A D08-May-202216.4 KiB781576

sbitmap.hH A D08-May-20226.8 KiB181130

scan-decls.cH A D08-May-20226 KiB247171

scan-types.shH A D08-May-20225 KiB14370

scan.cH A D08-May-20224.4 KiB258222

scan.hH A D08-May-20222.7 KiB8353

sched-deps.cH A D08-May-202248.8 KiB1,6171,117

sched-ebb.cH A D08-May-20229.6 KiB367224

sched-int.hH A D08-May-202212.7 KiB324132

sched-rgn.cH A D08-May-202287.8 KiB3,1261,959

sched-vis.cH A D08-May-202222.7 KiB964814

sdbout.cH A D08-May-202249.5 KiB1,7581,192

sdbout.hH A D08-May-2022903 232

sibcall.cH A D08-May-202222.1 KiB771463

simplify-rtx.cH A D08-May-202282.3 KiB2,9102,109

sort-protosH A D08-May-2022293 103

ssa-ccp.cH A D08-May-202235.3 KiB1,220754

ssa-dce.cH A D08-May-202221.3 KiB734444

ssa.cH A D08-May-202263 KiB2,3351,443

ssa.hH A D08-May-20222.5 KiB7320

stab.defH A D08-May-20228.9 KiB235186

stack.hH A D08-May-20221.4 KiB439

stmt.cH A D08-May-2022188.6 KiB6,3583,961

stor-layout.cH A D08-May-202267.9 KiB2,1431,378

stringpool.cH A D08-May-20224.6 KiB17393

sys-protos.hH A D08-May-202275.2 KiB1,3541,353

sys-types.hH A D08-May-20224.2 KiB241217

system.hH A D08-May-202217.6 KiB645420

target-def.hH A D08-May-20229.5 KiB295218

target.hH A D08-May-202213.9 KiB31985

timevar.cH A D08-May-202214.1 KiB544324

timevar.defH A D08-May-20224.1 KiB9581

timevar.hH A D08-May-20223.2 KiB9528

tlink.cH A D08-May-202216.7 KiB742558

toplev.cH A D08-May-2022160 KiB5,5483,564

toplev.hH A D08-May-20225.2 KiB13783

tracer.cH A D08-May-202210.1 KiB379272

tree-dump.cH A D08-May-202219.1 KiB791569

tree-dump.hH A D08-May-20222.8 KiB9643

tree-inline.cH A D08-May-202259.9 KiB1,9131,196

tree-inline.hH A D08-May-20221.5 KiB4311

tree.cH A D08-May-2022128.6 KiB4,9313,286

tree.defH A D08-May-202239.7 KiB858714

tree.hH A D08-May-2022124.6 KiB3,1971,457

tsystem.hH A D08-May-20222.9 KiB10739

typeclass.hH A D08-May-2022467 1512

unroll.cH A D08-May-2022134.9 KiB4,1032,371

unwind-c.cH A D08-May-20225.6 KiB187120

unwind-dw2-fde-darwin.cH A D08-May-20227.2 KiB242156

unwind-dw2-fde-glibc.cH A D08-May-20228.2 KiB300220

unwind-dw2-fde-openbsd.cH A D08-May-2022429 136

unwind-dw2-fde.cH A D08-May-202226.3 KiB1,032725

unwind-dw2-fde.hH A D08-May-20225.2 KiB17796

unwind-dw2.cH A D08-May-202232.2 KiB1,3111,000

unwind-libunwind.cH A D08-May-20224.6 KiB188106

unwind-pe.hH A D08-May-20226.8 KiB278193

unwind-sjlj.cH A D08-May-20226.8 KiB297200

unwind.hH A D08-May-20228.6 KiB22895

unwind.incH A D08-May-20228.8 KiB305231

varasm.cH A D08-May-2022145.7 KiB5,5043,881

varray.cH A D08-May-20223.9 KiB14096

varray.hH A D08-May-202212.1 KiB322220

version.cH A D08-May-2022816 194

version.hH A D08-May-2022145 65

vmsdbg.hH A D08-May-20226.5 KiB256175

vmsdbgout.cH A D08-May-202252.1 KiB1,7721,270

xcoffout.cH A D08-May-202213.2 KiB495307

xcoffout.hH A D08-May-20226.8 KiB208104

README-fixinc

1This README file is copied into the directory for GCC-only header files
2when fixincludes is run by the makefile for GCC.
3
4Many of the files in this directory were automatically edited from the
5standard system header files by the fixincludes process.  They are
6system-specific, and will not work on any other kind of system.  They
7are also not part of GCC.  The reason we have to do this is because
8GCC requires ANSI C headers and many vendors supply ANSI-incompatible
9headers.
10
11Because this is an automated process, sometimes headers get "fixed"
12that do not, strictly speaking, need a fix.  As long as nothing is broken
13by the process, it is just an unfortunate collateral inconvenience.
14We would like to rectify it, if it is not "too inconvenient".
15

README.Portability

1Copyright (C) 2000 Free Software Foundation, Inc.
2
3This file is intended to contain a few notes about writing C code
4within GCC so that it compiles without error on the full range of
5compilers GCC needs to be able to compile on.
6
7The problem is that many ISO-standard constructs are not accepted by
8either old or buggy compilers, and we keep getting bitten by them.
9This knowledge until know has been sparsely spread around, so I
10thought I'd collect it in one useful place.  Please add and correct
11any problems as you come across them.
12
13I'm going to start from a base of the ISO C89 standard, since that is
14probably what most people code to naturally.  Obviously using
15constructs introduced after that is not a good idea.
16
17The first section of this file deals strictly with portability issues,
18the second with common coding pitfalls.
19
20
21			Portability Issues
22			==================
23
24Unary +
25-------
26
27K+R C compilers and preprocessors have no notion of unary '+'.  Thus
28the following code snippet contains 2 portability problems.
29
30int x = +2;  /* int x = 2;  */
31#if +1       /* #if 1  */
32#endif
33
34
35Pointers to void
36----------------
37
38K+R C compilers did not have a void pointer, and used char * as the
39pointer to anything.  The macro PTR is defined as either void * or
40char * depending on whether you have a standards compliant compiler or
41a K+R one.  Thus
42
43  free ((void *) h->value.expansion);
44
45should be written
46
47  free ((PTR) h->value.expansion);
48
49Further, an initial investigation indicates that pointers to functions
50returning void are okay.  Thus the example given by "Calling functions
51through pointers to functions" below appears not to cause a problem.
52
53
54String literals
55---------------
56
57Some SGI compilers choke on the parentheses in:-
58
59const char string[] = ("A string");
60
61This is unfortunate since this is what the GNU gettext macro N_
62produces.  You need to find a different way to code it.
63
64K+R C did not allow concatenation of string literals like
65
66  "This is a " "single string literal".
67
68Moreover, some compilers like MSVC++ have fairly low limits on the
69maximum length of a string literal; 509 is the lowest we've come
70across.  You may need to break up a long printf statement into many
71smaller ones.
72
73
74Empty macro arguments
75---------------------
76
77ISO C (6.8.3 in the 1990 standard) specifies the following:
78
79If (before argument substitution) any argument consists of no
80preprocessing tokens, the behavior is undefined.
81
82This was relaxed by ISO C99, but some older compilers emit an error,
83so code like
84
85#define foo(x, y) x y
86foo (bar, )
87
88needs to be coded in some other way.
89
90
91signed keyword
92--------------
93
94The signed keyword did not exist in K+R compilers; it was introduced
95in ISO C89, so you cannot use it.  In both K+R and standard C,
96unqualified char and bitfields may be signed or unsigned.  There is no
97way to portably declare signed chars or signed bitfields.
98
99All other arithmetic types are signed unless you use the 'unsigned'
100qualifier.  For instance, it is safe to write
101
102  short paramc;
103
104instead of
105
106  signed short paramc;
107
108If you have an algorithm that depends on signed char or signed
109bitfields, you must find another way to write it before it can be
110integrated into GCC.
111
112
113Function prototypes
114-------------------
115
116You need to provide a function prototype for every function before you
117use it, and functions must be defined K+R style.  The function
118prototype should use the PARAMS macro, which takes a single argument.
119Therefore the parameter list must be enclosed in parentheses.  For
120example,
121
122int myfunc PARAMS ((double, int *));
123
124int
125myfunc (var1, var2)
126     double var1;
127     int *var2;
128{
129  ...
130}
131
132This implies that if the function takes no arguments, it should be
133declared and defined as follows:
134
135int myfunc PARAMS ((void));
136
137int
138myfunc ()
139{
140  ...
141}
142
143You also need to use PARAMS when referring to function protypes in
144other circumstances, for example see "Calling functions through
145pointers to functions" below.
146
147Variable-argument functions are best described by example:-
148
149void cpp_ice PARAMS ((cpp_reader *, const char *msgid, ...));
150
151void
152cpp_ice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
153{
154  VA_OPEN (ap, msgid);
155  VA_FIXEDARG (ap, cpp_reader *, pfile);
156  VA_FIXEDARG (ap, const char *, msgid);
157
158  ...
159  VA_CLOSE (ap);
160}
161
162See ansidecl.h for the definitions of the above macros and more.
163
164One aspect of using K+R style function declarations, is you cannot
165have arguments whose types are char, short, or float, since without
166prototypes (ie, K+R rules), these types are promoted to int, int, and
167double respectively.
168
169Calling functions through pointers to functions
170-----------------------------------------------
171
172K+R C compilers require parentheses around the dereferenced function
173pointer expression in the call, whereas ISO C relaxes the syntax.  For
174example
175
176typedef void (* cl_directive_handler) PARAMS ((cpp_reader *, const char *));
177      *p->handler (pfile, p->arg);
178
179needs to become
180
181      (*p->handler) (pfile, p->arg);
182
183
184Macros
185------
186
187The rules under K+R C and ISO C for achieving stringification and
188token pasting are quite different.  Therefore some macros have been
189defined which will get it right depending upon the compiler.
190
191  CONCAT2(a,b) CONCAT3(a,b,c) and CONCAT4(a,b,c,d)
192
193will paste the tokens passed as arguments.  You must not leave any
194space around the commas.  Also,
195
196  STRINGX(x)
197
198will stringify an argument; to get the same result on K+R and ISO
199compilers x should not have spaces around it.
200
201
202Passing structures by value
203---------------------------
204
205Avoid passing structures by value, either to or from functions.  It
206seems some K+R compilers handle this differently or not at all.
207
208
209Enums
210-----
211
212In K+R C, you have to cast enum types to use them as integers, and
213some compilers in particular give lots of warnings for using an enum
214as an array index.
215
216
217Bitfields
218---------
219
220See also "signed keyword" above.  In K+R C only unsigned int bitfields
221were defined (i.e. unsigned char, unsigned short, unsigned long.
222Using plain int/short/long was not allowed).
223
224
225free and realloc
226----------------
227
228Some implementations crash upon attempts to free or realloc the null
229pointer.  Thus if mem might be null, you need to write
230
231  if (mem)
232    free (mem);
233
234
235Reserved Keywords
236-----------------
237
238K+R C has "entry" as a reserved keyword, so you should not use it for
239your variable names.
240
241
242Type promotions
243---------------
244
245K+R used unsigned-preserving rules for arithmetic expresssions, while
246ISO uses value-preserving.  This means an unsigned char compared to an
247int is done as an unsigned comparison in K+R (since unsigned char
248promotes to unsigned) while it is signed in ISO (since all of the
249values in unsigned char fit in an int, it promotes to int).
250
251Trigraphs
252---------
253
254You weren't going to use them anyway, but trigraphs were not defined
255in K+R C, and some otherwise ISO C compliant compilers do not accept
256them.
257
258
259Suffixes on Integer Constants
260-----------------------------
261
262K+R C did not accept a 'u' suffix on integer constants.  If you want
263to declare a constant to be be unsigned, you must use an explicit
264cast.
265
266You should never use a 'l' suffix on integer constants ('L' is fine),
267since it can easily be confused with the number '1'.
268
269
270			Common Coding Pitfalls
271			======================
272
273errno
274-----
275
276errno might be declared as a macro.
277
278
279Implicit int
280------------
281
282In C, the 'int' keyword can often be omitted from type declarations.
283For instance, you can write
284
285  unsigned variable;
286
287as shorthand for
288
289  unsigned int variable;
290
291There are several places where this can cause trouble.  First, suppose
292'variable' is a long; then you might think
293
294  (unsigned) variable
295
296would convert it to unsigned long.  It does not.  It converts to
297unsigned int.  This mostly causes problems on 64-bit platforms, where
298long and int are not the same size.
299
300Second, if you write a function definition with no return type at
301all:
302
303  operate (a, b)
304       int a, b;
305  {
306    ...
307  }
308
309that function is expected to return int, *not* void.  GCC will warn
310about this.  K+R C has no problem with 'void' as a return type, so you
311need not worry about that.
312
313Implicit function declarations always have return type int.  So if you
314correct the above definition to
315
316  void
317  operate (a, b)
318       int a, b;
319  ...
320
321but operate() is called above its definition, you will get an error
322about a "type mismatch with previous implicit declaration".  The cure
323is to prototype all functions at the top of the file, or in an
324appropriate header.
325
326Char vs unsigned char vs int
327----------------------------
328
329In C, unqualified 'char' may be either signed or unsigned; it is the
330implementation's choice.  When you are processing 7-bit ASCII, it does
331not matter.  But when your program must handle arbitrary binary data,
332or fully 8-bit character sets, you have a problem.  The most obvious
333issue is if you have a look-up table indexed by characters.
334
335For instance, the character '\341' in ISO Latin 1 is SMALL LETTER A
336WITH ACUTE ACCENT.  In the proper locale, isalpha('\341') will be
337true.  But if you read '\341' from a file and store it in a plain
338char, isalpha(c) may look up character 225, or it may look up
339character -31.  And the ctype table has no entry at offset -31, so
340your program will crash.  (If you're lucky.)
341
342It is wise to use unsigned char everywhere you possibly can.  This
343avoids all these problems.  Unfortunately, the routines in <string.h>
344take plain char arguments, so you have to remember to cast them back
345and forth - or avoid the use of strxxx() functions, which is probably
346a good idea anyway.
347
348Another common mistake is to use either char or unsigned char to
349receive the result of getc() or related stdio functions.  They may
350return EOF, which is outside the range of values representable by
351char.  If you use char, some legal character value may be confused
352with EOF, such as '\377' (SMALL LETTER Y WITH UMLAUT, in Latin-1).
353The correct choice is int.
354
355A more subtle version of the same mistake might look like this:
356
357  unsigned char pushback[NPUSHBACK];
358  int pbidx;
359  #define unget(c) (assert(pbidx < NPUSHBACK), pushback[pbidx++] = (c))
360  #define get(c) (pbidx ? pushback[--pbidx] : getchar())
361  ...
362  unget(EOF);
363
364which will mysteriously turn a pushed-back EOF into a SMALL LETTER Y
365WITH UMLAUT.
366
367
368Other common pitfalls
369---------------------
370
371o Expecting 'plain' char to be either sign or unsigned extending
372
373o Shifting an item by a negative amount or by greater than or equal to
374  the number of bits in a type (expecting shifts by 32 to be sensible
375  has caused quite a number of bugs at least in the early days).
376
377o Expecting ints shifted right to be sign extended.
378
379o Modifying the same value twice within one sequence point.
380
381o Host vs. target floating point representation, including emitting NaNs
382  and Infinities in a form that the assembler handles.
383
384o qsort being an unstable sort function (unstable in the sense that
385  multiple items that sort the same may be sorted in different orders
386  by different qsort functions).
387
388o Passing incorrect types to fprintf and friends.
389
390o Adding a function declaration for a module declared in another file to
391  a .c file instead of to a .h file.
392