cpp.info 237 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597
  1. This is cpp.info, produced by makeinfo version 6.8 from cpp.texi.
  2. Copyright (C) 1987-2021 Free Software Foundation, Inc.
  3. Permission is granted to copy, distribute and/or modify this document
  4. under the terms of the GNU Free Documentation License, Version 1.3 or
  5. any later version published by the Free Software Foundation. A copy of
  6. the license is included in the section entitled "GNU Free Documentation
  7. License".
  8. This manual contains no Invariant Sections. The Front-Cover Texts
  9. are (a) (see below), and the Back-Cover Texts are (b) (see below).
  10. (a) The FSF's Front-Cover Text is:
  11. A GNU Manual
  12. (b) The FSF's Back-Cover Text is:
  13. You have freedom to copy and modify this GNU Manual, like GNU
  14. software. Copies published by the Free Software Foundation raise funds
  15. for GNU development.
  16. INFO-DIR-SECTION Software development
  17. START-INFO-DIR-ENTRY
  18. * Cpp: (cpp). The GNU C preprocessor.
  19. END-INFO-DIR-ENTRY
  20. 
  21. File: cpp.info, Node: Top, Next: Overview, Up: (dir)
  22. The C Preprocessor
  23. ******************
  24. The C preprocessor implements the macro language used to transform C,
  25. C++, and Objective-C programs before they are compiled. It can also be
  26. useful on its own.
  27. * Menu:
  28. * Overview::
  29. * Header Files::
  30. * Macros::
  31. * Conditionals::
  32. * Diagnostics::
  33. * Line Control::
  34. * Pragmas::
  35. * Other Directives::
  36. * Preprocessor Output::
  37. * Traditional Mode::
  38. * Implementation Details::
  39. * Invocation::
  40. * Environment Variables::
  41. * GNU Free Documentation License::
  42. * Index of Directives::
  43. * Option Index::
  44. * Concept Index::
  45. -- The Detailed Node Listing --
  46. Overview
  47. * Character sets::
  48. * Initial processing::
  49. * Tokenization::
  50. * The preprocessing language::
  51. Header Files
  52. * Include Syntax::
  53. * Include Operation::
  54. * Search Path::
  55. * Once-Only Headers::
  56. * Alternatives to Wrapper #ifndef::
  57. * Computed Includes::
  58. * Wrapper Headers::
  59. * System Headers::
  60. Macros
  61. * Object-like Macros::
  62. * Function-like Macros::
  63. * Macro Arguments::
  64. * Stringizing::
  65. * Concatenation::
  66. * Variadic Macros::
  67. * Predefined Macros::
  68. * Undefining and Redefining Macros::
  69. * Directives Within Macro Arguments::
  70. * Macro Pitfalls::
  71. Predefined Macros
  72. * Standard Predefined Macros::
  73. * Common Predefined Macros::
  74. * System-specific Predefined Macros::
  75. * C++ Named Operators::
  76. Macro Pitfalls
  77. * Misnesting::
  78. * Operator Precedence Problems::
  79. * Swallowing the Semicolon::
  80. * Duplication of Side Effects::
  81. * Self-Referential Macros::
  82. * Argument Prescan::
  83. * Newlines in Arguments::
  84. Conditionals
  85. * Conditional Uses::
  86. * Conditional Syntax::
  87. * Deleted Code::
  88. Conditional Syntax
  89. * Ifdef::
  90. * If::
  91. * Defined::
  92. * Else::
  93. * Elif::
  94. Implementation Details
  95. * Implementation-defined behavior::
  96. * Implementation limits::
  97. * Obsolete Features::
  98. Obsolete Features
  99. * Obsolete Features::
  100. Copyright (C) 1987-2021 Free Software Foundation, Inc.
  101. Permission is granted to copy, distribute and/or modify this document
  102. under the terms of the GNU Free Documentation License, Version 1.3 or
  103. any later version published by the Free Software Foundation. A copy of
  104. the license is included in the section entitled "GNU Free Documentation
  105. License".
  106. This manual contains no Invariant Sections. The Front-Cover Texts
  107. are (a) (see below), and the Back-Cover Texts are (b) (see below).
  108. (a) The FSF's Front-Cover Text is:
  109. A GNU Manual
  110. (b) The FSF's Back-Cover Text is:
  111. You have freedom to copy and modify this GNU Manual, like GNU
  112. software. Copies published by the Free Software Foundation raise funds
  113. for GNU development.
  114. 
  115. File: cpp.info, Node: Overview, Next: Header Files, Prev: Top, Up: Top
  116. 1 Overview
  117. **********
  118. The C preprocessor, often known as "cpp", is a "macro processor" that is
  119. used automatically by the C compiler to transform your program before
  120. compilation. It is called a macro processor because it allows you to
  121. define "macros", which are brief abbreviations for longer constructs.
  122. The C preprocessor is intended to be used only with C, C++, and
  123. Objective-C source code. In the past, it has been abused as a general
  124. text processor. It will choke on input which does not obey C's lexical
  125. rules. For example, apostrophes will be interpreted as the beginning of
  126. character constants, and cause errors. Also, you cannot rely on it
  127. preserving characteristics of the input which are not significant to
  128. C-family languages. If a Makefile is preprocessed, all the hard tabs
  129. will be removed, and the Makefile will not work.
  130. Having said that, you can often get away with using cpp on things
  131. which are not C. Other Algol-ish programming languages are often safe
  132. (Ada, etc.) So is assembly, with caution. '-traditional-cpp' mode
  133. preserves more white space, and is otherwise more permissive. Many of
  134. the problems can be avoided by writing C or C++ style comments instead
  135. of native language comments, and keeping macros simple.
  136. Wherever possible, you should use a preprocessor geared to the
  137. language you are writing in. Modern versions of the GNU assembler have
  138. macro facilities. Most high level programming languages have their own
  139. conditional compilation and inclusion mechanism. If all else fails, try
  140. a true general text processor, such as GNU M4.
  141. C preprocessors vary in some details. This manual discusses the GNU
  142. C preprocessor, which provides a small superset of the features of ISO
  143. Standard C. In its default mode, the GNU C preprocessor does not do a
  144. few things required by the standard. These are features which are
  145. rarely, if ever, used, and may cause surprising changes to the meaning
  146. of a program which does not expect them. To get strict ISO Standard C,
  147. you should use the '-std=c90', '-std=c99', '-std=c11' or '-std=c17'
  148. options, depending on which version of the standard you want. To get
  149. all the mandatory diagnostics, you must also use '-pedantic'. *Note
  150. Invocation::.
  151. This manual describes the behavior of the ISO preprocessor. To
  152. minimize gratuitous differences, where the ISO preprocessor's behavior
  153. does not conflict with traditional semantics, the traditional
  154. preprocessor should behave the same way. The various differences that
  155. do exist are detailed in the section *note Traditional Mode::.
  156. For clarity, unless noted otherwise, references to 'CPP' in this
  157. manual refer to GNU CPP.
  158. * Menu:
  159. * Character sets::
  160. * Initial processing::
  161. * Tokenization::
  162. * The preprocessing language::
  163. 
  164. File: cpp.info, Node: Character sets, Next: Initial processing, Up: Overview
  165. 1.1 Character sets
  166. ==================
  167. Source code character set processing in C and related languages is
  168. rather complicated. The C standard discusses two character sets, but
  169. there are really at least four.
  170. The files input to CPP might be in any character set at all. CPP's
  171. very first action, before it even looks for line boundaries, is to
  172. convert the file into the character set it uses for internal processing.
  173. That set is what the C standard calls the "source" character set. It
  174. must be isomorphic with ISO 10646, also known as Unicode. CPP uses the
  175. UTF-8 encoding of Unicode.
  176. The character sets of the input files are specified using the
  177. '-finput-charset=' option.
  178. All preprocessing work (the subject of the rest of this manual) is
  179. carried out in the source character set. If you request textual output
  180. from the preprocessor with the '-E' option, it will be in UTF-8.
  181. After preprocessing is complete, string and character constants are
  182. converted again, into the "execution" character set. This character set
  183. is under control of the user; the default is UTF-8, matching the source
  184. character set. Wide string and character constants have their own
  185. character set, which is not called out specifically in the standard.
  186. Again, it is under control of the user. The default is UTF-16 or
  187. UTF-32, whichever fits in the target's 'wchar_t' type, in the target
  188. machine's byte order.(1) Octal and hexadecimal escape sequences do not
  189. undergo conversion; '\x12' has the value 0x12 regardless of the
  190. currently selected execution character set. All other escapes are
  191. replaced by the character in the source character set that they
  192. represent, then converted to the execution character set, just like
  193. unescaped characters.
  194. In identifiers, characters outside the ASCII range can be specified
  195. with the '\u' and '\U' escapes or used directly in the input encoding.
  196. If strict ISO C90 conformance is specified with an option such as
  197. '-std=c90', or '-fno-extended-identifiers' is used, then those
  198. constructs are not permitted in identifiers.
  199. ---------- Footnotes ----------
  200. (1) UTF-16 does not meet the requirements of the C standard for a
  201. wide character set, but the choice of 16-bit 'wchar_t' is enshrined in
  202. some system ABIs so we cannot fix this.
  203. 
  204. File: cpp.info, Node: Initial processing, Next: Tokenization, Prev: Character sets, Up: Overview
  205. 1.2 Initial processing
  206. ======================
  207. The preprocessor performs a series of textual transformations on its
  208. input. These happen before all other processing. Conceptually, they
  209. happen in a rigid order, and the entire file is run through each
  210. transformation before the next one begins. CPP actually does them all
  211. at once, for performance reasons. These transformations correspond
  212. roughly to the first three "phases of translation" described in the C
  213. standard.
  214. 1. The input file is read into memory and broken into lines.
  215. Different systems use different conventions to indicate the end of
  216. a line. GCC accepts the ASCII control sequences 'LF', 'CR LF' and
  217. 'CR' as end-of-line markers. These are the canonical sequences
  218. used by Unix, DOS and VMS, and the classic Mac OS (before OSX)
  219. respectively. You may therefore safely copy source code written on
  220. any of those systems to a different one and use it without
  221. conversion. (GCC may lose track of the current line number if a
  222. file doesn't consistently use one convention, as sometimes happens
  223. when it is edited on computers with different conventions that
  224. share a network file system.)
  225. If the last line of any input file lacks an end-of-line marker, the
  226. end of the file is considered to implicitly supply one. The C
  227. standard says that this condition provokes undefined behavior, so
  228. GCC will emit a warning message.
  229. 2. If trigraphs are enabled, they are replaced by their corresponding
  230. single characters. By default GCC ignores trigraphs, but if you
  231. request a strictly conforming mode with the '-std' option, or you
  232. specify the '-trigraphs' option, then it converts them.
  233. These are nine three-character sequences, all starting with '??',
  234. that are defined by ISO C to stand for single characters. They
  235. permit obsolete systems that lack some of C's punctuation to use C.
  236. For example, '??/' stands for '\', so '??/n' is a character
  237. constant for a newline.
  238. Trigraphs are not popular and many compilers implement them
  239. incorrectly. Portable code should not rely on trigraphs being
  240. either converted or ignored. With '-Wtrigraphs' GCC will warn you
  241. when a trigraph may change the meaning of your program if it were
  242. converted. *Note Wtrigraphs::.
  243. In a string constant, you can prevent a sequence of question marks
  244. from being confused with a trigraph by inserting a backslash
  245. between the question marks, or by separating the string literal at
  246. the trigraph and making use of string literal concatenation.
  247. "(??\?)" is the string '(???)', not '(?]'. Traditional C compilers
  248. do not recognize these idioms.
  249. The nine trigraphs and their replacements are
  250. Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
  251. Replacement: [ ] { } # \ ^ | ~
  252. 3. Continued lines are merged into one long line.
  253. A continued line is a line which ends with a backslash, '\'. The
  254. backslash is removed and the following line is joined with the
  255. current one. No space is inserted, so you may split a line
  256. anywhere, even in the middle of a word. (It is generally more
  257. readable to split lines only at white space.)
  258. The trailing backslash on a continued line is commonly referred to
  259. as a "backslash-newline".
  260. If there is white space between a backslash and the end of a line,
  261. that is still a continued line. However, as this is usually the
  262. result of an editing mistake, and many compilers will not accept it
  263. as a continued line, GCC will warn you about it.
  264. 4. All comments are replaced with single spaces.
  265. There are two kinds of comments. "Block comments" begin with '/*'
  266. and continue until the next '*/'. Block comments do not nest:
  267. /* this is /* one comment */ text outside comment
  268. "Line comments" begin with '//' and continue to the end of the
  269. current line. Line comments do not nest either, but it does not
  270. matter, because they would end in the same place anyway.
  271. // this is // one comment
  272. text outside comment
  273. It is safe to put line comments inside block comments, or vice versa.
  274. /* block comment
  275. // contains line comment
  276. yet more comment
  277. */ outside comment
  278. // line comment /* contains block comment */
  279. But beware of commenting out one end of a block comment with a line
  280. comment.
  281. // l.c. /* block comment begins
  282. oops! this isn't a comment anymore */
  283. Comments are not recognized within string literals. "/* blah */" is
  284. the string constant '/* blah */', not an empty string.
  285. Line comments are not in the 1989 edition of the C standard, but they
  286. are recognized by GCC as an extension. In C++ and in the 1999 edition
  287. of the C standard, they are an official part of the language.
  288. Since these transformations happen before all other processing, you
  289. can split a line mechanically with backslash-newline anywhere. You can
  290. comment out the end of a line. You can continue a line comment onto the
  291. next line with backslash-newline. You can even split '/*', '*/', and
  292. '//' onto multiple lines with backslash-newline. For example:
  293. /\
  294. *
  295. */ # /*
  296. */ defi\
  297. ne FO\
  298. O 10\
  299. 20
  300. is equivalent to '#define FOO 1020'. All these tricks are extremely
  301. confusing and should not be used in code intended to be readable.
  302. There is no way to prevent a backslash at the end of a line from
  303. being interpreted as a backslash-newline. This cannot affect any
  304. correct program, however.
  305. 
  306. File: cpp.info, Node: Tokenization, Next: The preprocessing language, Prev: Initial processing, Up: Overview
  307. 1.3 Tokenization
  308. ================
  309. After the textual transformations are finished, the input file is
  310. converted into a sequence of "preprocessing tokens". These mostly
  311. correspond to the syntactic tokens used by the C compiler, but there are
  312. a few differences. White space separates tokens; it is not itself a
  313. token of any kind. Tokens do not have to be separated by white space,
  314. but it is often necessary to avoid ambiguities.
  315. When faced with a sequence of characters that has more than one
  316. possible tokenization, the preprocessor is greedy. It always makes each
  317. token, starting from the left, as big as possible before moving on to
  318. the next token. For instance, 'a+++++b' is interpreted as
  319. 'a ++ ++ + b', not as 'a ++ + ++ b', even though the latter tokenization
  320. could be part of a valid C program and the former could not.
  321. Once the input file is broken into tokens, the token boundaries never
  322. change, except when the '##' preprocessing operator is used to paste
  323. tokens together. *Note Concatenation::. For example,
  324. #define foo() bar
  325. foo()baz
  326. ==> bar baz
  327. _not_
  328. ==> barbaz
  329. The compiler does not re-tokenize the preprocessor's output. Each
  330. preprocessing token becomes one compiler token.
  331. Preprocessing tokens fall into five broad classes: identifiers,
  332. preprocessing numbers, string literals, punctuators, and other. An
  333. "identifier" is the same as an identifier in C: any sequence of letters,
  334. digits, or underscores, which begins with a letter or underscore.
  335. Keywords of C have no significance to the preprocessor; they are
  336. ordinary identifiers. You can define a macro whose name is a keyword,
  337. for instance. The only identifier which can be considered a
  338. preprocessing keyword is 'defined'. *Note Defined::.
  339. This is mostly true of other languages which use the C preprocessor.
  340. However, a few of the keywords of C++ are significant even in the
  341. preprocessor. *Note C++ Named Operators::.
  342. In the 1999 C standard, identifiers may contain letters which are not
  343. part of the "basic source character set", at the implementation's
  344. discretion (such as accented Latin letters, Greek letters, or Chinese
  345. ideograms). This may be done with an extended character set, or the
  346. '\u' and '\U' escape sequences.
  347. As an extension, GCC treats '$' as a letter. This is for
  348. compatibility with some systems, such as VMS, where '$' is commonly used
  349. in system-defined function and object names. '$' is not a letter in
  350. strictly conforming mode, or if you specify the '-$' option. *Note
  351. Invocation::.
  352. A "preprocessing number" has a rather bizarre definition. The
  353. category includes all the normal integer and floating point constants
  354. one expects of C, but also a number of other things one might not
  355. initially recognize as a number. Formally, preprocessing numbers begin
  356. with an optional period, a required decimal digit, and then continue
  357. with any sequence of letters, digits, underscores, periods, and
  358. exponents. Exponents are the two-character sequences 'e+', 'e-', 'E+',
  359. 'E-', 'p+', 'p-', 'P+', and 'P-'. (The exponents that begin with 'p' or
  360. 'P' are used for hexadecimal floating-point constants.)
  361. The purpose of this unusual definition is to isolate the preprocessor
  362. from the full complexity of numeric constants. It does not have to
  363. distinguish between lexically valid and invalid floating-point numbers,
  364. which is complicated. The definition also permits you to split an
  365. identifier at any position and get exactly two tokens, which can then be
  366. pasted back together with the '##' operator.
  367. It's possible for preprocessing numbers to cause programs to be
  368. misinterpreted. For example, '0xE+12' is a preprocessing number which
  369. does not translate to any valid numeric constant, therefore a syntax
  370. error. It does not mean '0xE + 12', which is what you might have
  371. intended.
  372. "String literals" are string constants, character constants, and
  373. header file names (the argument of '#include').(1) String constants and
  374. character constants are straightforward: "..." or '...'. In either case
  375. embedded quotes should be escaped with a backslash: '\'' is the
  376. character constant for '''. There is no limit on the length of a
  377. character constant, but the value of a character constant that contains
  378. more than one character is implementation-defined. *Note Implementation
  379. Details::.
  380. Header file names either look like string constants, "...", or are
  381. written with angle brackets instead, <...>. In either case, backslash
  382. is an ordinary character. There is no way to escape the closing quote
  383. or angle bracket. The preprocessor looks for the header file in
  384. different places depending on which form you use. *Note Include
  385. Operation::.
  386. No string literal may extend past the end of a line. You may use
  387. continued lines instead, or string constant concatenation.
  388. "Punctuators" are all the usual bits of punctuation which are
  389. meaningful to C and C++. All but three of the punctuation characters in
  390. ASCII are C punctuators. The exceptions are '@', '$', and '`'. In
  391. addition, all the two- and three-character operators are punctuators.
  392. There are also six "digraphs", which the C++ standard calls "alternative
  393. tokens", which are merely alternate ways to spell other punctuators.
  394. This is a second attempt to work around missing punctuation in obsolete
  395. systems. It has no negative side effects, unlike trigraphs, but does
  396. not cover as much ground. The digraphs and their corresponding normal
  397. punctuators are:
  398. Digraph: <% %> <: :> %: %:%:
  399. Punctuator: { } [ ] # ##
  400. Any other single byte is considered "other" and passed on to the
  401. preprocessor's output unchanged. The C compiler will almost certainly
  402. reject source code containing "other" tokens. In ASCII, the only
  403. "other" characters are '@', '$', '`', and control characters other than
  404. NUL (all bits zero). (Note that '$' is normally considered a letter.)
  405. All bytes with the high bit set (numeric range 0x7F-0xFF) that were not
  406. succesfully interpreted as part of an extended character in the input
  407. encoding are also "other" in the present implementation.
  408. NUL is a special case because of the high probability that its
  409. appearance is accidental, and because it may be invisible to the user
  410. (many terminals do not display NUL at all). Within comments, NULs are
  411. silently ignored, just as any other character would be. In running
  412. text, NUL is considered white space. For example, these two directives
  413. have the same meaning.
  414. #define X^@1
  415. #define X 1
  416. (where '^@' is ASCII NUL). Within string or character constants, NULs
  417. are preserved. In the latter two cases the preprocessor emits a warning
  418. message.
  419. ---------- Footnotes ----------
  420. (1) The C standard uses the term "string literal" to refer only to
  421. what we are calling "string constants".
  422. 
  423. File: cpp.info, Node: The preprocessing language, Prev: Tokenization, Up: Overview
  424. 1.4 The preprocessing language
  425. ==============================
  426. After tokenization, the stream of tokens may simply be passed straight
  427. to the compiler's parser. However, if it contains any operations in the
  428. "preprocessing language", it will be transformed first. This stage
  429. corresponds roughly to the standard's "translation phase 4" and is what
  430. most people think of as the preprocessor's job.
  431. The preprocessing language consists of "directives" to be executed
  432. and "macros" to be expanded. Its primary capabilities are:
  433. * Inclusion of header files. These are files of declarations that
  434. can be substituted into your program.
  435. * Macro expansion. You can define "macros", which are abbreviations
  436. for arbitrary fragments of C code. The preprocessor will replace
  437. the macros with their definitions throughout the program. Some
  438. macros are automatically defined for you.
  439. * Conditional compilation. You can include or exclude parts of the
  440. program according to various conditions.
  441. * Line control. If you use a program to combine or rearrange source
  442. files into an intermediate file which is then compiled, you can use
  443. line control to inform the compiler where each source line
  444. originally came from.
  445. * Diagnostics. You can detect problems at compile time and issue
  446. errors or warnings.
  447. There are a few more, less useful, features.
  448. Except for expansion of predefined macros, all these operations are
  449. triggered with "preprocessing directives". Preprocessing directives are
  450. lines in your program that start with '#'. Whitespace is allowed before
  451. and after the '#'. The '#' is followed by an identifier, the "directive
  452. name". It specifies the operation to perform. Directives are commonly
  453. referred to as '#NAME' where NAME is the directive name. For example,
  454. '#define' is the directive that defines a macro.
  455. The '#' which begins a directive cannot come from a macro expansion.
  456. Also, the directive name is not macro expanded. Thus, if 'foo' is
  457. defined as a macro expanding to 'define', that does not make '#foo' a
  458. valid preprocessing directive.
  459. The set of valid directive names is fixed. Programs cannot define
  460. new preprocessing directives.
  461. Some directives require arguments; these make up the rest of the
  462. directive line and must be separated from the directive name by
  463. whitespace. For example, '#define' must be followed by a macro name and
  464. the intended expansion of the macro.
  465. A preprocessing directive cannot cover more than one line. The line
  466. may, however, be continued with backslash-newline, or by a block comment
  467. which extends past the end of the line. In either case, when the
  468. directive is processed, the continuations have already been merged with
  469. the first line to make one long line.
  470. 
  471. File: cpp.info, Node: Header Files, Next: Macros, Prev: Overview, Up: Top
  472. 2 Header Files
  473. **************
  474. A header file is a file containing C declarations and macro definitions
  475. (*note Macros::) to be shared between several source files. You request
  476. the use of a header file in your program by "including" it, with the C
  477. preprocessing directive '#include'.
  478. Header files serve two purposes.
  479. * System header files declare the interfaces to parts of the
  480. operating system. You include them in your program to supply the
  481. definitions and declarations you need to invoke system calls and
  482. libraries.
  483. * Your own header files contain declarations for interfaces between
  484. the source files of your program. Each time you have a group of
  485. related declarations and macro definitions all or most of which are
  486. needed in several different source files, it is a good idea to
  487. create a header file for them.
  488. Including a header file produces the same results as copying the
  489. header file into each source file that needs it. Such copying would be
  490. time-consuming and error-prone. With a header file, the related
  491. declarations appear in only one place. If they need to be changed, they
  492. can be changed in one place, and programs that include the header file
  493. will automatically use the new version when next recompiled. The header
  494. file eliminates the labor of finding and changing all the copies as well
  495. as the risk that a failure to find one copy will result in
  496. inconsistencies within a program.
  497. In C, the usual convention is to give header files names that end
  498. with '.h'. It is most portable to use only letters, digits, dashes, and
  499. underscores in header file names, and at most one dot.
  500. * Menu:
  501. * Include Syntax::
  502. * Include Operation::
  503. * Search Path::
  504. * Once-Only Headers::
  505. * Alternatives to Wrapper #ifndef::
  506. * Computed Includes::
  507. * Wrapper Headers::
  508. * System Headers::
  509. 
  510. File: cpp.info, Node: Include Syntax, Next: Include Operation, Up: Header Files
  511. 2.1 Include Syntax
  512. ==================
  513. Both user and system header files are included using the preprocessing
  514. directive '#include'. It has two variants:
  515. '#include <FILE>'
  516. This variant is used for system header files. It searches for a
  517. file named FILE in a standard list of system directories. You can
  518. prepend directories to this list with the '-I' option (*note
  519. Invocation::).
  520. '#include "FILE"'
  521. This variant is used for header files of your own program. It
  522. searches for a file named FILE first in the directory containing
  523. the current file, then in the quote directories and then the same
  524. directories used for '<FILE>'. You can prepend directories to the
  525. list of quote directories with the '-iquote' option.
  526. The argument of '#include', whether delimited with quote marks or
  527. angle brackets, behaves like a string constant in that comments are not
  528. recognized, and macro names are not expanded. Thus, '#include <x/*y>'
  529. specifies inclusion of a system header file named 'x/*y'.
  530. However, if backslashes occur within FILE, they are considered
  531. ordinary text characters, not escape characters. None of the character
  532. escape sequences appropriate to string constants in C are processed.
  533. Thus, '#include "x\n\\y"' specifies a filename containing three
  534. backslashes. (Some systems interpret '\' as a pathname separator. All
  535. of these also interpret '/' the same way. It is most portable to use
  536. only '/'.)
  537. It is an error if there is anything (other than comments) on the line
  538. after the file name.
  539. 
  540. File: cpp.info, Node: Include Operation, Next: Search Path, Prev: Include Syntax, Up: Header Files
  541. 2.2 Include Operation
  542. =====================
  543. The '#include' directive works by directing the C preprocessor to scan
  544. the specified file as input before continuing with the rest of the
  545. current file. The output from the preprocessor contains the output
  546. already generated, followed by the output resulting from the included
  547. file, followed by the output that comes from the text after the
  548. '#include' directive. For example, if you have a header file 'header.h'
  549. as follows,
  550. char *test (void);
  551. and a main program called 'program.c' that uses the header file, like
  552. this,
  553. int x;
  554. #include "header.h"
  555. int
  556. main (void)
  557. {
  558. puts (test ());
  559. }
  560. the compiler will see the same token stream as it would if 'program.c'
  561. read
  562. int x;
  563. char *test (void);
  564. int
  565. main (void)
  566. {
  567. puts (test ());
  568. }
  569. Included files are not limited to declarations and macro definitions;
  570. those are merely the typical uses. Any fragment of a C program can be
  571. included from another file. The include file could even contain the
  572. beginning of a statement that is concluded in the containing file, or
  573. the end of a statement that was started in the including file. However,
  574. an included file must consist of complete tokens. Comments and string
  575. literals which have not been closed by the end of an included file are
  576. invalid. For error recovery, they are considered to end at the end of
  577. the file.
  578. To avoid confusion, it is best if header files contain only complete
  579. syntactic units--function declarations or definitions, type
  580. declarations, etc.
  581. The line following the '#include' directive is always treated as a
  582. separate line by the C preprocessor, even if the included file lacks a
  583. final newline.
  584. 
  585. File: cpp.info, Node: Search Path, Next: Once-Only Headers, Prev: Include Operation, Up: Header Files
  586. 2.3 Search Path
  587. ===============
  588. By default, the preprocessor looks for header files included by the
  589. quote form of the directive '#include "FILE"' first relative to the
  590. directory of the current file, and then in a preconfigured list of
  591. standard system directories. For example, if '/usr/include/sys/stat.h'
  592. contains '#include "types.h"', GCC looks for 'types.h' first in
  593. '/usr/include/sys', then in its usual search path.
  594. For the angle-bracket form '#include <FILE>', the preprocessor's
  595. default behavior is to look only in the standard system directories.
  596. The exact search directory list depends on the target system, how GCC is
  597. configured, and where it is installed. You can find the default search
  598. directory list for your version of CPP by invoking it with the '-v'
  599. option. For example,
  600. cpp -v /dev/null -o /dev/null
  601. There are a number of command-line options you can use to add
  602. additional directories to the search path. The most commonly-used
  603. option is '-IDIR', which causes DIR to be searched after the current
  604. directory (for the quote form of the directive) and ahead of the
  605. standard system directories. You can specify multiple '-I' options on
  606. the command line, in which case the directories are searched in
  607. left-to-right order.
  608. If you need separate control over the search paths for the quote and
  609. angle-bracket forms of the '#include' directive, you can use the
  610. '-iquote' and/or '-isystem' options instead of '-I'. *Note
  611. Invocation::, for a detailed description of these options, as well as
  612. others that are less generally useful.
  613. If you specify other options on the command line, such as '-I', that
  614. affect where the preprocessor searches for header files, the directory
  615. list printed by the '-v' option reflects the actual search path used by
  616. the preprocessor.
  617. Note that you can also prevent the preprocessor from searching any of
  618. the default system header directories with the '-nostdinc' option. This
  619. is useful when you are compiling an operating system kernel or some
  620. other program that does not use the standard C library facilities, or
  621. the standard C library itself.
  622. 
  623. File: cpp.info, Node: Once-Only Headers, Next: Alternatives to Wrapper #ifndef, Prev: Search Path, Up: Header Files
  624. 2.4 Once-Only Headers
  625. =====================
  626. If a header file happens to be included twice, the compiler will process
  627. its contents twice. This is very likely to cause an error, e.g. when
  628. the compiler sees the same structure definition twice. Even if it does
  629. not, it will certainly waste time.
  630. The standard way to prevent this is to enclose the entire real
  631. contents of the file in a conditional, like this:
  632. /* File foo. */
  633. #ifndef FILE_FOO_SEEN
  634. #define FILE_FOO_SEEN
  635. THE ENTIRE FILE
  636. #endif /* !FILE_FOO_SEEN */
  637. This construct is commonly known as a "wrapper #ifndef". When the
  638. header is included again, the conditional will be false, because
  639. 'FILE_FOO_SEEN' is defined. The preprocessor will skip over the entire
  640. contents of the file, and the compiler will not see it twice.
  641. CPP optimizes even further. It remembers when a header file has a
  642. wrapper '#ifndef'. If a subsequent '#include' specifies that header,
  643. and the macro in the '#ifndef' is still defined, it does not bother to
  644. rescan the file at all.
  645. You can put comments outside the wrapper. They will not interfere
  646. with this optimization.
  647. The macro 'FILE_FOO_SEEN' is called the "controlling macro" or "guard
  648. macro". In a user header file, the macro name should not begin with
  649. '_'. In a system header file, it should begin with '__' to avoid
  650. conflicts with user programs. In any kind of header file, the macro
  651. name should contain the name of the file and some additional text, to
  652. avoid conflicts with other header files.
  653. 
  654. File: cpp.info, Node: Alternatives to Wrapper #ifndef, Next: Computed Includes, Prev: Once-Only Headers, Up: Header Files
  655. 2.5 Alternatives to Wrapper #ifndef
  656. ===================================
  657. CPP supports two more ways of indicating that a header file should be
  658. read only once. Neither one is as portable as a wrapper '#ifndef' and
  659. we recommend you do not use them in new programs, with the caveat that
  660. '#import' is standard practice in Objective-C.
  661. CPP supports a variant of '#include' called '#import' which includes
  662. a file, but does so at most once. If you use '#import' instead of
  663. '#include', then you don't need the conditionals inside the header file
  664. to prevent multiple inclusion of the contents. '#import' is standard in
  665. Objective-C, but is considered a deprecated extension in C and C++.
  666. '#import' is not a well designed feature. It requires the users of a
  667. header file to know that it should only be included once. It is much
  668. better for the header file's implementor to write the file so that users
  669. don't need to know this. Using a wrapper '#ifndef' accomplishes this
  670. goal.
  671. In the present implementation, a single use of '#import' will prevent
  672. the file from ever being read again, by either '#import' or '#include'.
  673. You should not rely on this; do not use both '#import' and '#include' to
  674. refer to the same header file.
  675. Another way to prevent a header file from being included more than
  676. once is with the '#pragma once' directive (*note Pragmas::). '#pragma
  677. once' does not have the problems that '#import' does, but it is not
  678. recognized by all preprocessors, so you cannot rely on it in a portable
  679. program.
  680. 
  681. File: cpp.info, Node: Computed Includes, Next: Wrapper Headers, Prev: Alternatives to Wrapper #ifndef, Up: Header Files
  682. 2.6 Computed Includes
  683. =====================
  684. Sometimes it is necessary to select one of several different header
  685. files to be included into your program. They might specify
  686. configuration parameters to be used on different sorts of operating
  687. systems, for instance. You could do this with a series of conditionals,
  688. #if SYSTEM_1
  689. # include "system_1.h"
  690. #elif SYSTEM_2
  691. # include "system_2.h"
  692. #elif SYSTEM_3
  693. ...
  694. #endif
  695. That rapidly becomes tedious. Instead, the preprocessor offers the
  696. ability to use a macro for the header name. This is called a "computed
  697. include". Instead of writing a header name as the direct argument of
  698. '#include', you simply put a macro name there instead:
  699. #define SYSTEM_H "system_1.h"
  700. ...
  701. #include SYSTEM_H
  702. 'SYSTEM_H' will be expanded, and the preprocessor will look for
  703. 'system_1.h' as if the '#include' had been written that way originally.
  704. 'SYSTEM_H' could be defined by your Makefile with a '-D' option.
  705. You must be careful when you define the macro. '#define' saves
  706. tokens, not text. The preprocessor has no way of knowing that the macro
  707. will be used as the argument of '#include', so it generates ordinary
  708. tokens, not a header name. This is unlikely to cause problems if you
  709. use double-quote includes, which are close enough to string constants.
  710. If you use angle brackets, however, you may have trouble.
  711. The syntax of a computed include is actually a bit more general than
  712. the above. If the first non-whitespace character after '#include' is
  713. not '"' or '<', then the entire line is macro-expanded like running text
  714. would be.
  715. If the line expands to a single string constant, the contents of that
  716. string constant are the file to be included. CPP does not re-examine
  717. the string for embedded quotes, but neither does it process backslash
  718. escapes in the string. Therefore
  719. #define HEADER "a\"b"
  720. #include HEADER
  721. looks for a file named 'a\"b'. CPP searches for the file according to
  722. the rules for double-quoted includes.
  723. If the line expands to a token stream beginning with a '<' token and
  724. including a '>' token, then the tokens between the '<' and the first '>'
  725. are combined to form the filename to be included. Any whitespace
  726. between tokens is reduced to a single space; then any space after the
  727. initial '<' is retained, but a trailing space before the closing '>' is
  728. ignored. CPP searches for the file according to the rules for
  729. angle-bracket includes.
  730. In either case, if there are any tokens on the line after the file
  731. name, an error occurs and the directive is not processed. It is also an
  732. error if the result of expansion does not match either of the two
  733. expected forms.
  734. These rules are implementation-defined behavior according to the C
  735. standard. To minimize the risk of different compilers interpreting your
  736. computed includes differently, we recommend you use only a single
  737. object-like macro which expands to a string constant. This will also
  738. minimize confusion for people reading your program.
  739. 
  740. File: cpp.info, Node: Wrapper Headers, Next: System Headers, Prev: Computed Includes, Up: Header Files
  741. 2.7 Wrapper Headers
  742. ===================
  743. Sometimes it is necessary to adjust the contents of a system-provided
  744. header file without editing it directly. GCC's 'fixincludes' operation
  745. does this, for example. One way to do that would be to create a new
  746. header file with the same name and insert it in the search path before
  747. the original header. That works fine as long as you're willing to
  748. replace the old header entirely. But what if you want to refer to the
  749. old header from the new one?
  750. You cannot simply include the old header with '#include'. That will
  751. start from the beginning, and find your new header again. If your
  752. header is not protected from multiple inclusion (*note Once-Only
  753. Headers::), it will recurse infinitely and cause a fatal error.
  754. You could include the old header with an absolute pathname:
  755. #include "/usr/include/old-header.h"
  756. This works, but is not clean; should the system headers ever move, you
  757. would have to edit the new headers to match.
  758. There is no way to solve this problem within the C standard, but you
  759. can use the GNU extension '#include_next'. It means, "Include the
  760. _next_ file with this name". This directive works like '#include'
  761. except in searching for the specified file: it starts searching the list
  762. of header file directories _after_ the directory in which the current
  763. file was found.
  764. Suppose you specify '-I /usr/local/include', and the list of
  765. directories to search also includes '/usr/include'; and suppose both
  766. directories contain 'signal.h'. Ordinary '#include <signal.h>' finds
  767. the file under '/usr/local/include'. If that file contains
  768. '#include_next <signal.h>', it starts searching after that directory,
  769. and finds the file in '/usr/include'.
  770. '#include_next' does not distinguish between '<FILE>' and '"FILE"'
  771. inclusion, nor does it check that the file you specify has the same name
  772. as the current file. It simply looks for the file named, starting with
  773. the directory in the search path after the one where the current file
  774. was found.
  775. The use of '#include_next' can lead to great confusion. We recommend
  776. it be used only when there is no other alternative. In particular, it
  777. should not be used in the headers belonging to a specific program; it
  778. should be used only to make global corrections along the lines of
  779. 'fixincludes'.
  780. 
  781. File: cpp.info, Node: System Headers, Prev: Wrapper Headers, Up: Header Files
  782. 2.8 System Headers
  783. ==================
  784. The header files declaring interfaces to the operating system and
  785. runtime libraries often cannot be written in strictly conforming C.
  786. Therefore, GCC gives code found in "system headers" special treatment.
  787. All warnings, other than those generated by '#warning' (*note
  788. Diagnostics::), are suppressed while GCC is processing a system header.
  789. Macros defined in a system header are immune to a few warnings wherever
  790. they are expanded. This immunity is granted on an ad-hoc basis, when we
  791. find that a warning generates lots of false positives because of code in
  792. macros defined in system headers.
  793. Normally, only the headers found in specific directories are
  794. considered system headers. These directories are determined when GCC is
  795. compiled. There are, however, two ways to make normal headers into
  796. system headers:
  797. * Header files found in directories added to the search path with the
  798. '-isystem' and '-idirafter' command-line options are treated as
  799. system headers for the purposes of diagnostics.
  800. * There is also a directive, '#pragma GCC system_header', which tells
  801. GCC to consider the rest of the current include file a system
  802. header, no matter where it was found. Code that comes before the
  803. '#pragma' in the file is not affected. '#pragma GCC system_header'
  804. has no effect in the primary source file.
  805. On some targets, such as RS/6000 AIX, GCC implicitly surrounds all
  806. system headers with an 'extern "C"' block when compiling as C++.
  807. 
  808. File: cpp.info, Node: Macros, Next: Conditionals, Prev: Header Files, Up: Top
  809. 3 Macros
  810. ********
  811. A "macro" is a fragment of code which has been given a name. Whenever
  812. the name is used, it is replaced by the contents of the macro. There
  813. are two kinds of macros. They differ mostly in what they look like when
  814. they are used. "Object-like" macros resemble data objects when used,
  815. "function-like" macros resemble function calls.
  816. You may define any valid identifier as a macro, even if it is a C
  817. keyword. The preprocessor does not know anything about keywords. This
  818. can be useful if you wish to hide a keyword such as 'const' from an
  819. older compiler that does not understand it. However, the preprocessor
  820. operator 'defined' (*note Defined::) can never be defined as a macro,
  821. and C++'s named operators (*note C++ Named Operators::) cannot be macros
  822. when you are compiling C++.
  823. * Menu:
  824. * Object-like Macros::
  825. * Function-like Macros::
  826. * Macro Arguments::
  827. * Stringizing::
  828. * Concatenation::
  829. * Variadic Macros::
  830. * Predefined Macros::
  831. * Undefining and Redefining Macros::
  832. * Directives Within Macro Arguments::
  833. * Macro Pitfalls::
  834. 
  835. File: cpp.info, Node: Object-like Macros, Next: Function-like Macros, Up: Macros
  836. 3.1 Object-like Macros
  837. ======================
  838. An "object-like macro" is a simple identifier which will be replaced by
  839. a code fragment. It is called object-like because it looks like a data
  840. object in code that uses it. They are most commonly used to give
  841. symbolic names to numeric constants.
  842. You create macros with the '#define' directive. '#define' is
  843. followed by the name of the macro and then the token sequence it should
  844. be an abbreviation for, which is variously referred to as the macro's
  845. "body", "expansion" or "replacement list". For example,
  846. #define BUFFER_SIZE 1024
  847. defines a macro named 'BUFFER_SIZE' as an abbreviation for the token
  848. '1024'. If somewhere after this '#define' directive there comes a C
  849. statement of the form
  850. foo = (char *) malloc (BUFFER_SIZE);
  851. then the C preprocessor will recognize and "expand" the macro
  852. 'BUFFER_SIZE'. The C compiler will see the same tokens as it would if
  853. you had written
  854. foo = (char *) malloc (1024);
  855. By convention, macro names are written in uppercase. Programs are
  856. easier to read when it is possible to tell at a glance which names are
  857. macros.
  858. The macro's body ends at the end of the '#define' line. You may
  859. continue the definition onto multiple lines, if necessary, using
  860. backslash-newline. When the macro is expanded, however, it will all
  861. come out on one line. For example,
  862. #define NUMBERS 1, \
  863. 2, \
  864. 3
  865. int x[] = { NUMBERS };
  866. ==> int x[] = { 1, 2, 3 };
  867. The most common visible consequence of this is surprising line numbers
  868. in error messages.
  869. There is no restriction on what can go in a macro body provided it
  870. decomposes into valid preprocessing tokens. Parentheses need not
  871. balance, and the body need not resemble valid C code. (If it does not,
  872. you may get error messages from the C compiler when you use the macro.)
  873. The C preprocessor scans your program sequentially. Macro
  874. definitions take effect at the place you write them. Therefore, the
  875. following input to the C preprocessor
  876. foo = X;
  877. #define X 4
  878. bar = X;
  879. produces
  880. foo = X;
  881. bar = 4;
  882. When the preprocessor expands a macro name, the macro's expansion
  883. replaces the macro invocation, then the expansion is examined for more
  884. macros to expand. For example,
  885. #define TABLESIZE BUFSIZE
  886. #define BUFSIZE 1024
  887. TABLESIZE
  888. ==> BUFSIZE
  889. ==> 1024
  890. 'TABLESIZE' is expanded first to produce 'BUFSIZE', then that macro is
  891. expanded to produce the final result, '1024'.
  892. Notice that 'BUFSIZE' was not defined when 'TABLESIZE' was defined.
  893. The '#define' for 'TABLESIZE' uses exactly the expansion you specify--in
  894. this case, 'BUFSIZE'--and does not check to see whether it too contains
  895. macro names. Only when you _use_ 'TABLESIZE' is the result of its
  896. expansion scanned for more macro names.
  897. This makes a difference if you change the definition of 'BUFSIZE' at
  898. some point in the source file. 'TABLESIZE', defined as shown, will
  899. always expand using the definition of 'BUFSIZE' that is currently in
  900. effect:
  901. #define BUFSIZE 1020
  902. #define TABLESIZE BUFSIZE
  903. #undef BUFSIZE
  904. #define BUFSIZE 37
  905. Now 'TABLESIZE' expands (in two stages) to '37'.
  906. If the expansion of a macro contains its own name, either directly or
  907. via intermediate macros, it is not expanded again when the expansion is
  908. examined for more macros. This prevents infinite recursion. *Note
  909. Self-Referential Macros::, for the precise details.
  910. 
  911. File: cpp.info, Node: Function-like Macros, Next: Macro Arguments, Prev: Object-like Macros, Up: Macros
  912. 3.2 Function-like Macros
  913. ========================
  914. You can also define macros whose use looks like a function call. These
  915. are called "function-like macros". To define a function-like macro, you
  916. use the same '#define' directive, but you put a pair of parentheses
  917. immediately after the macro name. For example,
  918. #define lang_init() c_init()
  919. lang_init()
  920. ==> c_init()
  921. A function-like macro is only expanded if its name appears with a
  922. pair of parentheses after it. If you write just the name, it is left
  923. alone. This can be useful when you have a function and a macro of the
  924. same name, and you wish to use the function sometimes.
  925. extern void foo(void);
  926. #define foo() /* optimized inline version */
  927. ...
  928. foo();
  929. funcptr = foo;
  930. Here the call to 'foo()' will use the macro, but the function pointer
  931. will get the address of the real function. If the macro were to be
  932. expanded, it would cause a syntax error.
  933. If you put spaces between the macro name and the parentheses in the
  934. macro definition, that does not define a function-like macro, it defines
  935. an object-like macro whose expansion happens to begin with a pair of
  936. parentheses.
  937. #define lang_init () c_init()
  938. lang_init()
  939. ==> () c_init()()
  940. The first two pairs of parentheses in this expansion come from the
  941. macro. The third is the pair that was originally after the macro
  942. invocation. Since 'lang_init' is an object-like macro, it does not
  943. consume those parentheses.
  944. 
  945. File: cpp.info, Node: Macro Arguments, Next: Stringizing, Prev: Function-like Macros, Up: Macros
  946. 3.3 Macro Arguments
  947. ===================
  948. Function-like macros can take "arguments", just like true functions. To
  949. define a macro that uses arguments, you insert "parameters" between the
  950. pair of parentheses in the macro definition that make the macro
  951. function-like. The parameters must be valid C identifiers, separated by
  952. commas and optionally whitespace.
  953. To invoke a macro that takes arguments, you write the name of the
  954. macro followed by a list of "actual arguments" in parentheses, separated
  955. by commas. The invocation of the macro need not be restricted to a
  956. single logical line--it can cross as many lines in the source file as
  957. you wish. The number of arguments you give must match the number of
  958. parameters in the macro definition. When the macro is expanded, each
  959. use of a parameter in its body is replaced by the tokens of the
  960. corresponding argument. (You need not use all of the parameters in the
  961. macro body.)
  962. As an example, here is a macro that computes the minimum of two
  963. numeric values, as it is defined in many C programs, and some uses.
  964. #define min(X, Y) ((X) < (Y) ? (X) : (Y))
  965. x = min(a, b); ==> x = ((a) < (b) ? (a) : (b));
  966. y = min(1, 2); ==> y = ((1) < (2) ? (1) : (2));
  967. z = min(a + 28, *p); ==> z = ((a + 28) < (*p) ? (a + 28) : (*p));
  968. (In this small example you can already see several of the dangers of
  969. macro arguments. *Note Macro Pitfalls::, for detailed explanations.)
  970. Leading and trailing whitespace in each argument is dropped, and all
  971. whitespace between the tokens of an argument is reduced to a single
  972. space. Parentheses within each argument must balance; a comma within
  973. such parentheses does not end the argument. However, there is no
  974. requirement for square brackets or braces to balance, and they do not
  975. prevent a comma from separating arguments. Thus,
  976. macro (array[x = y, x + 1])
  977. passes two arguments to 'macro': 'array[x = y' and 'x + 1]'. If you
  978. want to supply 'array[x = y, x + 1]' as an argument, you can write it as
  979. 'array[(x = y, x + 1)]', which is equivalent C code.
  980. All arguments to a macro are completely macro-expanded before they
  981. are substituted into the macro body. After substitution, the complete
  982. text is scanned again for macros to expand, including the arguments.
  983. This rule may seem strange, but it is carefully designed so you need not
  984. worry about whether any function call is actually a macro invocation.
  985. You can run into trouble if you try to be too clever, though. *Note
  986. Argument Prescan::, for detailed discussion.
  987. For example, 'min (min (a, b), c)' is first expanded to
  988. min (((a) < (b) ? (a) : (b)), (c))
  989. and then to
  990. ((((a) < (b) ? (a) : (b))) < (c)
  991. ? (((a) < (b) ? (a) : (b)))
  992. : (c))
  993. (Line breaks shown here for clarity would not actually be generated.)
  994. You can leave macro arguments empty; this is not an error to the
  995. preprocessor (but many macros will then expand to invalid code). You
  996. cannot leave out arguments entirely; if a macro takes two arguments,
  997. there must be exactly one comma at the top level of its argument list.
  998. Here are some silly examples using 'min':
  999. min(, b) ==> (( ) < (b) ? ( ) : (b))
  1000. min(a, ) ==> ((a ) < ( ) ? (a ) : ( ))
  1001. min(,) ==> (( ) < ( ) ? ( ) : ( ))
  1002. min((,),) ==> (((,)) < ( ) ? ((,)) : ( ))
  1003. min() error-> macro "min" requires 2 arguments, but only 1 given
  1004. min(,,) error-> macro "min" passed 3 arguments, but takes just 2
  1005. Whitespace is not a preprocessing token, so if a macro 'foo' takes
  1006. one argument, 'foo ()' and 'foo ( )' both supply it an empty argument.
  1007. Previous GNU preprocessor implementations and documentation were
  1008. incorrect on this point, insisting that a function-like macro that takes
  1009. a single argument be passed a space if an empty argument was required.
  1010. Macro parameters appearing inside string literals are not replaced by
  1011. their corresponding actual arguments.
  1012. #define foo(x) x, "x"
  1013. foo(bar) ==> bar, "x"
  1014. 
  1015. File: cpp.info, Node: Stringizing, Next: Concatenation, Prev: Macro Arguments, Up: Macros
  1016. 3.4 Stringizing
  1017. ===============
  1018. Sometimes you may want to convert a macro argument into a string
  1019. constant. Parameters are not replaced inside string constants, but you
  1020. can use the '#' preprocessing operator instead. When a macro parameter
  1021. is used with a leading '#', the preprocessor replaces it with the
  1022. literal text of the actual argument, converted to a string constant.
  1023. Unlike normal parameter replacement, the argument is not macro-expanded
  1024. first. This is called "stringizing".
  1025. There is no way to combine an argument with surrounding text and
  1026. stringize it all together. Instead, you can write a series of adjacent
  1027. string constants and stringized arguments. The preprocessor replaces
  1028. the stringized arguments with string constants. The C compiler then
  1029. combines all the adjacent string constants into one long string.
  1030. Here is an example of a macro definition that uses stringizing:
  1031. #define WARN_IF(EXP) \
  1032. do { if (EXP) \
  1033. fprintf (stderr, "Warning: " #EXP "\n"); } \
  1034. while (0)
  1035. WARN_IF (x == 0);
  1036. ==> do { if (x == 0)
  1037. fprintf (stderr, "Warning: " "x == 0" "\n"); } while (0);
  1038. The argument for 'EXP' is substituted once, as-is, into the 'if'
  1039. statement, and once, stringized, into the argument to 'fprintf'. If 'x'
  1040. were a macro, it would be expanded in the 'if' statement, but not in the
  1041. string.
  1042. The 'do' and 'while (0)' are a kludge to make it possible to write
  1043. 'WARN_IF (ARG);', which the resemblance of 'WARN_IF' to a function would
  1044. make C programmers want to do; see *note Swallowing the Semicolon::.
  1045. Stringizing in C involves more than putting double-quote characters
  1046. around the fragment. The preprocessor backslash-escapes the quotes
  1047. surrounding embedded string constants, and all backslashes within string
  1048. and character constants, in order to get a valid C string constant with
  1049. the proper contents. Thus, stringizing 'p = "foo\n";' results in
  1050. "p = \"foo\\n\";". However, backslashes that are not inside string or
  1051. character constants are not duplicated: '\n' by itself stringizes to
  1052. "\n".
  1053. All leading and trailing whitespace in text being stringized is
  1054. ignored. Any sequence of whitespace in the middle of the text is
  1055. converted to a single space in the stringized result. Comments are
  1056. replaced by whitespace long before stringizing happens, so they never
  1057. appear in stringized text.
  1058. There is no way to convert a macro argument into a character
  1059. constant.
  1060. If you want to stringize the result of expansion of a macro argument,
  1061. you have to use two levels of macros.
  1062. #define xstr(s) str(s)
  1063. #define str(s) #s
  1064. #define foo 4
  1065. str (foo)
  1066. ==> "foo"
  1067. xstr (foo)
  1068. ==> xstr (4)
  1069. ==> str (4)
  1070. ==> "4"
  1071. 's' is stringized when it is used in 'str', so it is not
  1072. macro-expanded first. But 's' is an ordinary argument to 'xstr', so it
  1073. is completely macro-expanded before 'xstr' itself is expanded (*note
  1074. Argument Prescan::). Therefore, by the time 'str' gets to its argument,
  1075. it has already been macro-expanded.
  1076. 
  1077. File: cpp.info, Node: Concatenation, Next: Variadic Macros, Prev: Stringizing, Up: Macros
  1078. 3.5 Concatenation
  1079. =================
  1080. It is often useful to merge two tokens into one while expanding macros.
  1081. This is called "token pasting" or "token concatenation". The '##'
  1082. preprocessing operator performs token pasting. When a macro is
  1083. expanded, the two tokens on either side of each '##' operator are
  1084. combined into a single token, which then replaces the '##' and the two
  1085. original tokens in the macro expansion. Usually both will be
  1086. identifiers, or one will be an identifier and the other a preprocessing
  1087. number. When pasted, they make a longer identifier. This isn't the
  1088. only valid case. It is also possible to concatenate two numbers (or a
  1089. number and a name, such as '1.5' and 'e3') into a number. Also,
  1090. multi-character operators such as '+=' can be formed by token pasting.
  1091. However, two tokens that don't together form a valid token cannot be
  1092. pasted together. For example, you cannot concatenate 'x' with '+' in
  1093. either order. If you try, the preprocessor issues a warning and emits
  1094. the two tokens. Whether it puts white space between the tokens is
  1095. undefined. It is common to find unnecessary uses of '##' in complex
  1096. macros. If you get this warning, it is likely that you can simply
  1097. remove the '##'.
  1098. Both the tokens combined by '##' could come from the macro body, but
  1099. you could just as well write them as one token in the first place.
  1100. Token pasting is most useful when one or both of the tokens comes from a
  1101. macro argument. If either of the tokens next to an '##' is a parameter
  1102. name, it is replaced by its actual argument before '##' executes. As
  1103. with stringizing, the actual argument is not macro-expanded first. If
  1104. the argument is empty, that '##' has no effect.
  1105. Keep in mind that the C preprocessor converts comments to whitespace
  1106. before macros are even considered. Therefore, you cannot create a
  1107. comment by concatenating '/' and '*'. You can put as much whitespace
  1108. between '##' and its operands as you like, including comments, and you
  1109. can put comments in arguments that will be concatenated. However, it is
  1110. an error if '##' appears at either end of a macro body.
  1111. Consider a C program that interprets named commands. There probably
  1112. needs to be a table of commands, perhaps an array of structures declared
  1113. as follows:
  1114. struct command
  1115. {
  1116. char *name;
  1117. void (*function) (void);
  1118. };
  1119. struct command commands[] =
  1120. {
  1121. { "quit", quit_command },
  1122. { "help", help_command },
  1123. ...
  1124. };
  1125. It would be cleaner not to have to give each command name twice, once
  1126. in the string constant and once in the function name. A macro which
  1127. takes the name of a command as an argument can make this unnecessary.
  1128. The string constant can be created with stringizing, and the function
  1129. name by concatenating the argument with '_command'. Here is how it is
  1130. done:
  1131. #define COMMAND(NAME) { #NAME, NAME ## _command }
  1132. struct command commands[] =
  1133. {
  1134. COMMAND (quit),
  1135. COMMAND (help),
  1136. ...
  1137. };
  1138. 
  1139. File: cpp.info, Node: Variadic Macros, Next: Predefined Macros, Prev: Concatenation, Up: Macros
  1140. 3.6 Variadic Macros
  1141. ===================
  1142. A macro can be declared to accept a variable number of arguments much as
  1143. a function can. The syntax for defining the macro is similar to that of
  1144. a function. Here is an example:
  1145. #define eprintf(...) fprintf (stderr, __VA_ARGS__)
  1146. This kind of macro is called "variadic". When the macro is invoked,
  1147. all the tokens in its argument list after the last named argument (this
  1148. macro has none), including any commas, become the "variable argument".
  1149. This sequence of tokens replaces the identifier '__VA_ARGS__' in the
  1150. macro body wherever it appears. Thus, we have this expansion:
  1151. eprintf ("%s:%d: ", input_file, lineno)
  1152. ==> fprintf (stderr, "%s:%d: ", input_file, lineno)
  1153. The variable argument is completely macro-expanded before it is
  1154. inserted into the macro expansion, just like an ordinary argument. You
  1155. may use the '#' and '##' operators to stringize the variable argument or
  1156. to paste its leading or trailing token with another token. (But see
  1157. below for an important special case for '##'.)
  1158. If your macro is complicated, you may want a more descriptive name
  1159. for the variable argument than '__VA_ARGS__'. CPP permits this, as an
  1160. extension. You may write an argument name immediately before the '...';
  1161. that name is used for the variable argument. The 'eprintf' macro above
  1162. could be written
  1163. #define eprintf(args...) fprintf (stderr, args)
  1164. using this extension. You cannot use '__VA_ARGS__' and this extension
  1165. in the same macro.
  1166. You can have named arguments as well as variable arguments in a
  1167. variadic macro. We could define 'eprintf' like this, instead:
  1168. #define eprintf(format, ...) fprintf (stderr, format, __VA_ARGS__)
  1169. This formulation looks more descriptive, but historically it was less
  1170. flexible: you had to supply at least one argument after the format
  1171. string. In standard C, you could not omit the comma separating the
  1172. named argument from the variable arguments. (Note that this restriction
  1173. has been lifted in C++2a, and never existed in GNU C; see below.)
  1174. Furthermore, if you left the variable argument empty, you would have
  1175. gotten a syntax error, because there would have been an extra comma
  1176. after the format string.
  1177. eprintf("success!\n", );
  1178. ==> fprintf(stderr, "success!\n", );
  1179. This has been fixed in C++2a, and GNU CPP also has a pair of
  1180. extensions which deal with this problem.
  1181. First, in GNU CPP, and in C++ beginning in C++2a, you are allowed to
  1182. leave the variable argument out entirely:
  1183. eprintf ("success!\n")
  1184. ==> fprintf(stderr, "success!\n", );
  1185. Second, C++2a introduces the '__VA_OPT__' function macro. This macro
  1186. may only appear in the definition of a variadic macro. If the variable
  1187. argument has any tokens, then a '__VA_OPT__' invocation expands to its
  1188. argument; but if the variable argument does not have any tokens, the
  1189. '__VA_OPT__' expands to nothing:
  1190. #define eprintf(format, ...) \
  1191. fprintf (stderr, format __VA_OPT__(,) __VA_ARGS__)
  1192. '__VA_OPT__' is also available in GNU C and GNU C++.
  1193. Historically, GNU CPP has also had another extension to handle the
  1194. trailing comma: the '##' token paste operator has a special meaning when
  1195. placed between a comma and a variable argument. Despite the
  1196. introduction of '__VA_OPT__', this extension remains supported in GNU
  1197. CPP, for backward compatibility. If you write
  1198. #define eprintf(format, ...) fprintf (stderr, format, ##__VA_ARGS__)
  1199. and the variable argument is left out when the 'eprintf' macro is used,
  1200. then the comma before the '##' will be deleted. This does _not_ happen
  1201. if you pass an empty argument, nor does it happen if the token preceding
  1202. '##' is anything other than a comma.
  1203. eprintf ("success!\n")
  1204. ==> fprintf(stderr, "success!\n");
  1205. The above explanation is ambiguous about the case where the only macro
  1206. parameter is a variable arguments parameter, as it is meaningless to try
  1207. to distinguish whether no argument at all is an empty argument or a
  1208. missing argument. CPP retains the comma when conforming to a specific C
  1209. standard. Otherwise the comma is dropped as an extension to the
  1210. standard.
  1211. The C standard mandates that the only place the identifier
  1212. '__VA_ARGS__' can appear is in the replacement list of a variadic macro.
  1213. It may not be used as a macro name, macro argument name, or within a
  1214. different type of macro. It may also be forbidden in open text; the
  1215. standard is ambiguous. We recommend you avoid using it except for its
  1216. defined purpose.
  1217. Likewise, C++ forbids '__VA_OPT__' anywhere outside the replacement
  1218. list of a variadic macro.
  1219. Variadic macros became a standard part of the C language with C99.
  1220. GNU CPP previously supported them with a named variable argument
  1221. ('args...', not '...' and '__VA_ARGS__'), which is still supported for
  1222. backward compatibility.
  1223. 
  1224. File: cpp.info, Node: Predefined Macros, Next: Undefining and Redefining Macros, Prev: Variadic Macros, Up: Macros
  1225. 3.7 Predefined Macros
  1226. =====================
  1227. Several object-like macros are predefined; you use them without
  1228. supplying their definitions. They fall into three classes: standard,
  1229. common, and system-specific.
  1230. In C++, there is a fourth category, the named operators. They act
  1231. like predefined macros, but you cannot undefine them.
  1232. * Menu:
  1233. * Standard Predefined Macros::
  1234. * Common Predefined Macros::
  1235. * System-specific Predefined Macros::
  1236. * C++ Named Operators::
  1237. 
  1238. File: cpp.info, Node: Standard Predefined Macros, Next: Common Predefined Macros, Up: Predefined Macros
  1239. 3.7.1 Standard Predefined Macros
  1240. --------------------------------
  1241. The standard predefined macros are specified by the relevant language
  1242. standards, so they are available with all compilers that implement those
  1243. standards. Older compilers may not provide all of them. Their names
  1244. all start with double underscores.
  1245. '__FILE__'
  1246. This macro expands to the name of the current input file, in the
  1247. form of a C string constant. This is the path by which the
  1248. preprocessor opened the file, not the short name specified in
  1249. '#include' or as the input file name argument. For example,
  1250. '"/usr/local/include/myheader.h"' is a possible expansion of this
  1251. macro.
  1252. '__LINE__'
  1253. This macro expands to the current input line number, in the form of
  1254. a decimal integer constant. While we call it a predefined macro,
  1255. it's a pretty strange macro, since its "definition" changes with
  1256. each new line of source code.
  1257. '__FILE__' and '__LINE__' are useful in generating an error message
  1258. to report an inconsistency detected by the program; the message can
  1259. state the source line at which the inconsistency was detected. For
  1260. example,
  1261. fprintf (stderr, "Internal error: "
  1262. "negative string length "
  1263. "%d at %s, line %d.",
  1264. length, __FILE__, __LINE__);
  1265. An '#include' directive changes the expansions of '__FILE__' and
  1266. '__LINE__' to correspond to the included file. At the end of that file,
  1267. when processing resumes on the input file that contained the '#include'
  1268. directive, the expansions of '__FILE__' and '__LINE__' revert to the
  1269. values they had before the '#include' (but '__LINE__' is then
  1270. incremented by one as processing moves to the line after the
  1271. '#include').
  1272. A '#line' directive changes '__LINE__', and may change '__FILE__' as
  1273. well. *Note Line Control::.
  1274. C99 introduced '__func__', and GCC has provided '__FUNCTION__' for a
  1275. long time. Both of these are strings containing the name of the current
  1276. function (there are slight semantic differences; see the GCC manual).
  1277. Neither of them is a macro; the preprocessor does not know the name of
  1278. the current function. They tend to be useful in conjunction with
  1279. '__FILE__' and '__LINE__', though.
  1280. '__DATE__'
  1281. This macro expands to a string constant that describes the date on
  1282. which the preprocessor is being run. The string constant contains
  1283. eleven characters and looks like '"Feb 12 1996"'. If the day of
  1284. the month is less than 10, it is padded with a space on the left.
  1285. If GCC cannot determine the current date, it will emit a warning
  1286. message (once per compilation) and '__DATE__' will expand to
  1287. '"??? ?? ????"'.
  1288. '__TIME__'
  1289. This macro expands to a string constant that describes the time at
  1290. which the preprocessor is being run. The string constant contains
  1291. eight characters and looks like '"23:59:01"'.
  1292. If GCC cannot determine the current time, it will emit a warning
  1293. message (once per compilation) and '__TIME__' will expand to
  1294. '"??:??:??"'.
  1295. '__STDC__'
  1296. In normal operation, this macro expands to the constant 1, to
  1297. signify that this compiler conforms to ISO Standard C. If GNU CPP
  1298. is used with a compiler other than GCC, this is not necessarily
  1299. true; however, the preprocessor always conforms to the standard
  1300. unless the '-traditional-cpp' option is used.
  1301. This macro is not defined if the '-traditional-cpp' option is used.
  1302. On some hosts, the system compiler uses a different convention,
  1303. where '__STDC__' is normally 0, but is 1 if the user specifies
  1304. strict conformance to the C Standard. CPP follows the host
  1305. convention when processing system header files, but when processing
  1306. user files '__STDC__' is always 1. This has been reported to cause
  1307. problems; for instance, some versions of Solaris provide X Windows
  1308. headers that expect '__STDC__' to be either undefined or 1. *Note
  1309. Invocation::.
  1310. '__STDC_VERSION__'
  1311. This macro expands to the C Standard's version number, a long
  1312. integer constant of the form 'YYYYMML' where YYYY and MM are the
  1313. year and month of the Standard version. This signifies which
  1314. version of the C Standard the compiler conforms to. Like
  1315. '__STDC__', this is not necessarily accurate for the entire
  1316. implementation, unless GNU CPP is being used with GCC.
  1317. The value '199409L' signifies the 1989 C standard as amended in
  1318. 1994, which is the current default; the value '199901L' signifies
  1319. the 1999 revision of the C standard; the value '201112L' signifies
  1320. the 2011 revision of the C standard; the value '201710L' signifies
  1321. the 2017 revision of the C standard (which is otherwise identical
  1322. to the 2011 version apart from correction of defects). An
  1323. unspecified value larger than '201710L' is used for the
  1324. experimental '-std=c2x' and '-std=gnu2x' modes.
  1325. This macro is not defined if the '-traditional-cpp' option is used,
  1326. nor when compiling C++ or Objective-C.
  1327. '__STDC_HOSTED__'
  1328. This macro is defined, with value 1, if the compiler's target is a
  1329. "hosted environment". A hosted environment has the complete
  1330. facilities of the standard C library available.
  1331. '__cplusplus'
  1332. This macro is defined when the C++ compiler is in use. You can use
  1333. '__cplusplus' to test whether a header is compiled by a C compiler
  1334. or a C++ compiler. This macro is similar to '__STDC_VERSION__', in
  1335. that it expands to a version number. Depending on the language
  1336. standard selected, the value of the macro is '199711L' for the 1998
  1337. C++ standard, '201103L' for the 2011 C++ standard, '201402L' for
  1338. the 2014 C++ standard, '201703L' for the 2017 C++ standard,
  1339. '202002L' for the 2020 C++ standard, or an unspecified value
  1340. strictly larger than '202002L' for the experimental languages
  1341. enabled by '-std=c++23' and '-std=gnu++23'.
  1342. '__OBJC__'
  1343. This macro is defined, with value 1, when the Objective-C compiler
  1344. is in use. You can use '__OBJC__' to test whether a header is
  1345. compiled by a C compiler or an Objective-C compiler.
  1346. '__ASSEMBLER__'
  1347. This macro is defined with value 1 when preprocessing assembly
  1348. language.
  1349. 
  1350. File: cpp.info, Node: Common Predefined Macros, Next: System-specific Predefined Macros, Prev: Standard Predefined Macros, Up: Predefined Macros
  1351. 3.7.2 Common Predefined Macros
  1352. ------------------------------
  1353. The common predefined macros are GNU C extensions. They are available
  1354. with the same meanings regardless of the machine or operating system on
  1355. which you are using GNU C or GNU Fortran. Their names all start with
  1356. double underscores.
  1357. '__COUNTER__'
  1358. This macro expands to sequential integral values starting from 0.
  1359. In conjunction with the '##' operator, this provides a convenient
  1360. means to generate unique identifiers. Care must be taken to ensure
  1361. that '__COUNTER__' is not expanded prior to inclusion of
  1362. precompiled headers which use it. Otherwise, the precompiled
  1363. headers will not be used.
  1364. '__GFORTRAN__'
  1365. The GNU Fortran compiler defines this.
  1366. '__GNUC__'
  1367. '__GNUC_MINOR__'
  1368. '__GNUC_PATCHLEVEL__'
  1369. These macros are defined by all GNU compilers that use the C
  1370. preprocessor: C, C++, Objective-C and Fortran. Their values are
  1371. the major version, minor version, and patch level of the compiler,
  1372. as integer constants. For example, GCC version X.Y.Z defines
  1373. '__GNUC__' to X, '__GNUC_MINOR__' to Y, and '__GNUC_PATCHLEVEL__'
  1374. to Z. These macros are also defined if you invoke the preprocessor
  1375. directly.
  1376. If all you need to know is whether or not your program is being
  1377. compiled by GCC, or a non-GCC compiler that claims to accept the
  1378. GNU C dialects, you can simply test '__GNUC__'. If you need to
  1379. write code which depends on a specific version, you must be more
  1380. careful. Each time the minor version is increased, the patch level
  1381. is reset to zero; each time the major version is increased, the
  1382. minor version and patch level are reset. If you wish to use the
  1383. predefined macros directly in the conditional, you will need to
  1384. write it like this:
  1385. /* Test for GCC > 3.2.0 */
  1386. #if __GNUC__ > 3 || \
  1387. (__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || \
  1388. (__GNUC_MINOR__ == 2 && \
  1389. __GNUC_PATCHLEVEL__ > 0))
  1390. Another approach is to use the predefined macros to calculate a
  1391. single number, then compare that against a threshold:
  1392. #define GCC_VERSION (__GNUC__ * 10000 \
  1393. + __GNUC_MINOR__ * 100 \
  1394. + __GNUC_PATCHLEVEL__)
  1395. ...
  1396. /* Test for GCC > 3.2.0 */
  1397. #if GCC_VERSION > 30200
  1398. Many people find this form easier to understand.
  1399. '__GNUG__'
  1400. The GNU C++ compiler defines this. Testing it is equivalent to
  1401. testing '(__GNUC__ && __cplusplus)'.
  1402. '__STRICT_ANSI__'
  1403. GCC defines this macro if and only if the '-ansi' switch, or a
  1404. '-std' switch specifying strict conformance to some version of ISO
  1405. C or ISO C++, was specified when GCC was invoked. It is defined to
  1406. '1'. This macro exists primarily to direct GNU libc's header files
  1407. to use only definitions found in standard C.
  1408. '__BASE_FILE__'
  1409. This macro expands to the name of the main input file, in the form
  1410. of a C string constant. This is the source file that was specified
  1411. on the command line of the preprocessor or C compiler.
  1412. '__INCLUDE_LEVEL__'
  1413. This macro expands to a decimal integer constant that represents
  1414. the depth of nesting in include files. The value of this macro is
  1415. incremented on every '#include' directive and decremented at the
  1416. end of every included file. It starts out at 0, its value within
  1417. the base file specified on the command line.
  1418. '__ELF__'
  1419. This macro is defined if the target uses the ELF object format.
  1420. '__VERSION__'
  1421. This macro expands to a string constant which describes the version
  1422. of the compiler in use. You should not rely on its contents having
  1423. any particular form, but it can be counted on to contain at least
  1424. the release number.
  1425. '__OPTIMIZE__'
  1426. '__OPTIMIZE_SIZE__'
  1427. '__NO_INLINE__'
  1428. These macros describe the compilation mode. '__OPTIMIZE__' is
  1429. defined in all optimizing compilations. '__OPTIMIZE_SIZE__' is
  1430. defined if the compiler is optimizing for size, not speed.
  1431. '__NO_INLINE__' is defined if no functions will be inlined into
  1432. their callers (when not optimizing, or when inlining has been
  1433. specifically disabled by '-fno-inline').
  1434. These macros cause certain GNU header files to provide optimized
  1435. definitions, using macros or inline functions, of system library
  1436. functions. You should not use these macros in any way unless you
  1437. make sure that programs will execute with the same effect whether
  1438. or not they are defined. If they are defined, their value is 1.
  1439. '__GNUC_GNU_INLINE__'
  1440. GCC defines this macro if functions declared 'inline' will be
  1441. handled in GCC's traditional gnu90 mode. Object files will contain
  1442. externally visible definitions of all functions declared 'inline'
  1443. without 'extern' or 'static'. They will not contain any
  1444. definitions of any functions declared 'extern inline'.
  1445. '__GNUC_STDC_INLINE__'
  1446. GCC defines this macro if functions declared 'inline' will be
  1447. handled according to the ISO C99 or later standards. Object files
  1448. will contain externally visible definitions of all functions
  1449. declared 'extern inline'. They will not contain definitions of any
  1450. functions declared 'inline' without 'extern'.
  1451. If this macro is defined, GCC supports the 'gnu_inline' function
  1452. attribute as a way to always get the gnu90 behavior.
  1453. '__CHAR_UNSIGNED__'
  1454. GCC defines this macro if and only if the data type 'char' is
  1455. unsigned on the target machine. It exists to cause the standard
  1456. header file 'limits.h' to work correctly. You should not use this
  1457. macro yourself; instead, refer to the standard macros defined in
  1458. 'limits.h'.
  1459. '__WCHAR_UNSIGNED__'
  1460. Like '__CHAR_UNSIGNED__', this macro is defined if and only if the
  1461. data type 'wchar_t' is unsigned and the front-end is in C++ mode.
  1462. '__REGISTER_PREFIX__'
  1463. This macro expands to a single token (not a string constant) which
  1464. is the prefix applied to CPU register names in assembly language
  1465. for this target. You can use it to write assembly that is usable
  1466. in multiple environments. For example, in the 'm68k-aout'
  1467. environment it expands to nothing, but in the 'm68k-coff'
  1468. environment it expands to a single '%'.
  1469. '__USER_LABEL_PREFIX__'
  1470. This macro expands to a single token which is the prefix applied to
  1471. user labels (symbols visible to C code) in assembly. For example,
  1472. in the 'm68k-aout' environment it expands to an '_', but in the
  1473. 'm68k-coff' environment it expands to nothing.
  1474. This macro will have the correct definition even if
  1475. '-f(no-)underscores' is in use, but it will not be correct if
  1476. target-specific options that adjust this prefix are used (e.g. the
  1477. OSF/rose '-mno-underscores' option).
  1478. '__SIZE_TYPE__'
  1479. '__PTRDIFF_TYPE__'
  1480. '__WCHAR_TYPE__'
  1481. '__WINT_TYPE__'
  1482. '__INTMAX_TYPE__'
  1483. '__UINTMAX_TYPE__'
  1484. '__SIG_ATOMIC_TYPE__'
  1485. '__INT8_TYPE__'
  1486. '__INT16_TYPE__'
  1487. '__INT32_TYPE__'
  1488. '__INT64_TYPE__'
  1489. '__UINT8_TYPE__'
  1490. '__UINT16_TYPE__'
  1491. '__UINT32_TYPE__'
  1492. '__UINT64_TYPE__'
  1493. '__INT_LEAST8_TYPE__'
  1494. '__INT_LEAST16_TYPE__'
  1495. '__INT_LEAST32_TYPE__'
  1496. '__INT_LEAST64_TYPE__'
  1497. '__UINT_LEAST8_TYPE__'
  1498. '__UINT_LEAST16_TYPE__'
  1499. '__UINT_LEAST32_TYPE__'
  1500. '__UINT_LEAST64_TYPE__'
  1501. '__INT_FAST8_TYPE__'
  1502. '__INT_FAST16_TYPE__'
  1503. '__INT_FAST32_TYPE__'
  1504. '__INT_FAST64_TYPE__'
  1505. '__UINT_FAST8_TYPE__'
  1506. '__UINT_FAST16_TYPE__'
  1507. '__UINT_FAST32_TYPE__'
  1508. '__UINT_FAST64_TYPE__'
  1509. '__INTPTR_TYPE__'
  1510. '__UINTPTR_TYPE__'
  1511. These macros are defined to the correct underlying types for the
  1512. 'size_t', 'ptrdiff_t', 'wchar_t', 'wint_t', 'intmax_t',
  1513. 'uintmax_t', 'sig_atomic_t', 'int8_t', 'int16_t', 'int32_t',
  1514. 'int64_t', 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t',
  1515. 'int_least8_t', 'int_least16_t', 'int_least32_t', 'int_least64_t',
  1516. 'uint_least8_t', 'uint_least16_t', 'uint_least32_t',
  1517. 'uint_least64_t', 'int_fast8_t', 'int_fast16_t', 'int_fast32_t',
  1518. 'int_fast64_t', 'uint_fast8_t', 'uint_fast16_t', 'uint_fast32_t',
  1519. 'uint_fast64_t', 'intptr_t', and 'uintptr_t' typedefs,
  1520. respectively. They exist to make the standard header files
  1521. 'stddef.h', 'stdint.h', and 'wchar.h' work correctly. You should
  1522. not use these macros directly; instead, include the appropriate
  1523. headers and use the typedefs. Some of these macros may not be
  1524. defined on particular systems if GCC does not provide a 'stdint.h'
  1525. header on those systems.
  1526. '__CHAR_BIT__'
  1527. Defined to the number of bits used in the representation of the
  1528. 'char' data type. It exists to make the standard header given
  1529. numerical limits work correctly. You should not use this macro
  1530. directly; instead, include the appropriate headers.
  1531. '__SCHAR_MAX__'
  1532. '__WCHAR_MAX__'
  1533. '__SHRT_MAX__'
  1534. '__INT_MAX__'
  1535. '__LONG_MAX__'
  1536. '__LONG_LONG_MAX__'
  1537. '__WINT_MAX__'
  1538. '__SIZE_MAX__'
  1539. '__PTRDIFF_MAX__'
  1540. '__INTMAX_MAX__'
  1541. '__UINTMAX_MAX__'
  1542. '__SIG_ATOMIC_MAX__'
  1543. '__INT8_MAX__'
  1544. '__INT16_MAX__'
  1545. '__INT32_MAX__'
  1546. '__INT64_MAX__'
  1547. '__UINT8_MAX__'
  1548. '__UINT16_MAX__'
  1549. '__UINT32_MAX__'
  1550. '__UINT64_MAX__'
  1551. '__INT_LEAST8_MAX__'
  1552. '__INT_LEAST16_MAX__'
  1553. '__INT_LEAST32_MAX__'
  1554. '__INT_LEAST64_MAX__'
  1555. '__UINT_LEAST8_MAX__'
  1556. '__UINT_LEAST16_MAX__'
  1557. '__UINT_LEAST32_MAX__'
  1558. '__UINT_LEAST64_MAX__'
  1559. '__INT_FAST8_MAX__'
  1560. '__INT_FAST16_MAX__'
  1561. '__INT_FAST32_MAX__'
  1562. '__INT_FAST64_MAX__'
  1563. '__UINT_FAST8_MAX__'
  1564. '__UINT_FAST16_MAX__'
  1565. '__UINT_FAST32_MAX__'
  1566. '__UINT_FAST64_MAX__'
  1567. '__INTPTR_MAX__'
  1568. '__UINTPTR_MAX__'
  1569. '__WCHAR_MIN__'
  1570. '__WINT_MIN__'
  1571. '__SIG_ATOMIC_MIN__'
  1572. Defined to the maximum value of the 'signed char', 'wchar_t',
  1573. 'signed short', 'signed int', 'signed long', 'signed long long',
  1574. 'wint_t', 'size_t', 'ptrdiff_t', 'intmax_t', 'uintmax_t',
  1575. 'sig_atomic_t', 'int8_t', 'int16_t', 'int32_t', 'int64_t',
  1576. 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t', 'int_least8_t',
  1577. 'int_least16_t', 'int_least32_t', 'int_least64_t', 'uint_least8_t',
  1578. 'uint_least16_t', 'uint_least32_t', 'uint_least64_t',
  1579. 'int_fast8_t', 'int_fast16_t', 'int_fast32_t', 'int_fast64_t',
  1580. 'uint_fast8_t', 'uint_fast16_t', 'uint_fast32_t', 'uint_fast64_t',
  1581. 'intptr_t', and 'uintptr_t' types and to the minimum value of the
  1582. 'wchar_t', 'wint_t', and 'sig_atomic_t' types respectively. They
  1583. exist to make the standard header given numerical limits work
  1584. correctly. You should not use these macros directly; instead,
  1585. include the appropriate headers. Some of these macros may not be
  1586. defined on particular systems if GCC does not provide a 'stdint.h'
  1587. header on those systems.
  1588. '__INT8_C'
  1589. '__INT16_C'
  1590. '__INT32_C'
  1591. '__INT64_C'
  1592. '__UINT8_C'
  1593. '__UINT16_C'
  1594. '__UINT32_C'
  1595. '__UINT64_C'
  1596. '__INTMAX_C'
  1597. '__UINTMAX_C'
  1598. Defined to implementations of the standard 'stdint.h' macros with
  1599. the same names without the leading '__'. They exist the make the
  1600. implementation of that header work correctly. You should not use
  1601. these macros directly; instead, include the appropriate headers.
  1602. Some of these macros may not be defined on particular systems if
  1603. GCC does not provide a 'stdint.h' header on those systems.
  1604. '__SCHAR_WIDTH__'
  1605. '__SHRT_WIDTH__'
  1606. '__INT_WIDTH__'
  1607. '__LONG_WIDTH__'
  1608. '__LONG_LONG_WIDTH__'
  1609. '__PTRDIFF_WIDTH__'
  1610. '__SIG_ATOMIC_WIDTH__'
  1611. '__SIZE_WIDTH__'
  1612. '__WCHAR_WIDTH__'
  1613. '__WINT_WIDTH__'
  1614. '__INT_LEAST8_WIDTH__'
  1615. '__INT_LEAST16_WIDTH__'
  1616. '__INT_LEAST32_WIDTH__'
  1617. '__INT_LEAST64_WIDTH__'
  1618. '__INT_FAST8_WIDTH__'
  1619. '__INT_FAST16_WIDTH__'
  1620. '__INT_FAST32_WIDTH__'
  1621. '__INT_FAST64_WIDTH__'
  1622. '__INTPTR_WIDTH__'
  1623. '__INTMAX_WIDTH__'
  1624. Defined to the bit widths of the corresponding types. They exist
  1625. to make the implementations of 'limits.h' and 'stdint.h' behave
  1626. correctly. You should not use these macros directly; instead,
  1627. include the appropriate headers. Some of these macros may not be
  1628. defined on particular systems if GCC does not provide a 'stdint.h'
  1629. header on those systems.
  1630. '__SIZEOF_INT__'
  1631. '__SIZEOF_LONG__'
  1632. '__SIZEOF_LONG_LONG__'
  1633. '__SIZEOF_SHORT__'
  1634. '__SIZEOF_POINTER__'
  1635. '__SIZEOF_FLOAT__'
  1636. '__SIZEOF_DOUBLE__'
  1637. '__SIZEOF_LONG_DOUBLE__'
  1638. '__SIZEOF_SIZE_T__'
  1639. '__SIZEOF_WCHAR_T__'
  1640. '__SIZEOF_WINT_T__'
  1641. '__SIZEOF_PTRDIFF_T__'
  1642. Defined to the number of bytes of the C standard data types: 'int',
  1643. 'long', 'long long', 'short', 'void *', 'float', 'double', 'long
  1644. double', 'size_t', 'wchar_t', 'wint_t' and 'ptrdiff_t'.
  1645. '__BYTE_ORDER__'
  1646. '__ORDER_LITTLE_ENDIAN__'
  1647. '__ORDER_BIG_ENDIAN__'
  1648. '__ORDER_PDP_ENDIAN__'
  1649. '__BYTE_ORDER__' is defined to one of the values
  1650. '__ORDER_LITTLE_ENDIAN__', '__ORDER_BIG_ENDIAN__', or
  1651. '__ORDER_PDP_ENDIAN__' to reflect the layout of multi-byte and
  1652. multi-word quantities in memory. If '__BYTE_ORDER__' is equal to
  1653. '__ORDER_LITTLE_ENDIAN__' or '__ORDER_BIG_ENDIAN__', then
  1654. multi-byte and multi-word quantities are laid out identically: the
  1655. byte (word) at the lowest address is the least significant or most
  1656. significant byte (word) of the quantity, respectively. If
  1657. '__BYTE_ORDER__' is equal to '__ORDER_PDP_ENDIAN__', then bytes in
  1658. 16-bit words are laid out in a little-endian fashion, whereas the
  1659. 16-bit subwords of a 32-bit quantity are laid out in big-endian
  1660. fashion.
  1661. You should use these macros for testing like this:
  1662. /* Test for a little-endian machine */
  1663. #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
  1664. '__FLOAT_WORD_ORDER__'
  1665. '__FLOAT_WORD_ORDER__' is defined to one of the values
  1666. '__ORDER_LITTLE_ENDIAN__' or '__ORDER_BIG_ENDIAN__' to reflect the
  1667. layout of the words of multi-word floating-point quantities.
  1668. '__DEPRECATED'
  1669. This macro is defined, with value 1, when compiling a C++ source
  1670. file with warnings about deprecated constructs enabled. These
  1671. warnings are enabled by default, but can be disabled with
  1672. '-Wno-deprecated'.
  1673. '__EXCEPTIONS'
  1674. This macro is defined, with value 1, when compiling a C++ source
  1675. file with exceptions enabled. If '-fno-exceptions' is used when
  1676. compiling the file, then this macro is not defined.
  1677. '__GXX_RTTI'
  1678. This macro is defined, with value 1, when compiling a C++ source
  1679. file with runtime type identification enabled. If '-fno-rtti' is
  1680. used when compiling the file, then this macro is not defined.
  1681. '__USING_SJLJ_EXCEPTIONS__'
  1682. This macro is defined, with value 1, if the compiler uses the old
  1683. mechanism based on 'setjmp' and 'longjmp' for exception handling.
  1684. '__GXX_EXPERIMENTAL_CXX0X__'
  1685. This macro is defined when compiling a C++ source file with the
  1686. option '-std=c++0x' or '-std=gnu++0x'. It indicates that some
  1687. features likely to be included in C++0x are available. Note that
  1688. these features are experimental, and may change or be removed in
  1689. future versions of GCC.
  1690. '__GXX_WEAK__'
  1691. This macro is defined when compiling a C++ source file. It has the
  1692. value 1 if the compiler will use weak symbols, COMDAT sections, or
  1693. other similar techniques to collapse symbols with "vague linkage"
  1694. that are defined in multiple translation units. If the compiler
  1695. will not collapse such symbols, this macro is defined with value 0.
  1696. In general, user code should not need to make use of this macro;
  1697. the purpose of this macro is to ease implementation of the C++
  1698. runtime library provided with G++.
  1699. '__NEXT_RUNTIME__'
  1700. This macro is defined, with value 1, if (and only if) the NeXT
  1701. runtime (as in '-fnext-runtime') is in use for Objective-C. If the
  1702. GNU runtime is used, this macro is not defined, so that you can use
  1703. this macro to determine which runtime (NeXT or GNU) is being used.
  1704. '__LP64__'
  1705. '_LP64'
  1706. These macros are defined, with value 1, if (and only if) the
  1707. compilation is for a target where 'long int' and pointer both use
  1708. 64-bits and 'int' uses 32-bit.
  1709. '__SSP__'
  1710. This macro is defined, with value 1, when '-fstack-protector' is in
  1711. use.
  1712. '__SSP_ALL__'
  1713. This macro is defined, with value 2, when '-fstack-protector-all'
  1714. is in use.
  1715. '__SSP_STRONG__'
  1716. This macro is defined, with value 3, when
  1717. '-fstack-protector-strong' is in use.
  1718. '__SSP_EXPLICIT__'
  1719. This macro is defined, with value 4, when
  1720. '-fstack-protector-explicit' is in use.
  1721. '__SANITIZE_ADDRESS__'
  1722. This macro is defined, with value 1, when '-fsanitize=address' or
  1723. '-fsanitize=kernel-address' are in use.
  1724. '__SANITIZE_THREAD__'
  1725. This macro is defined, with value 1, when '-fsanitize=thread' is in
  1726. use.
  1727. '__TIMESTAMP__'
  1728. This macro expands to a string constant that describes the date and
  1729. time of the last modification of the current source file. The
  1730. string constant contains abbreviated day of the week, month, day of
  1731. the month, time in hh:mm:ss form, year and looks like
  1732. '"Sun Sep 16 01:03:52 1973"'. If the day of the month is less than
  1733. 10, it is padded with a space on the left.
  1734. If GCC cannot determine the current date, it will emit a warning
  1735. message (once per compilation) and '__TIMESTAMP__' will expand to
  1736. '"??? ??? ?? ??:??:?? ????"'.
  1737. '__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1'
  1738. '__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2'
  1739. '__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4'
  1740. '__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8'
  1741. '__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16'
  1742. These macros are defined when the target processor supports atomic
  1743. compare and swap operations on operands 1, 2, 4, 8 or 16 bytes in
  1744. length, respectively.
  1745. '__HAVE_SPECULATION_SAFE_VALUE'
  1746. This macro is defined with the value 1 to show that this version of
  1747. GCC supports '__builtin_speculation_safe_value'.
  1748. '__GCC_HAVE_DWARF2_CFI_ASM'
  1749. This macro is defined when the compiler is emitting DWARF CFI
  1750. directives to the assembler. When this is defined, it is possible
  1751. to emit those same directives in inline assembly.
  1752. '__FP_FAST_FMA'
  1753. '__FP_FAST_FMAF'
  1754. '__FP_FAST_FMAL'
  1755. These macros are defined with value 1 if the backend supports the
  1756. 'fma', 'fmaf', and 'fmal' builtin functions, so that the include
  1757. file 'math.h' can define the macros 'FP_FAST_FMA', 'FP_FAST_FMAF',
  1758. and 'FP_FAST_FMAL' for compatibility with the 1999 C standard.
  1759. '__FP_FAST_FMAF16'
  1760. '__FP_FAST_FMAF32'
  1761. '__FP_FAST_FMAF64'
  1762. '__FP_FAST_FMAF128'
  1763. '__FP_FAST_FMAF32X'
  1764. '__FP_FAST_FMAF64X'
  1765. '__FP_FAST_FMAF128X'
  1766. These macros are defined with the value 1 if the backend supports
  1767. the 'fma' functions using the additional '_FloatN' and '_FloatNx'
  1768. types that are defined in ISO/IEC TS 18661-3:2015. The include
  1769. file 'math.h' can define the 'FP_FAST_FMAFN' and 'FP_FAST_FMAFNx'
  1770. macros if the user defined '__STDC_WANT_IEC_60559_TYPES_EXT__'
  1771. before including 'math.h'.
  1772. '__GCC_IEC_559'
  1773. This macro is defined to indicate the intended level of support for
  1774. IEEE 754 (IEC 60559) floating-point arithmetic. It expands to a
  1775. nonnegative integer value. If 0, it indicates that the combination
  1776. of the compiler configuration and the command-line options is not
  1777. intended to support IEEE 754 arithmetic for 'float' and 'double' as
  1778. defined in C99 and C11 Annex F (for example, that the standard
  1779. rounding modes and exceptions are not supported, or that
  1780. optimizations are enabled that conflict with IEEE 754 semantics).
  1781. If 1, it indicates that IEEE 754 arithmetic is intended to be
  1782. supported; this does not mean that all relevant language features
  1783. are supported by GCC. If 2 or more, it additionally indicates
  1784. support for IEEE 754-2008 (in particular, that the binary encodings
  1785. for quiet and signaling NaNs are as specified in IEEE 754-2008).
  1786. This macro does not indicate the default state of command-line
  1787. options that control optimizations that C99 and C11 permit to be
  1788. controlled by standard pragmas, where those standards do not
  1789. require a particular default state. It does not indicate whether
  1790. optimizations respect signaling NaN semantics (the macro for that
  1791. is '__SUPPORT_SNAN__'). It does not indicate support for decimal
  1792. floating point or the IEEE 754 binary16 and binary128 types.
  1793. '__GCC_IEC_559_COMPLEX'
  1794. This macro is defined to indicate the intended level of support for
  1795. IEEE 754 (IEC 60559) floating-point arithmetic for complex numbers,
  1796. as defined in C99 and C11 Annex G. It expands to a nonnegative
  1797. integer value. If 0, it indicates that the combination of the
  1798. compiler configuration and the command-line options is not intended
  1799. to support Annex G requirements (for example, because
  1800. '-fcx-limited-range' was used). If 1 or more, it indicates that it
  1801. is intended to support those requirements; this does not mean that
  1802. all relevant language features are supported by GCC.
  1803. '__NO_MATH_ERRNO__'
  1804. This macro is defined if '-fno-math-errno' is used, or enabled by
  1805. another option such as '-ffast-math' or by default.
  1806. '__GNUC_EXECUTION_CHARSET_NAME'
  1807. '__GNUC_WIDE_EXECUTION_CHARSET_NAME'
  1808. These macros are defined to expand to a narrow string literal of
  1809. the name of the narrow and wide compile-time execution character
  1810. set used. It directly reflects the name passed to the options
  1811. '-fexec-charset' and '-fwide-exec-charset', or the defaults
  1812. documented for those options (that is, it can expand to something
  1813. like '"UTF-8"'). *Note Invocation::.
  1814. 
  1815. File: cpp.info, Node: System-specific Predefined Macros, Next: C++ Named Operators, Prev: Common Predefined Macros, Up: Predefined Macros
  1816. 3.7.3 System-specific Predefined Macros
  1817. ---------------------------------------
  1818. The C preprocessor normally predefines several macros that indicate what
  1819. type of system and machine is in use. They are obviously different on
  1820. each target supported by GCC. This manual, being for all systems and
  1821. machines, cannot tell you what their names are, but you can use 'cpp
  1822. -dM' to see them all. *Note Invocation::. All system-specific
  1823. predefined macros expand to a constant value, so you can test them with
  1824. either '#ifdef' or '#if'.
  1825. The C standard requires that all system-specific macros be part of
  1826. the "reserved namespace". All names which begin with two underscores,
  1827. or an underscore and a capital letter, are reserved for the compiler and
  1828. library to use as they wish. However, historically system-specific
  1829. macros have had names with no special prefix; for instance, it is common
  1830. to find 'unix' defined on Unix systems. For all such macros, GCC
  1831. provides a parallel macro with two underscores added at the beginning
  1832. and the end. If 'unix' is defined, '__unix__' will be defined too.
  1833. There will never be more than two underscores; the parallel of '_mips'
  1834. is '__mips__'.
  1835. When the '-ansi' option, or any '-std' option that requests strict
  1836. conformance, is given to the compiler, all the system-specific
  1837. predefined macros outside the reserved namespace are suppressed. The
  1838. parallel macros, inside the reserved namespace, remain defined.
  1839. We are slowly phasing out all predefined macros which are outside the
  1840. reserved namespace. You should never use them in new programs, and we
  1841. encourage you to correct older code to use the parallel macros whenever
  1842. you find it. We don't recommend you use the system-specific macros that
  1843. are in the reserved namespace, either. It is better in the long run to
  1844. check specifically for features you need, using a tool such as
  1845. 'autoconf'.
  1846. 
  1847. File: cpp.info, Node: C++ Named Operators, Prev: System-specific Predefined Macros, Up: Predefined Macros
  1848. 3.7.4 C++ Named Operators
  1849. -------------------------
  1850. In C++, there are eleven keywords which are simply alternate spellings
  1851. of operators normally written with punctuation. These keywords are
  1852. treated as such even in the preprocessor. They function as operators in
  1853. '#if', and they cannot be defined as macros or poisoned. In C, you can
  1854. request that those keywords take their C++ meaning by including
  1855. 'iso646.h'. That header defines each one as a normal object-like macro
  1856. expanding to the appropriate punctuator.
  1857. These are the named operators and their corresponding punctuators:
  1858. Named Operator Punctuator
  1859. 'and' '&&'
  1860. 'and_eq' '&='
  1861. 'bitand' '&'
  1862. 'bitor' '|'
  1863. 'compl' '~'
  1864. 'not' '!'
  1865. 'not_eq' '!='
  1866. 'or' '||'
  1867. 'or_eq' '|='
  1868. 'xor' '^'
  1869. 'xor_eq' '^='
  1870. 
  1871. File: cpp.info, Node: Undefining and Redefining Macros, Next: Directives Within Macro Arguments, Prev: Predefined Macros, Up: Macros
  1872. 3.8 Undefining and Redefining Macros
  1873. ====================================
  1874. If a macro ceases to be useful, it may be "undefined" with the '#undef'
  1875. directive. '#undef' takes a single argument, the name of the macro to
  1876. undefine. You use the bare macro name, even if the macro is
  1877. function-like. It is an error if anything appears on the line after the
  1878. macro name. '#undef' has no effect if the name is not a macro.
  1879. #define FOO 4
  1880. x = FOO; ==> x = 4;
  1881. #undef FOO
  1882. x = FOO; ==> x = FOO;
  1883. Once a macro has been undefined, that identifier may be "redefined"
  1884. as a macro by a subsequent '#define' directive. The new definition need
  1885. not have any resemblance to the old definition.
  1886. However, if an identifier which is currently a macro is redefined,
  1887. then the new definition must be "effectively the same" as the old one.
  1888. Two macro definitions are effectively the same if:
  1889. * Both are the same type of macro (object- or function-like).
  1890. * All the tokens of the replacement list are the same.
  1891. * If there are any parameters, they are the same.
  1892. * Whitespace appears in the same places in both. It need not be
  1893. exactly the same amount of whitespace, though. Remember that
  1894. comments count as whitespace.
  1895. These definitions are effectively the same:
  1896. #define FOUR (2 + 2)
  1897. #define FOUR (2 + 2)
  1898. #define FOUR (2 /* two */ + 2)
  1899. but these are not:
  1900. #define FOUR (2 + 2)
  1901. #define FOUR ( 2+2 )
  1902. #define FOUR (2 * 2)
  1903. #define FOUR(score,and,seven,years,ago) (2 + 2)
  1904. If a macro is redefined with a definition that is not effectively the
  1905. same as the old one, the preprocessor issues a warning and changes the
  1906. macro to use the new definition. If the new definition is effectively
  1907. the same, the redefinition is silently ignored. This allows, for
  1908. instance, two different headers to define a common macro. The
  1909. preprocessor will only complain if the definitions do not match.
  1910. 
  1911. File: cpp.info, Node: Directives Within Macro Arguments, Next: Macro Pitfalls, Prev: Undefining and Redefining Macros, Up: Macros
  1912. 3.9 Directives Within Macro Arguments
  1913. =====================================
  1914. Occasionally it is convenient to use preprocessor directives within the
  1915. arguments of a macro. The C and C++ standards declare that behavior in
  1916. these cases is undefined. GNU CPP processes arbitrary directives within
  1917. macro arguments in exactly the same way as it would have processed the
  1918. directive were the function-like macro invocation not present.
  1919. If, within a macro invocation, that macro is redefined, then the new
  1920. definition takes effect in time for argument pre-expansion, but the
  1921. original definition is still used for argument replacement. Here is a
  1922. pathological example:
  1923. #define f(x) x x
  1924. f (1
  1925. #undef f
  1926. #define f 2
  1927. f)
  1928. which expands to
  1929. 1 2 1 2
  1930. with the semantics described above.
  1931. 
  1932. File: cpp.info, Node: Macro Pitfalls, Prev: Directives Within Macro Arguments, Up: Macros
  1933. 3.10 Macro Pitfalls
  1934. ===================
  1935. In this section we describe some special rules that apply to macros and
  1936. macro expansion, and point out certain cases in which the rules have
  1937. counter-intuitive consequences that you must watch out for.
  1938. * Menu:
  1939. * Misnesting::
  1940. * Operator Precedence Problems::
  1941. * Swallowing the Semicolon::
  1942. * Duplication of Side Effects::
  1943. * Self-Referential Macros::
  1944. * Argument Prescan::
  1945. * Newlines in Arguments::
  1946. 
  1947. File: cpp.info, Node: Misnesting, Next: Operator Precedence Problems, Up: Macro Pitfalls
  1948. 3.10.1 Misnesting
  1949. -----------------
  1950. When a macro is called with arguments, the arguments are substituted
  1951. into the macro body and the result is checked, together with the rest of
  1952. the input file, for more macro calls. It is possible to piece together
  1953. a macro call coming partially from the macro body and partially from the
  1954. arguments. For example,
  1955. #define twice(x) (2*(x))
  1956. #define call_with_1(x) x(1)
  1957. call_with_1 (twice)
  1958. ==> twice(1)
  1959. ==> (2*(1))
  1960. Macro definitions do not have to have balanced parentheses. By
  1961. writing an unbalanced open parenthesis in a macro body, it is possible
  1962. to create a macro call that begins inside the macro body but ends
  1963. outside of it. For example,
  1964. #define strange(file) fprintf (file, "%s %d",
  1965. ...
  1966. strange(stderr) p, 35)
  1967. ==> fprintf (stderr, "%s %d", p, 35)
  1968. The ability to piece together a macro call can be useful, but the use
  1969. of unbalanced open parentheses in a macro body is just confusing, and
  1970. should be avoided.
  1971. 
  1972. File: cpp.info, Node: Operator Precedence Problems, Next: Swallowing the Semicolon, Prev: Misnesting, Up: Macro Pitfalls
  1973. 3.10.2 Operator Precedence Problems
  1974. -----------------------------------
  1975. You may have noticed that in most of the macro definition examples shown
  1976. above, each occurrence of a macro argument name had parentheses around
  1977. it. In addition, another pair of parentheses usually surround the
  1978. entire macro definition. Here is why it is best to write macros that
  1979. way.
  1980. Suppose you define a macro as follows,
  1981. #define ceil_div(x, y) (x + y - 1) / y
  1982. whose purpose is to divide, rounding up. (One use for this operation is
  1983. to compute how many 'int' objects are needed to hold a certain number of
  1984. 'char' objects.) Then suppose it is used as follows:
  1985. a = ceil_div (b & c, sizeof (int));
  1986. ==> a = (b & c + sizeof (int) - 1) / sizeof (int);
  1987. This does not do what is intended. The operator-precedence rules of C
  1988. make it equivalent to this:
  1989. a = (b & (c + sizeof (int) - 1)) / sizeof (int);
  1990. What we want is this:
  1991. a = ((b & c) + sizeof (int) - 1)) / sizeof (int);
  1992. Defining the macro as
  1993. #define ceil_div(x, y) ((x) + (y) - 1) / (y)
  1994. provides the desired result.
  1995. Unintended grouping can result in another way. Consider 'sizeof
  1996. ceil_div(1, 2)'. That has the appearance of a C expression that would
  1997. compute the size of the type of 'ceil_div (1, 2)', but in fact it means
  1998. something very different. Here is what it expands to:
  1999. sizeof ((1) + (2) - 1) / (2)
  2000. This would take the size of an integer and divide it by two. The
  2001. precedence rules have put the division outside the 'sizeof' when it was
  2002. intended to be inside.
  2003. Parentheses around the entire macro definition prevent such problems.
  2004. Here, then, is the recommended way to define 'ceil_div':
  2005. #define ceil_div(x, y) (((x) + (y) - 1) / (y))
  2006. 
  2007. File: cpp.info, Node: Swallowing the Semicolon, Next: Duplication of Side Effects, Prev: Operator Precedence Problems, Up: Macro Pitfalls
  2008. 3.10.3 Swallowing the Semicolon
  2009. -------------------------------
  2010. Often it is desirable to define a macro that expands into a compound
  2011. statement. Consider, for example, the following macro, that advances a
  2012. pointer (the argument 'p' says where to find it) across whitespace
  2013. characters:
  2014. #define SKIP_SPACES(p, limit) \
  2015. { char *lim = (limit); \
  2016. while (p < lim) { \
  2017. if (*p++ != ' ') { \
  2018. p--; break; }}}
  2019. Here backslash-newline is used to split the macro definition, which must
  2020. be a single logical line, so that it resembles the way such code would
  2021. be laid out if not part of a macro definition.
  2022. A call to this macro might be 'SKIP_SPACES (p, lim)'. Strictly
  2023. speaking, the call expands to a compound statement, which is a complete
  2024. statement with no need for a semicolon to end it. However, since it
  2025. looks like a function call, it minimizes confusion if you can use it
  2026. like a function call, writing a semicolon afterward, as in 'SKIP_SPACES
  2027. (p, lim);'
  2028. This can cause trouble before 'else' statements, because the
  2029. semicolon is actually a null statement. Suppose you write
  2030. if (*p != 0)
  2031. SKIP_SPACES (p, lim);
  2032. else ...
  2033. The presence of two statements--the compound statement and a null
  2034. statement--in between the 'if' condition and the 'else' makes invalid C
  2035. code.
  2036. The definition of the macro 'SKIP_SPACES' can be altered to solve
  2037. this problem, using a 'do ... while' statement. Here is how:
  2038. #define SKIP_SPACES(p, limit) \
  2039. do { char *lim = (limit); \
  2040. while (p < lim) { \
  2041. if (*p++ != ' ') { \
  2042. p--; break; }}} \
  2043. while (0)
  2044. Now 'SKIP_SPACES (p, lim);' expands into
  2045. do {...} while (0);
  2046. which is one statement. The loop executes exactly once; most compilers
  2047. generate no extra code for it.
  2048. 
  2049. File: cpp.info, Node: Duplication of Side Effects, Next: Self-Referential Macros, Prev: Swallowing the Semicolon, Up: Macro Pitfalls
  2050. 3.10.4 Duplication of Side Effects
  2051. ----------------------------------
  2052. Many C programs define a macro 'min', for "minimum", like this:
  2053. #define min(X, Y) ((X) < (Y) ? (X) : (Y))
  2054. When you use this macro with an argument containing a side effect, as
  2055. shown here,
  2056. next = min (x + y, foo (z));
  2057. it expands as follows:
  2058. next = ((x + y) < (foo (z)) ? (x + y) : (foo (z)));
  2059. where 'x + y' has been substituted for 'X' and 'foo (z)' for 'Y'.
  2060. The function 'foo' is used only once in the statement as it appears
  2061. in the program, but the expression 'foo (z)' has been substituted twice
  2062. into the macro expansion. As a result, 'foo' might be called two times
  2063. when the statement is executed. If it has side effects or if it takes a
  2064. long time to compute, the results might not be what you intended. We
  2065. say that 'min' is an "unsafe" macro.
  2066. The best solution to this problem is to define 'min' in a way that
  2067. computes the value of 'foo (z)' only once. The C language offers no
  2068. standard way to do this, but it can be done with GNU extensions as
  2069. follows:
  2070. #define min(X, Y) \
  2071. ({ typeof (X) x_ = (X); \
  2072. typeof (Y) y_ = (Y); \
  2073. (x_ < y_) ? x_ : y_; })
  2074. The '({ ... })' notation produces a compound statement that acts as
  2075. an expression. Its value is the value of its last statement. This
  2076. permits us to define local variables and assign each argument to one.
  2077. The local variables have underscores after their names to reduce the
  2078. risk of conflict with an identifier of wider scope (it is impossible to
  2079. avoid this entirely). Now each argument is evaluated exactly once.
  2080. If you do not wish to use GNU C extensions, the only solution is to
  2081. be careful when _using_ the macro 'min'. For example, you can calculate
  2082. the value of 'foo (z)', save it in a variable, and use that variable in
  2083. 'min':
  2084. #define min(X, Y) ((X) < (Y) ? (X) : (Y))
  2085. ...
  2086. {
  2087. int tem = foo (z);
  2088. next = min (x + y, tem);
  2089. }
  2090. (where we assume that 'foo' returns type 'int').
  2091. 
  2092. File: cpp.info, Node: Self-Referential Macros, Next: Argument Prescan, Prev: Duplication of Side Effects, Up: Macro Pitfalls
  2093. 3.10.5 Self-Referential Macros
  2094. ------------------------------
  2095. A "self-referential" macro is one whose name appears in its definition.
  2096. Recall that all macro definitions are rescanned for more macros to
  2097. replace. If the self-reference were considered a use of the macro, it
  2098. would produce an infinitely large expansion. To prevent this, the
  2099. self-reference is not considered a macro call. It is passed into the
  2100. preprocessor output unchanged. Consider an example:
  2101. #define foo (4 + foo)
  2102. where 'foo' is also a variable in your program.
  2103. Following the ordinary rules, each reference to 'foo' will expand
  2104. into '(4 + foo)'; then this will be rescanned and will expand into '(4 +
  2105. (4 + foo))'; and so on until the computer runs out of memory.
  2106. The self-reference rule cuts this process short after one step, at
  2107. '(4 + foo)'. Therefore, this macro definition has the possibly useful
  2108. effect of causing the program to add 4 to the value of 'foo' wherever
  2109. 'foo' is referred to.
  2110. In most cases, it is a bad idea to take advantage of this feature. A
  2111. person reading the program who sees that 'foo' is a variable will not
  2112. expect that it is a macro as well. The reader will come across the
  2113. identifier 'foo' in the program and think its value should be that of
  2114. the variable 'foo', whereas in fact the value is four greater.
  2115. One common, useful use of self-reference is to create a macro which
  2116. expands to itself. If you write
  2117. #define EPERM EPERM
  2118. then the macro 'EPERM' expands to 'EPERM'. Effectively, it is left
  2119. alone by the preprocessor whenever it's used in running text. You can
  2120. tell that it's a macro with '#ifdef'. You might do this if you want to
  2121. define numeric constants with an 'enum', but have '#ifdef' be true for
  2122. each constant.
  2123. If a macro 'x' expands to use a macro 'y', and the expansion of 'y'
  2124. refers to the macro 'x', that is an "indirect self-reference" of 'x'.
  2125. 'x' is not expanded in this case either. Thus, if we have
  2126. #define x (4 + y)
  2127. #define y (2 * x)
  2128. then 'x' and 'y' expand as follows:
  2129. x ==> (4 + y)
  2130. ==> (4 + (2 * x))
  2131. y ==> (2 * x)
  2132. ==> (2 * (4 + y))
  2133. Each macro is expanded when it appears in the definition of the other
  2134. macro, but not when it indirectly appears in its own definition.
  2135. 
  2136. File: cpp.info, Node: Argument Prescan, Next: Newlines in Arguments, Prev: Self-Referential Macros, Up: Macro Pitfalls
  2137. 3.10.6 Argument Prescan
  2138. -----------------------
  2139. Macro arguments are completely macro-expanded before they are
  2140. substituted into a macro body, unless they are stringized or pasted with
  2141. other tokens. After substitution, the entire macro body, including the
  2142. substituted arguments, is scanned again for macros to be expanded. The
  2143. result is that the arguments are scanned _twice_ to expand macro calls
  2144. in them.
  2145. Most of the time, this has no effect. If the argument contained any
  2146. macro calls, they are expanded during the first scan. The result
  2147. therefore contains no macro calls, so the second scan does not change
  2148. it. If the argument were substituted as given, with no prescan, the
  2149. single remaining scan would find the same macro calls and produce the
  2150. same results.
  2151. You might expect the double scan to change the results when a
  2152. self-referential macro is used in an argument of another macro (*note
  2153. Self-Referential Macros::): the self-referential macro would be expanded
  2154. once in the first scan, and a second time in the second scan. However,
  2155. this is not what happens. The self-references that do not expand in the
  2156. first scan are marked so that they will not expand in the second scan
  2157. either.
  2158. You might wonder, "Why mention the prescan, if it makes no
  2159. difference? And why not skip it and make the preprocessor faster?" The
  2160. answer is that the prescan does make a difference in three special
  2161. cases:
  2162. * Nested calls to a macro.
  2163. We say that "nested" calls to a macro occur when a macro's argument
  2164. contains a call to that very macro. For example, if 'f' is a macro
  2165. that expects one argument, 'f (f (1))' is a nested pair of calls to
  2166. 'f'. The desired expansion is made by expanding 'f (1)' and
  2167. substituting that into the definition of 'f'. The prescan causes
  2168. the expected result to happen. Without the prescan, 'f (1)' itself
  2169. would be substituted as an argument, and the inner use of 'f' would
  2170. appear during the main scan as an indirect self-reference and would
  2171. not be expanded.
  2172. * Macros that call other macros that stringize or concatenate.
  2173. If an argument is stringized or concatenated, the prescan does not
  2174. occur. If you _want_ to expand a macro, then stringize or
  2175. concatenate its expansion, you can do that by causing one macro to
  2176. call another macro that does the stringizing or concatenation. For
  2177. instance, if you have
  2178. #define AFTERX(x) X_ ## x
  2179. #define XAFTERX(x) AFTERX(x)
  2180. #define TABLESIZE 1024
  2181. #define BUFSIZE TABLESIZE
  2182. then 'AFTERX(BUFSIZE)' expands to 'X_BUFSIZE', and
  2183. 'XAFTERX(BUFSIZE)' expands to 'X_1024'. (Not to 'X_TABLESIZE'.
  2184. Prescan always does a complete expansion.)
  2185. * Macros used in arguments, whose expansions contain unshielded
  2186. commas.
  2187. This can cause a macro expanded on the second scan to be called
  2188. with the wrong number of arguments. Here is an example:
  2189. #define foo a,b
  2190. #define bar(x) lose(x)
  2191. #define lose(x) (1 + (x))
  2192. We would like 'bar(foo)' to turn into '(1 + (foo))', which would
  2193. then turn into '(1 + (a,b))'. Instead, 'bar(foo)' expands into
  2194. 'lose(a,b)', and you get an error because 'lose' requires a single
  2195. argument. In this case, the problem is easily solved by the same
  2196. parentheses that ought to be used to prevent misnesting of
  2197. arithmetic operations:
  2198. #define foo (a,b)
  2199. or
  2200. #define bar(x) lose((x))
  2201. The extra pair of parentheses prevents the comma in 'foo''s
  2202. definition from being interpreted as an argument separator.
  2203. 
  2204. File: cpp.info, Node: Newlines in Arguments, Prev: Argument Prescan, Up: Macro Pitfalls
  2205. 3.10.7 Newlines in Arguments
  2206. ----------------------------
  2207. The invocation of a function-like macro can extend over many logical
  2208. lines. However, in the present implementation, the entire expansion
  2209. comes out on one line. Thus line numbers emitted by the compiler or
  2210. debugger refer to the line the invocation started on, which might be
  2211. different to the line containing the argument causing the problem.
  2212. Here is an example illustrating this:
  2213. #define ignore_second_arg(a,b,c) a; c
  2214. ignore_second_arg (foo (),
  2215. ignored (),
  2216. syntax error);
  2217. The syntax error triggered by the tokens 'syntax error' results in an
  2218. error message citing line three--the line of ignore_second_arg-- even
  2219. though the problematic code comes from line five.
  2220. We consider this a bug, and intend to fix it in the near future.
  2221. 
  2222. File: cpp.info, Node: Conditionals, Next: Diagnostics, Prev: Macros, Up: Top
  2223. 4 Conditionals
  2224. **************
  2225. A "conditional" is a directive that instructs the preprocessor to select
  2226. whether or not to include a chunk of code in the final token stream
  2227. passed to the compiler. Preprocessor conditionals can test arithmetic
  2228. expressions, or whether a name is defined as a macro, or both
  2229. simultaneously using the special 'defined' operator.
  2230. A conditional in the C preprocessor resembles in some ways an 'if'
  2231. statement in C, but it is important to understand the difference between
  2232. them. The condition in an 'if' statement is tested during the execution
  2233. of your program. Its purpose is to allow your program to behave
  2234. differently from run to run, depending on the data it is operating on.
  2235. The condition in a preprocessing conditional directive is tested when
  2236. your program is compiled. Its purpose is to allow different code to be
  2237. included in the program depending on the situation at the time of
  2238. compilation.
  2239. However, the distinction is becoming less clear. Modern compilers
  2240. often do test 'if' statements when a program is compiled, if their
  2241. conditions are known not to vary at run time, and eliminate code which
  2242. can never be executed. If you can count on your compiler to do this,
  2243. you may find that your program is more readable if you use 'if'
  2244. statements with constant conditions (perhaps determined by macros). Of
  2245. course, you can only use this to exclude code, not type definitions or
  2246. other preprocessing directives, and you can only do it if the code
  2247. remains syntactically valid when it is not to be used.
  2248. * Menu:
  2249. * Conditional Uses::
  2250. * Conditional Syntax::
  2251. * Deleted Code::
  2252. 
  2253. File: cpp.info, Node: Conditional Uses, Next: Conditional Syntax, Up: Conditionals
  2254. 4.1 Conditional Uses
  2255. ====================
  2256. There are three general reasons to use a conditional.
  2257. * A program may need to use different code depending on the machine
  2258. or operating system it is to run on. In some cases the code for
  2259. one operating system may be erroneous on another operating system;
  2260. for example, it might refer to data types or constants that do not
  2261. exist on the other system. When this happens, it is not enough to
  2262. avoid executing the invalid code. Its mere presence will cause the
  2263. compiler to reject the program. With a preprocessing conditional,
  2264. the offending code can be effectively excised from the program when
  2265. it is not valid.
  2266. * You may want to be able to compile the same source file into two
  2267. different programs. One version might make frequent time-consuming
  2268. consistency checks on its intermediate data, or print the values of
  2269. those data for debugging, and the other not.
  2270. * A conditional whose condition is always false is one way to exclude
  2271. code from the program but keep it as a sort of comment for future
  2272. reference.
  2273. Simple programs that do not need system-specific logic or complex
  2274. debugging hooks generally will not need to use preprocessing
  2275. conditionals.
  2276. 
  2277. File: cpp.info, Node: Conditional Syntax, Next: Deleted Code, Prev: Conditional Uses, Up: Conditionals
  2278. 4.2 Conditional Syntax
  2279. ======================
  2280. A conditional in the C preprocessor begins with a "conditional
  2281. directive": '#if', '#ifdef' or '#ifndef'.
  2282. * Menu:
  2283. * Ifdef::
  2284. * If::
  2285. * Defined::
  2286. * Else::
  2287. * Elif::
  2288. * __has_attribute::
  2289. * __has_cpp_attribute::
  2290. * __has_c_attribute::
  2291. * __has_builtin::
  2292. * __has_include::
  2293. 
  2294. File: cpp.info, Node: Ifdef, Next: If, Up: Conditional Syntax
  2295. 4.2.1 Ifdef
  2296. -----------
  2297. The simplest sort of conditional is
  2298. #ifdef MACRO
  2299. CONTROLLED TEXT
  2300. #endif /* MACRO */
  2301. This block is called a "conditional group". CONTROLLED TEXT will be
  2302. included in the output of the preprocessor if and only if MACRO is
  2303. defined. We say that the conditional "succeeds" if MACRO is defined,
  2304. "fails" if it is not.
  2305. The CONTROLLED TEXT inside of a conditional can include preprocessing
  2306. directives. They are executed only if the conditional succeeds. You
  2307. can nest conditional groups inside other conditional groups, but they
  2308. must be completely nested. In other words, '#endif' always matches the
  2309. nearest '#ifdef' (or '#ifndef', or '#if'). Also, you cannot start a
  2310. conditional group in one file and end it in another.
  2311. Even if a conditional fails, the CONTROLLED TEXT inside it is still
  2312. run through initial transformations and tokenization. Therefore, it
  2313. must all be lexically valid C. Normally the only way this matters is
  2314. that all comments and string literals inside a failing conditional group
  2315. must still be properly ended.
  2316. The comment following the '#endif' is not required, but it is a good
  2317. practice if there is a lot of CONTROLLED TEXT, because it helps people
  2318. match the '#endif' to the corresponding '#ifdef'. Older programs
  2319. sometimes put MACRO directly after the '#endif' without enclosing it in
  2320. a comment. This is invalid code according to the C standard. CPP
  2321. accepts it with a warning. It never affects which '#ifndef' the
  2322. '#endif' matches.
  2323. Sometimes you wish to use some code if a macro is _not_ defined. You
  2324. can do this by writing '#ifndef' instead of '#ifdef'. One common use of
  2325. '#ifndef' is to include code only the first time a header file is
  2326. included. *Note Once-Only Headers::.
  2327. Macro definitions can vary between compilations for several reasons.
  2328. Here are some samples.
  2329. * Some macros are predefined on each kind of machine (*note
  2330. System-specific Predefined Macros::). This allows you to provide
  2331. code specially tuned for a particular machine.
  2332. * System header files define more macros, associated with the
  2333. features they implement. You can test these macros with
  2334. conditionals to avoid using a system feature on a machine where it
  2335. is not implemented.
  2336. * Macros can be defined or undefined with the '-D' and '-U'
  2337. command-line options when you compile the program. You can arrange
  2338. to compile the same source file into two different programs by
  2339. choosing a macro name to specify which program you want, writing
  2340. conditionals to test whether or how this macro is defined, and then
  2341. controlling the state of the macro with command-line options,
  2342. perhaps set in the Makefile. *Note Invocation::.
  2343. * Your program might have a special header file (often called
  2344. 'config.h') that is adjusted when the program is compiled. It can
  2345. define or not define macros depending on the features of the system
  2346. and the desired capabilities of the program. The adjustment can be
  2347. automated by a tool such as 'autoconf', or done by hand.
  2348. 
  2349. File: cpp.info, Node: If, Next: Defined, Prev: Ifdef, Up: Conditional Syntax
  2350. 4.2.2 If
  2351. --------
  2352. The '#if' directive allows you to test the value of an arithmetic
  2353. expression, rather than the mere existence of one macro. Its syntax is
  2354. #if EXPRESSION
  2355. CONTROLLED TEXT
  2356. #endif /* EXPRESSION */
  2357. EXPRESSION is a C expression of integer type, subject to stringent
  2358. restrictions. It may contain
  2359. * Integer constants.
  2360. * Character constants, which are interpreted as they would be in
  2361. normal code.
  2362. * Arithmetic operators for addition, subtraction, multiplication,
  2363. division, bitwise operations, shifts, comparisons, and logical
  2364. operations ('&&' and '||'). The latter two obey the usual
  2365. short-circuiting rules of standard C.
  2366. * Macros. All macros in the expression are expanded before actual
  2367. computation of the expression's value begins.
  2368. * Uses of the 'defined' operator, which lets you check whether macros
  2369. are defined in the middle of an '#if'.
  2370. * Identifiers that are not macros, which are all considered to be the
  2371. number zero. This allows you to write '#if MACRO' instead of
  2372. '#ifdef MACRO', if you know that MACRO, when defined, will always
  2373. have a nonzero value. Function-like macros used without their
  2374. function call parentheses are also treated as zero.
  2375. In some contexts this shortcut is undesirable. The '-Wundef'
  2376. option causes GCC to warn whenever it encounters an identifier
  2377. which is not a macro in an '#if'.
  2378. The preprocessor does not know anything about types in the language.
  2379. Therefore, 'sizeof' operators are not recognized in '#if', and neither
  2380. are 'enum' constants. They will be taken as identifiers which are not
  2381. macros, and replaced by zero. In the case of 'sizeof', this is likely
  2382. to cause the expression to be invalid.
  2383. The preprocessor calculates the value of EXPRESSION. It carries out
  2384. all calculations in the widest integer type known to the compiler; on
  2385. most machines supported by GCC this is 64 bits. This is not the same
  2386. rule as the compiler uses to calculate the value of a constant
  2387. expression, and may give different results in some cases. If the value
  2388. comes out to be nonzero, the '#if' succeeds and the CONTROLLED TEXT is
  2389. included; otherwise it is skipped.
  2390. 
  2391. File: cpp.info, Node: Defined, Next: Else, Prev: If, Up: Conditional Syntax
  2392. 4.2.3 Defined
  2393. -------------
  2394. The special operator 'defined' is used in '#if' and '#elif' expressions
  2395. to test whether a certain name is defined as a macro. 'defined NAME'
  2396. and 'defined (NAME)' are both expressions whose value is 1 if NAME is
  2397. defined as a macro at the current point in the program, and 0 otherwise.
  2398. Thus, '#if defined MACRO' is precisely equivalent to '#ifdef MACRO'.
  2399. 'defined' is useful when you wish to test more than one macro for
  2400. existence at once. For example,
  2401. #if defined (__vax__) || defined (__ns16000__)
  2402. would succeed if either of the names '__vax__' or '__ns16000__' is
  2403. defined as a macro.
  2404. Conditionals written like this:
  2405. #if defined BUFSIZE && BUFSIZE >= 1024
  2406. can generally be simplified to just '#if BUFSIZE >= 1024', since if
  2407. 'BUFSIZE' is not defined, it will be interpreted as having the value
  2408. zero.
  2409. If the 'defined' operator appears as a result of a macro expansion,
  2410. the C standard says the behavior is undefined. GNU cpp treats it as a
  2411. genuine 'defined' operator and evaluates it normally. It will warn
  2412. wherever your code uses this feature if you use the command-line option
  2413. '-Wpedantic', since other compilers may handle it differently. The
  2414. warning is also enabled by '-Wextra', and can also be enabled
  2415. individually with '-Wexpansion-to-defined'.
  2416. 
  2417. File: cpp.info, Node: Else, Next: Elif, Prev: Defined, Up: Conditional Syntax
  2418. 4.2.4 Else
  2419. ----------
  2420. The '#else' directive can be added to a conditional to provide
  2421. alternative text to be used if the condition fails. This is what it
  2422. looks like:
  2423. #if EXPRESSION
  2424. TEXT-IF-TRUE
  2425. #else /* Not EXPRESSION */
  2426. TEXT-IF-FALSE
  2427. #endif /* Not EXPRESSION */
  2428. If EXPRESSION is nonzero, the TEXT-IF-TRUE is included and the
  2429. TEXT-IF-FALSE is skipped. If EXPRESSION is zero, the opposite happens.
  2430. You can use '#else' with '#ifdef' and '#ifndef', too.
  2431. 
  2432. File: cpp.info, Node: Elif, Next: __has_attribute, Prev: Else, Up: Conditional Syntax
  2433. 4.2.5 Elif
  2434. ----------
  2435. One common case of nested conditionals is used to check for more than
  2436. two possible alternatives. For example, you might have
  2437. #if X == 1
  2438. ...
  2439. #else /* X != 1 */
  2440. #if X == 2
  2441. ...
  2442. #else /* X != 2 */
  2443. ...
  2444. #endif /* X != 2 */
  2445. #endif /* X != 1 */
  2446. Another conditional directive, '#elif', allows this to be abbreviated
  2447. as follows:
  2448. #if X == 1
  2449. ...
  2450. #elif X == 2
  2451. ...
  2452. #else /* X != 2 and X != 1*/
  2453. ...
  2454. #endif /* X != 2 and X != 1*/
  2455. '#elif' stands for "else if". Like '#else', it goes in the middle of
  2456. a conditional group and subdivides it; it does not require a matching
  2457. '#endif' of its own. Like '#if', the '#elif' directive includes an
  2458. expression to be tested. The text following the '#elif' is processed
  2459. only if the original '#if'-condition failed and the '#elif' condition
  2460. succeeds.
  2461. More than one '#elif' can go in the same conditional group. Then the
  2462. text after each '#elif' is processed only if the '#elif' condition
  2463. succeeds after the original '#if' and all previous '#elif' directives
  2464. within it have failed.
  2465. '#else' is allowed after any number of '#elif' directives, but
  2466. '#elif' may not follow '#else'.
  2467. 
  2468. File: cpp.info, Node: __has_attribute, Next: __has_cpp_attribute, Prev: Elif, Up: Conditional Syntax
  2469. 4.2.6 '__has_attribute'
  2470. -----------------------
  2471. The special operator '__has_attribute (OPERAND)' may be used in '#if'
  2472. and '#elif' expressions to test whether the attribute referenced by its
  2473. OPERAND is recognized by GCC. Using the operator in other contexts is
  2474. not valid. In C code, if compiling for strict conformance to standards
  2475. before C2x, OPERAND must be a valid identifier. Otherwise, OPERAND may
  2476. be optionally introduced by the 'ATTRIBUTE-SCOPE::' prefix. The
  2477. ATTRIBUTE-SCOPE prefix identifies the "namespace" within which the
  2478. attribute is recognized. The scope of GCC attributes is 'gnu' or
  2479. '__gnu__'. The '__has_attribute' operator by itself, without any
  2480. OPERAND or parentheses, acts as a predefined macro so that support for
  2481. it can be tested in portable code. Thus, the recommended use of the
  2482. operator is as follows:
  2483. #if defined __has_attribute
  2484. # if __has_attribute (nonnull)
  2485. # define ATTR_NONNULL __attribute__ ((nonnull))
  2486. # endif
  2487. #endif
  2488. The first '#if' test succeeds only when the operator is supported by
  2489. the version of GCC (or another compiler) being used. Only when that
  2490. test succeeds is it valid to use '__has_attribute' as a preprocessor
  2491. operator. As a result, combining the two tests into a single expression
  2492. as shown below would only be valid with a compiler that supports the
  2493. operator but not with others that don't.
  2494. #if defined __has_attribute && __has_attribute (nonnull) /* not portable */
  2495. ...
  2496. #endif
  2497. 
  2498. File: cpp.info, Node: __has_cpp_attribute, Next: __has_c_attribute, Prev: __has_attribute, Up: Conditional Syntax
  2499. 4.2.7 '__has_cpp_attribute'
  2500. ---------------------------
  2501. The special operator '__has_cpp_attribute (OPERAND)' may be used in
  2502. '#if' and '#elif' expressions in C++ code to test whether the attribute
  2503. referenced by its OPERAND is recognized by GCC. '__has_cpp_attribute
  2504. (OPERAND)' is equivalent to '__has_attribute (OPERAND)' except that when
  2505. OPERAND designates a supported standard attribute it evaluates to an
  2506. integer constant of the form 'YYYYMM' indicating the year and month when
  2507. the attribute was first introduced into the C++ standard. For
  2508. additional information including the dates of the introduction of
  2509. current standard attributes, see
  2510. SD-6: SG10 Feature Test Recommendations (https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations/).
  2511. 
  2512. File: cpp.info, Node: __has_c_attribute, Next: __has_builtin, Prev: __has_cpp_attribute, Up: Conditional Syntax
  2513. 4.2.8 '__has_c_attribute'
  2514. -------------------------
  2515. The special operator '__has_c_attribute (OPERAND)' may be used in '#if'
  2516. and '#elif' expressions in C code to test whether the attribute
  2517. referenced by its OPERAND is recognized by GCC in attributes using the
  2518. '[[]]' syntax. GNU attributes must be specified with the scope 'gnu' or
  2519. '__gnu__' with '__has_c_attribute'. When OPERAND designates a supported
  2520. standard attribute it evaluates to an integer constant of the form
  2521. 'YYYYMM' indicating the year and month when the attribute was first
  2522. introduced into the C standard, or when the syntax of operands to the
  2523. attribute was extended in the C standard.
  2524. 
  2525. File: cpp.info, Node: __has_builtin, Next: __has_include, Prev: __has_c_attribute, Up: Conditional Syntax
  2526. 4.2.9 '__has_builtin'
  2527. ---------------------
  2528. The special operator '__has_builtin (OPERAND)' may be used in constant
  2529. integer contexts and in preprocessor '#if' and '#elif' expressions to
  2530. test whether the symbol named by its OPERAND is recognized as a built-in
  2531. function by GCC in the current language and conformance mode. It
  2532. evaluates to a constant integer with a nonzero value if the argument
  2533. refers to such a function, and to zero otherwise. The operator may also
  2534. be used in preprocessor '#if' and '#elif' expressions. The
  2535. '__has_builtin' operator by itself, without any OPERAND or parentheses,
  2536. acts as a predefined macro so that support for it can be tested in
  2537. portable code. Thus, the recommended use of the operator is as follows:
  2538. #if defined __has_builtin
  2539. # if __has_builtin (__builtin_object_size)
  2540. # define builtin_object_size(ptr) __builtin_object_size (ptr, 2)
  2541. # endif
  2542. #endif
  2543. #ifndef builtin_object_size
  2544. # define builtin_object_size(ptr) ((size_t)-1)
  2545. #endif
  2546. 
  2547. File: cpp.info, Node: __has_include, Prev: __has_builtin, Up: Conditional Syntax
  2548. 4.2.10 '__has_include'
  2549. ----------------------
  2550. The special operator '__has_include (OPERAND)' may be used in '#if' and
  2551. '#elif' expressions to test whether the header referenced by its OPERAND
  2552. can be included using the '#include' directive. Using the operator in
  2553. other contexts is not valid. The OPERAND takes the same form as the
  2554. file in the '#include' directive (*note Include Syntax::) and evaluates
  2555. to a nonzero value if the header can be included and to zero otherwise.
  2556. Note that that the ability to include a header doesn't imply that the
  2557. header doesn't contain invalid constructs or '#error' directives that
  2558. would cause the preprocessor to fail.
  2559. The '__has_include' operator by itself, without any OPERAND or
  2560. parentheses, acts as a predefined macro so that support for it can be
  2561. tested in portable code. Thus, the recommended use of the operator is
  2562. as follows:
  2563. #if defined __has_include
  2564. # if __has_include (<stdatomic.h>)
  2565. # include <stdatomic.h>
  2566. # endif
  2567. #endif
  2568. The first '#if' test succeeds only when the operator is supported by
  2569. the version of GCC (or another compiler) being used. Only when that
  2570. test succeeds is it valid to use '__has_include' as a preprocessor
  2571. operator. As a result, combining the two tests into a single expression
  2572. as shown below would only be valid with a compiler that supports the
  2573. operator but not with others that don't.
  2574. #if defined __has_include && __has_include ("header.h") /* not portable */
  2575. ...
  2576. #endif
  2577. 
  2578. File: cpp.info, Node: Deleted Code, Prev: Conditional Syntax, Up: Conditionals
  2579. 4.3 Deleted Code
  2580. ================
  2581. If you replace or delete a part of the program but want to keep the old
  2582. code around for future reference, you often cannot simply comment it
  2583. out. Block comments do not nest, so the first comment inside the old
  2584. code will end the commenting-out. The probable result is a flood of
  2585. syntax errors.
  2586. One way to avoid this problem is to use an always-false conditional
  2587. instead. For instance, put '#if 0' before the deleted code and '#endif'
  2588. after it. This works even if the code being turned off contains
  2589. conditionals, but they must be entire conditionals (balanced '#if' and
  2590. '#endif').
  2591. Some people use '#ifdef notdef' instead. This is risky, because
  2592. 'notdef' might be accidentally defined as a macro, and then the
  2593. conditional would succeed. '#if 0' can be counted on to fail.
  2594. Do not use '#if 0' for comments which are not C code. Use a real
  2595. comment, instead. The interior of '#if 0' must consist of complete
  2596. tokens; in particular, single-quote characters must balance. Comments
  2597. often contain unbalanced single-quote characters (known in English as
  2598. apostrophes). These confuse '#if 0'. They don't confuse '/*'.
  2599. 
  2600. File: cpp.info, Node: Diagnostics, Next: Line Control, Prev: Conditionals, Up: Top
  2601. 5 Diagnostics
  2602. *************
  2603. The directive '#error' causes the preprocessor to report a fatal error.
  2604. The tokens forming the rest of the line following '#error' are used as
  2605. the error message.
  2606. You would use '#error' inside of a conditional that detects a
  2607. combination of parameters which you know the program does not properly
  2608. support. For example, if you know that the program will not run
  2609. properly on a VAX, you might write
  2610. #ifdef __vax__
  2611. #error "Won't work on VAXen. See comments at get_last_object."
  2612. #endif
  2613. If you have several configuration parameters that must be set up by
  2614. the installation in a consistent way, you can use conditionals to detect
  2615. an inconsistency and report it with '#error'. For example,
  2616. #if !defined(FOO) && defined(BAR)
  2617. #error "BAR requires FOO."
  2618. #endif
  2619. The directive '#warning' is like '#error', but causes the
  2620. preprocessor to issue a warning and continue preprocessing. The tokens
  2621. following '#warning' are used as the warning message.
  2622. You might use '#warning' in obsolete header files, with a message
  2623. directing the user to the header file which should be used instead.
  2624. Neither '#error' nor '#warning' macro-expands its argument. Internal
  2625. whitespace sequences are each replaced with a single space. The line
  2626. must consist of complete tokens. It is wisest to make the argument of
  2627. these directives be a single string constant; this avoids problems with
  2628. apostrophes and the like.
  2629. 
  2630. File: cpp.info, Node: Line Control, Next: Pragmas, Prev: Diagnostics, Up: Top
  2631. 6 Line Control
  2632. **************
  2633. The C preprocessor informs the C compiler of the location in your source
  2634. code where each token came from. Presently, this is just the file name
  2635. and line number. All the tokens resulting from macro expansion are
  2636. reported as having appeared on the line of the source file where the
  2637. outermost macro was used. We intend to be more accurate in the future.
  2638. If you write a program which generates source code, such as the
  2639. 'bison' parser generator, you may want to adjust the preprocessor's
  2640. notion of the current file name and line number by hand. Parts of the
  2641. output from 'bison' are generated from scratch, other parts come from a
  2642. standard parser file. The rest are copied verbatim from 'bison''s
  2643. input. You would like compiler error messages and symbolic debuggers to
  2644. be able to refer to 'bison''s input file.
  2645. 'bison' or any such program can arrange this by writing '#line'
  2646. directives into the output file. '#line' is a directive that specifies
  2647. the original line number and source file name for subsequent input in
  2648. the current preprocessor input file. '#line' has three variants:
  2649. '#line LINENUM'
  2650. LINENUM is a non-negative decimal integer constant. It specifies
  2651. the line number which should be reported for the following line of
  2652. input. Subsequent lines are counted from LINENUM.
  2653. '#line LINENUM FILENAME'
  2654. LINENUM is the same as for the first form, and has the same effect.
  2655. In addition, FILENAME is a string constant. The following line and
  2656. all subsequent lines are reported to come from the file it
  2657. specifies, until something else happens to change that. FILENAME
  2658. is interpreted according to the normal rules for a string constant:
  2659. backslash escapes are interpreted. This is different from
  2660. '#include'.
  2661. '#line ANYTHING ELSE'
  2662. ANYTHING ELSE is checked for macro calls, which are expanded. The
  2663. result should match one of the above two forms.
  2664. '#line' directives alter the results of the '__FILE__' and '__LINE__'
  2665. predefined macros from that point on. *Note Standard Predefined
  2666. Macros::. They do not have any effect on '#include''s idea of the
  2667. directory containing the current file.
  2668. 
  2669. File: cpp.info, Node: Pragmas, Next: Other Directives, Prev: Line Control, Up: Top
  2670. 7 Pragmas
  2671. *********
  2672. The '#pragma' directive is the method specified by the C standard for
  2673. providing additional information to the compiler, beyond what is
  2674. conveyed in the language itself. The forms of this directive (commonly
  2675. known as "pragmas") specified by C standard are prefixed with 'STDC'. A
  2676. C compiler is free to attach any meaning it likes to other pragmas.
  2677. Most GNU-defined, supported pragmas have been given a 'GCC' prefix.
  2678. C99 introduced the '_Pragma' operator. This feature addresses a
  2679. major problem with '#pragma': being a directive, it cannot be produced
  2680. as the result of macro expansion. '_Pragma' is an operator, much like
  2681. 'sizeof' or 'defined', and can be embedded in a macro.
  2682. Its syntax is '_Pragma (STRING-LITERAL)', where STRING-LITERAL can be
  2683. either a normal or wide-character string literal. It is destringized,
  2684. by replacing all '\\' with a single '\' and all '\"' with a '"'. The
  2685. result is then processed as if it had appeared as the right hand side of
  2686. a '#pragma' directive. For example,
  2687. _Pragma ("GCC dependency \"parse.y\"")
  2688. has the same effect as '#pragma GCC dependency "parse.y"'. The same
  2689. effect could be achieved using macros, for example
  2690. #define DO_PRAGMA(x) _Pragma (#x)
  2691. DO_PRAGMA (GCC dependency "parse.y")
  2692. The standard is unclear on where a '_Pragma' operator can appear.
  2693. The preprocessor does not accept it within a preprocessing conditional
  2694. directive like '#if'. To be safe, you are probably best keeping it out
  2695. of directives other than '#define', and putting it on a line of its own.
  2696. This manual documents the pragmas which are meaningful to the
  2697. preprocessor itself. Other pragmas are meaningful to the C or C++
  2698. compilers. They are documented in the GCC manual.
  2699. GCC plugins may provide their own pragmas.
  2700. '#pragma GCC dependency'
  2701. '#pragma GCC dependency' allows you to check the relative dates of
  2702. the current file and another file. If the other file is more
  2703. recent than the current file, a warning is issued. This is useful
  2704. if the current file is derived from the other file, and should be
  2705. regenerated. The other file is searched for using the normal
  2706. include search path. Optional trailing text can be used to give
  2707. more information in the warning message.
  2708. #pragma GCC dependency "parse.y"
  2709. #pragma GCC dependency "/usr/include/time.h" rerun fixincludes
  2710. '#pragma GCC poison'
  2711. Sometimes, there is an identifier that you want to remove
  2712. completely from your program, and make sure that it never creeps
  2713. back in. To enforce this, you can "poison" the identifier with
  2714. this pragma. '#pragma GCC poison' is followed by a list of
  2715. identifiers to poison. If any of those identifiers appears
  2716. anywhere in the source after the directive, it is a hard error.
  2717. For example,
  2718. #pragma GCC poison printf sprintf fprintf
  2719. sprintf(some_string, "hello");
  2720. will produce an error.
  2721. If a poisoned identifier appears as part of the expansion of a
  2722. macro which was defined before the identifier was poisoned, it will
  2723. _not_ cause an error. This lets you poison an identifier without
  2724. worrying about system headers defining macros that use it.
  2725. For example,
  2726. #define strrchr rindex
  2727. #pragma GCC poison rindex
  2728. strrchr(some_string, 'h');
  2729. will not produce an error.
  2730. '#pragma GCC system_header'
  2731. This pragma takes no arguments. It causes the rest of the code in
  2732. the current file to be treated as if it came from a system header.
  2733. *Note System Headers::.
  2734. '#pragma GCC warning'
  2735. '#pragma GCC error'
  2736. '#pragma GCC warning "message"' causes the preprocessor to issue a
  2737. warning diagnostic with the text 'message'. The message contained
  2738. in the pragma must be a single string literal. Similarly, '#pragma
  2739. GCC error "message"' issues an error message. Unlike the
  2740. '#warning' and '#error' directives, these pragmas can be embedded
  2741. in preprocessor macros using '_Pragma'.
  2742. '#pragma once'
  2743. If '#pragma once' is seen when scanning a header file, that file
  2744. will never be read again, no matter what. It is a less-portable
  2745. alternative to using '#ifndef' to guard the contents of header
  2746. files against multiple inclusions.
  2747. 
  2748. File: cpp.info, Node: Other Directives, Next: Preprocessor Output, Prev: Pragmas, Up: Top
  2749. 8 Other Directives
  2750. ******************
  2751. The '#ident' directive takes one argument, a string constant. On some
  2752. systems, that string constant is copied into a special segment of the
  2753. object file. On other systems, the directive is ignored. The '#sccs'
  2754. directive is a synonym for '#ident'.
  2755. These directives are not part of the C standard, but they are not
  2756. official GNU extensions either. What historical information we have
  2757. been able to find, suggests they originated with System V.
  2758. The "null directive" consists of a '#' followed by a newline, with
  2759. only whitespace (including comments) in between. A null directive is
  2760. understood as a preprocessing directive but has no effect on the
  2761. preprocessor output. The primary significance of the existence of the
  2762. null directive is that an input line consisting of just a '#' will
  2763. produce no output, rather than a line of output containing just a '#'.
  2764. Supposedly some old C programs contain such lines.
  2765. 
  2766. File: cpp.info, Node: Preprocessor Output, Next: Traditional Mode, Prev: Other Directives, Up: Top
  2767. 9 Preprocessor Output
  2768. *********************
  2769. When the C preprocessor is used with the C, C++, or Objective-C
  2770. compilers, it is integrated into the compiler and communicates a stream
  2771. of binary tokens directly to the compiler's parser. However, it can
  2772. also be used in the more conventional standalone mode, where it produces
  2773. textual output.
  2774. The output from the C preprocessor looks much like the input, except
  2775. that all preprocessing directive lines have been replaced with blank
  2776. lines and all comments with spaces. Long runs of blank lines are
  2777. discarded.
  2778. The ISO standard specifies that it is implementation defined whether
  2779. a preprocessor preserves whitespace between tokens, or replaces it with
  2780. e.g. a single space. In GNU CPP, whitespace between tokens is collapsed
  2781. to become a single space, with the exception that the first token on a
  2782. non-directive line is preceded with sufficient spaces that it appears in
  2783. the same column in the preprocessed output that it appeared in the
  2784. original source file. This is so the output is easy to read. CPP does
  2785. not insert any whitespace where there was none in the original source,
  2786. except where necessary to prevent an accidental token paste.
  2787. Source file name and line number information is conveyed by lines of
  2788. the form
  2789. # LINENUM FILENAME FLAGS
  2790. These are called "linemarkers". They are inserted as needed into the
  2791. output (but never within a string or character constant). They mean
  2792. that the following line originated in file FILENAME at line LINENUM.
  2793. FILENAME will never contain any non-printing characters; they are
  2794. replaced with octal escape sequences.
  2795. After the file name comes zero or more flags, which are '1', '2',
  2796. '3', or '4'. If there are multiple flags, spaces separate them. Here
  2797. is what the flags mean:
  2798. '1'
  2799. This indicates the start of a new file.
  2800. '2'
  2801. This indicates returning to a file (after having included another
  2802. file).
  2803. '3'
  2804. This indicates that the following text comes from a system header
  2805. file, so certain warnings should be suppressed.
  2806. '4'
  2807. This indicates that the following text should be treated as being
  2808. wrapped in an implicit 'extern "C"' block.
  2809. As an extension, the preprocessor accepts linemarkers in
  2810. non-assembler input files. They are treated like the corresponding
  2811. '#line' directive, (*note Line Control::), except that trailing flags
  2812. are permitted, and are interpreted with the meanings described above.
  2813. If multiple flags are given, they must be in ascending order.
  2814. Some directives may be duplicated in the output of the preprocessor.
  2815. These are '#ident' (always), '#pragma' (only if the preprocessor does
  2816. not handle the pragma itself), and '#define' and '#undef' (with certain
  2817. debugging options). If this happens, the '#' of the directive will
  2818. always be in the first column, and there will be no space between the
  2819. '#' and the directive name. If macro expansion happens to generate
  2820. tokens which might be mistaken for a duplicated directive, a space will
  2821. be inserted between the '#' and the directive name.
  2822. 
  2823. File: cpp.info, Node: Traditional Mode, Next: Implementation Details, Prev: Preprocessor Output, Up: Top
  2824. 10 Traditional Mode
  2825. *******************
  2826. Traditional (pre-standard) C preprocessing is rather different from the
  2827. preprocessing specified by the standard. When the preprocessor is
  2828. invoked with the '-traditional-cpp' option, it attempts to emulate a
  2829. traditional preprocessor.
  2830. This mode is not useful for compiling C code with GCC, but is
  2831. intended for use with non-C preprocessing applications. Thus
  2832. traditional mode semantics are supported only when invoking the
  2833. preprocessor explicitly, and not in the compiler front ends.
  2834. The implementation does not correspond precisely to the behavior of
  2835. early pre-standard versions of GCC, nor to any true traditional
  2836. preprocessor. After all, inconsistencies among traditional
  2837. implementations were a major motivation for C standardization. However,
  2838. we intend that it should be compatible with true traditional
  2839. preprocessors in all ways that actually matter.
  2840. * Menu:
  2841. * Traditional lexical analysis::
  2842. * Traditional macros::
  2843. * Traditional miscellany::
  2844. * Traditional warnings::
  2845. 
  2846. File: cpp.info, Node: Traditional lexical analysis, Next: Traditional macros, Up: Traditional Mode
  2847. 10.1 Traditional lexical analysis
  2848. =================================
  2849. The traditional preprocessor does not decompose its input into tokens
  2850. the same way a standards-conforming preprocessor does. The input is
  2851. simply treated as a stream of text with minimal internal form.
  2852. This implementation does not treat trigraphs (*note trigraphs::)
  2853. specially since they were an invention of the standards committee. It
  2854. handles arbitrarily-positioned escaped newlines properly and splices the
  2855. lines as you would expect; many traditional preprocessors did not do
  2856. this.
  2857. The form of horizontal whitespace in the input file is preserved in
  2858. the output. In particular, hard tabs remain hard tabs. This can be
  2859. useful if, for example, you are preprocessing a Makefile.
  2860. Traditional CPP only recognizes C-style block comments, and treats
  2861. the '/*' sequence as introducing a comment only if it lies outside
  2862. quoted text. Quoted text is introduced by the usual single and double
  2863. quotes, and also by an initial '<' in a '#include' directive.
  2864. Traditionally, comments are completely removed and are not replaced
  2865. with a space. Since a traditional compiler does its own tokenization of
  2866. the output of the preprocessor, this means that comments can effectively
  2867. be used as token paste operators. However, comments behave like
  2868. separators for text handled by the preprocessor itself, since it doesn't
  2869. re-lex its input. For example, in
  2870. #if foo/**/bar
  2871. 'foo' and 'bar' are distinct identifiers and expanded separately if they
  2872. happen to be macros. In other words, this directive is equivalent to
  2873. #if foo bar
  2874. rather than
  2875. #if foobar
  2876. Generally speaking, in traditional mode an opening quote need not
  2877. have a matching closing quote. In particular, a macro may be defined
  2878. with replacement text that contains an unmatched quote. Of course, if
  2879. you attempt to compile preprocessed output containing an unmatched quote
  2880. you will get a syntax error.
  2881. However, all preprocessing directives other than '#define' require
  2882. matching quotes. For example:
  2883. #define m This macro's fine and has an unmatched quote
  2884. "/* This is not a comment. */
  2885. /* This is a comment. The following #include directive
  2886. is ill-formed. */
  2887. #include <stdio.h
  2888. Just as for the ISO preprocessor, what would be a closing quote can
  2889. be escaped with a backslash to prevent the quoted text from closing.
  2890. 
  2891. File: cpp.info, Node: Traditional macros, Next: Traditional miscellany, Prev: Traditional lexical analysis, Up: Traditional Mode
  2892. 10.2 Traditional macros
  2893. =======================
  2894. The major difference between traditional and ISO macros is that the
  2895. former expand to text rather than to a token sequence. CPP removes all
  2896. leading and trailing horizontal whitespace from a macro's replacement
  2897. text before storing it, but preserves the form of internal whitespace.
  2898. One consequence is that it is legitimate for the replacement text to
  2899. contain an unmatched quote (*note Traditional lexical analysis::). An
  2900. unclosed string or character constant continues into the text following
  2901. the macro call. Similarly, the text at the end of a macro's expansion
  2902. can run together with the text after the macro invocation to produce a
  2903. single token.
  2904. Normally comments are removed from the replacement text after the
  2905. macro is expanded, but if the '-CC' option is passed on the command-line
  2906. comments are preserved. (In fact, the current implementation removes
  2907. comments even before saving the macro replacement text, but it careful
  2908. to do it in such a way that the observed effect is identical even in the
  2909. function-like macro case.)
  2910. The ISO stringizing operator '#' and token paste operator '##' have
  2911. no special meaning. As explained later, an effect similar to these
  2912. operators can be obtained in a different way. Macro names that are
  2913. embedded in quotes, either from the main file or after macro
  2914. replacement, do not expand.
  2915. CPP replaces an unquoted object-like macro name with its replacement
  2916. text, and then rescans it for further macros to replace. Unlike
  2917. standard macro expansion, traditional macro expansion has no provision
  2918. to prevent recursion. If an object-like macro appears unquoted in its
  2919. replacement text, it will be replaced again during the rescan pass, and
  2920. so on _ad infinitum_. GCC detects when it is expanding recursive
  2921. macros, emits an error message, and continues after the offending macro
  2922. invocation.
  2923. #define PLUS +
  2924. #define INC(x) PLUS+x
  2925. INC(foo);
  2926. ==> ++foo;
  2927. Function-like macros are similar in form but quite different in
  2928. behavior to their ISO counterparts. Their arguments are contained
  2929. within parentheses, are comma-separated, and can cross physical lines.
  2930. Commas within nested parentheses are not treated as argument separators.
  2931. Similarly, a quote in an argument cannot be left unclosed; a following
  2932. comma or parenthesis that comes before the closing quote is treated like
  2933. any other character. There is no facility for handling variadic macros.
  2934. This implementation removes all comments from macro arguments, unless
  2935. the '-C' option is given. The form of all other horizontal whitespace
  2936. in arguments is preserved, including leading and trailing whitespace.
  2937. In particular
  2938. f( )
  2939. is treated as an invocation of the macro 'f' with a single argument
  2940. consisting of a single space. If you want to invoke a function-like
  2941. macro that takes no arguments, you must not leave any whitespace between
  2942. the parentheses.
  2943. If a macro argument crosses a new line, the new line is replaced with
  2944. a space when forming the argument. If the previous line contained an
  2945. unterminated quote, the following line inherits the quoted state.
  2946. Traditional preprocessors replace parameters in the replacement text
  2947. with their arguments regardless of whether the parameters are within
  2948. quotes or not. This provides a way to stringize arguments. For example
  2949. #define str(x) "x"
  2950. str(/* A comment */some text )
  2951. ==> "some text "
  2952. Note that the comment is removed, but that the trailing space is
  2953. preserved. Here is an example of using a comment to effect token
  2954. pasting.
  2955. #define suffix(x) foo_/**/x
  2956. suffix(bar)
  2957. ==> foo_bar
  2958. 
  2959. File: cpp.info, Node: Traditional miscellany, Next: Traditional warnings, Prev: Traditional macros, Up: Traditional Mode
  2960. 10.3 Traditional miscellany
  2961. ===========================
  2962. Here are some things to be aware of when using the traditional
  2963. preprocessor.
  2964. * Preprocessing directives are recognized only when their leading '#'
  2965. appears in the first column. There can be no whitespace between
  2966. the beginning of the line and the '#', but whitespace can follow
  2967. the '#'.
  2968. * A true traditional C preprocessor does not recognize '#error' or
  2969. '#pragma', and may not recognize '#elif'. CPP supports all the
  2970. directives in traditional mode that it supports in ISO mode,
  2971. including extensions, with the exception that the effects of
  2972. '#pragma GCC poison' are undefined.
  2973. * __STDC__ is not defined.
  2974. * If you use digraphs the behavior is undefined.
  2975. * If a line that looks like a directive appears within macro
  2976. arguments, the behavior is undefined.
  2977. 
  2978. File: cpp.info, Node: Traditional warnings, Prev: Traditional miscellany, Up: Traditional Mode
  2979. 10.4 Traditional warnings
  2980. =========================
  2981. You can request warnings about features that did not exist, or worked
  2982. differently, in traditional C with the '-Wtraditional' option. GCC does
  2983. not warn about features of ISO C which you must use when you are using a
  2984. conforming compiler, such as the '#' and '##' operators.
  2985. Presently '-Wtraditional' warns about:
  2986. * Macro parameters that appear within string literals in the macro
  2987. body. In traditional C macro replacement takes place within string
  2988. literals, but does not in ISO C.
  2989. * In traditional C, some preprocessor directives did not exist.
  2990. Traditional preprocessors would only consider a line to be a
  2991. directive if the '#' appeared in column 1 on the line. Therefore
  2992. '-Wtraditional' warns about directives that traditional C
  2993. understands but would ignore because the '#' does not appear as the
  2994. first character on the line. It also suggests you hide directives
  2995. like '#pragma' not understood by traditional C by indenting them.
  2996. Some traditional implementations would not recognize '#elif', so it
  2997. suggests avoiding it altogether.
  2998. * A function-like macro that appears without an argument list. In
  2999. some traditional preprocessors this was an error. In ISO C it
  3000. merely means that the macro is not expanded.
  3001. * The unary plus operator. This did not exist in traditional C.
  3002. * The 'U' and 'LL' integer constant suffixes, which were not
  3003. available in traditional C. (Traditional C does support the 'L'
  3004. suffix for simple long integer constants.) You are not warned
  3005. about uses of these suffixes in macros defined in system headers.
  3006. For instance, 'UINT_MAX' may well be defined as '4294967295U', but
  3007. you will not be warned if you use 'UINT_MAX'.
  3008. You can usually avoid the warning, and the related warning about
  3009. constants which are so large that they are unsigned, by writing the
  3010. integer constant in question in hexadecimal, with no U suffix.
  3011. Take care, though, because this gives the wrong result in exotic
  3012. cases.
  3013. 
  3014. File: cpp.info, Node: Implementation Details, Next: Invocation, Prev: Traditional Mode, Up: Top
  3015. 11 Implementation Details
  3016. *************************
  3017. Here we document details of how the preprocessor's implementation
  3018. affects its user-visible behavior. You should try to avoid undue
  3019. reliance on behavior described here, as it is possible that it will
  3020. change subtly in future implementations.
  3021. Also documented here are obsolete features still supported by CPP.
  3022. * Menu:
  3023. * Implementation-defined behavior::
  3024. * Implementation limits::
  3025. * Obsolete Features::
  3026. 
  3027. File: cpp.info, Node: Implementation-defined behavior, Next: Implementation limits, Up: Implementation Details
  3028. 11.1 Implementation-defined behavior
  3029. ====================================
  3030. This is how CPP behaves in all the cases which the C standard describes
  3031. as "implementation-defined". This term means that the implementation is
  3032. free to do what it likes, but must document its choice and stick to it.
  3033. * The mapping of physical source file multi-byte characters to the
  3034. execution character set.
  3035. The input character set can be specified using the
  3036. '-finput-charset' option, while the execution character set may be
  3037. controlled using the '-fexec-charset' and '-fwide-exec-charset'
  3038. options.
  3039. * Identifier characters.
  3040. The C and C++ standards allow identifiers to be composed of '_' and
  3041. the alphanumeric characters. C++ also allows universal character
  3042. names. C99 and later C standards permit both universal character
  3043. names and implementation-defined characters. In both C and C++
  3044. modes, GCC accepts in identifiers exactly those extended characters
  3045. that correspond to universal character names permitted by the
  3046. chosen standard.
  3047. GCC allows the '$' character in identifiers as an extension for
  3048. most targets. This is true regardless of the 'std=' switch, since
  3049. this extension cannot conflict with standards-conforming programs.
  3050. When preprocessing assembler, however, dollars are not identifier
  3051. characters by default.
  3052. Currently the targets that by default do not permit '$' are AVR,
  3053. IP2K, MMIX, MIPS Irix 3, ARM aout, and PowerPC targets for the AIX
  3054. operating system.
  3055. You can override the default with '-fdollars-in-identifiers' or
  3056. 'fno-dollars-in-identifiers'. *Note fdollars-in-identifiers::.
  3057. * Non-empty sequences of whitespace characters.
  3058. In textual output, each whitespace sequence is collapsed to a
  3059. single space. For aesthetic reasons, the first token on each
  3060. non-directive line of output is preceded with sufficient spaces
  3061. that it appears in the same column as it did in the original source
  3062. file.
  3063. * The numeric value of character constants in preprocessor
  3064. expressions.
  3065. The preprocessor and compiler interpret character constants in the
  3066. same way; i.e. escape sequences such as '\a' are given the values
  3067. they would have on the target machine.
  3068. The compiler evaluates a multi-character character constant a
  3069. character at a time, shifting the previous value left by the number
  3070. of bits per target character, and then or-ing in the bit-pattern of
  3071. the new character truncated to the width of a target character.
  3072. The final bit-pattern is given type 'int', and is therefore signed,
  3073. regardless of whether single characters are signed or not. If
  3074. there are more characters in the constant than would fit in the
  3075. target 'int' the compiler issues a warning, and the excess leading
  3076. characters are ignored.
  3077. For example, ''ab'' for a target with an 8-bit 'char' would be
  3078. interpreted as
  3079. '(int) ((unsigned char) 'a' * 256 + (unsigned char) 'b')', and
  3080. ''\234a'' as
  3081. '(int) ((unsigned char) '\234' * 256 + (unsigned char) 'a')'.
  3082. * Source file inclusion.
  3083. For a discussion on how the preprocessor locates header files,
  3084. *note Include Operation::.
  3085. * Interpretation of the filename resulting from a macro-expanded
  3086. '#include' directive.
  3087. *Note Computed Includes::.
  3088. * Treatment of a '#pragma' directive that after macro-expansion
  3089. results in a standard pragma.
  3090. No macro expansion occurs on any '#pragma' directive line, so the
  3091. question does not arise.
  3092. Note that GCC does not yet implement any of the standard pragmas.
  3093. 
  3094. File: cpp.info, Node: Implementation limits, Next: Obsolete Features, Prev: Implementation-defined behavior, Up: Implementation Details
  3095. 11.2 Implementation limits
  3096. ==========================
  3097. CPP has a small number of internal limits. This section lists the
  3098. limits which the C standard requires to be no lower than some minimum,
  3099. and all the others known. It is intended that there should be as few
  3100. limits as possible. If you encounter an undocumented or inconvenient
  3101. limit, please report that as a bug. *Note Reporting Bugs: (gcc)Bugs.
  3102. Where we say something is limited "only by available memory", that
  3103. means that internal data structures impose no intrinsic limit, and space
  3104. is allocated with 'malloc' or equivalent. The actual limit will
  3105. therefore depend on many things, such as the size of other things
  3106. allocated by the compiler at the same time, the amount of memory
  3107. consumed by other processes on the same computer, etc.
  3108. * Nesting levels of '#include' files.
  3109. We impose an arbitrary limit of 200 levels, to avoid runaway
  3110. recursion. The standard requires at least 15 levels.
  3111. * Nesting levels of conditional inclusion.
  3112. The C standard mandates this be at least 63. CPP is limited only
  3113. by available memory.
  3114. * Levels of parenthesized expressions within a full expression.
  3115. The C standard requires this to be at least 63. In preprocessor
  3116. conditional expressions, it is limited only by available memory.
  3117. * Significant initial characters in an identifier or macro name.
  3118. The preprocessor treats all characters as significant. The C
  3119. standard requires only that the first 63 be significant.
  3120. * Number of macros simultaneously defined in a single translation
  3121. unit.
  3122. The standard requires at least 4095 be possible. CPP is limited
  3123. only by available memory.
  3124. * Number of parameters in a macro definition and arguments in a macro
  3125. call.
  3126. We allow 'USHRT_MAX', which is no smaller than 65,535. The minimum
  3127. required by the standard is 127.
  3128. * Number of characters on a logical source line.
  3129. The C standard requires a minimum of 4096 be permitted. CPP places
  3130. no limits on this, but you may get incorrect column numbers
  3131. reported in diagnostics for lines longer than 65,535 characters.
  3132. * Maximum size of a source file.
  3133. The standard does not specify any lower limit on the maximum size
  3134. of a source file. GNU cpp maps files into memory, so it is limited
  3135. by the available address space. This is generally at least two
  3136. gigabytes. Depending on the operating system, the size of physical
  3137. memory may or may not be a limitation.
  3138. 
  3139. File: cpp.info, Node: Obsolete Features, Prev: Implementation limits, Up: Implementation Details
  3140. 11.3 Obsolete Features
  3141. ======================
  3142. CPP has some features which are present mainly for compatibility with
  3143. older programs. We discourage their use in new code. In some cases, we
  3144. plan to remove the feature in a future version of GCC.
  3145. 11.3.1 Assertions
  3146. -----------------
  3147. "Assertions" are a deprecated alternative to macros in writing
  3148. conditionals to test what sort of computer or system the compiled
  3149. program will run on. Assertions are usually predefined, but you can
  3150. define them with preprocessing directives or command-line options.
  3151. Assertions were intended to provide a more systematic way to describe
  3152. the compiler's target system and we added them for compatibility with
  3153. existing compilers. In practice they are just as unpredictable as the
  3154. system-specific predefined macros. In addition, they are not part of
  3155. any standard, and only a few compilers support them. Therefore, the use
  3156. of assertions is *less* portable than the use of system-specific
  3157. predefined macros. We recommend you do not use them at all.
  3158. An assertion looks like this:
  3159. #PREDICATE (ANSWER)
  3160. PREDICATE must be a single identifier. ANSWER can be any sequence of
  3161. tokens; all characters are significant except for leading and trailing
  3162. whitespace, and differences in internal whitespace sequences are
  3163. ignored. (This is similar to the rules governing macro redefinition.)
  3164. Thus, '(x + y)' is different from '(x+y)' but equivalent to '( x + y )'.
  3165. Parentheses do not nest inside an answer.
  3166. To test an assertion, you write it in an '#if'. For example, this
  3167. conditional succeeds if either 'vax' or 'ns16000' has been asserted as
  3168. an answer for 'machine'.
  3169. #if #machine (vax) || #machine (ns16000)
  3170. You can test whether _any_ answer is asserted for a predicate by
  3171. omitting the answer in the conditional:
  3172. #if #machine
  3173. Assertions are made with the '#assert' directive. Its sole argument
  3174. is the assertion to make, without the leading '#' that identifies
  3175. assertions in conditionals.
  3176. #assert PREDICATE (ANSWER)
  3177. You may make several assertions with the same predicate and different
  3178. answers. Subsequent assertions do not override previous ones for the
  3179. same predicate. All the answers for any given predicate are
  3180. simultaneously true.
  3181. Assertions can be canceled with the '#unassert' directive. It has
  3182. the same syntax as '#assert'. In that form it cancels only the answer
  3183. which was specified on the '#unassert' line; other answers for that
  3184. predicate remain true. You can cancel an entire predicate by leaving
  3185. out the answer:
  3186. #unassert PREDICATE
  3187. In either form, if no such assertion has been made, '#unassert' has no
  3188. effect.
  3189. You can also make or cancel assertions using command-line options.
  3190. *Note Invocation::.
  3191. 
  3192. File: cpp.info, Node: Invocation, Next: Environment Variables, Prev: Implementation Details, Up: Top
  3193. 12 Invocation
  3194. *************
  3195. Most often when you use the C preprocessor you do not have to invoke it
  3196. explicitly: the C compiler does so automatically. However, the
  3197. preprocessor is sometimes useful on its own. You can invoke the
  3198. preprocessor either with the 'cpp' command, or via 'gcc -E'. In GCC,
  3199. the preprocessor is actually integrated with the compiler rather than a
  3200. separate program, and both of these commands invoke GCC and tell it to
  3201. stop after the preprocessing phase.
  3202. The 'cpp' options listed here are also accepted by 'gcc' and have the
  3203. same meaning. Likewise the 'cpp' command accepts all the usual 'gcc'
  3204. driver options, although those pertaining to compilation phases after
  3205. preprocessing are ignored.
  3206. Only options specific to preprocessing behavior are documented here.
  3207. Refer to the GCC manual for full documentation of other driver options.
  3208. The 'cpp' command expects two file names as arguments, INFILE and
  3209. OUTFILE. The preprocessor reads INFILE together with any other files it
  3210. specifies with '#include'. All the output generated by the combined
  3211. input files is written in OUTFILE.
  3212. Either INFILE or OUTFILE may be '-', which as INFILE means to read
  3213. from standard input and as OUTFILE means to write to standard output.
  3214. If either file is omitted, it means the same as if '-' had been
  3215. specified for that file. You can also use the '-o OUTFILE' option to
  3216. specify the output file.
  3217. Unless otherwise noted, or the option ends in '=', all options which
  3218. take an argument may have that argument appear either immediately after
  3219. the option, or with a space between option and argument: '-Ifoo' and '-I
  3220. foo' have the same effect.
  3221. Many options have multi-letter names; therefore multiple
  3222. single-letter options may _not_ be grouped: '-dM' is very different from
  3223. '-d -M'.
  3224. '-D NAME'
  3225. Predefine NAME as a macro, with definition '1'.
  3226. '-D NAME=DEFINITION'
  3227. The contents of DEFINITION are tokenized and processed as if they
  3228. appeared during translation phase three in a '#define' directive.
  3229. In particular, the definition is truncated by embedded newline
  3230. characters.
  3231. If you are invoking the preprocessor from a shell or shell-like
  3232. program you may need to use the shell's quoting syntax to protect
  3233. characters such as spaces that have a meaning in the shell syntax.
  3234. If you wish to define a function-like macro on the command line,
  3235. write its argument list with surrounding parentheses before the
  3236. equals sign (if any). Parentheses are meaningful to most shells,
  3237. so you should quote the option. With 'sh' and 'csh',
  3238. '-D'NAME(ARGS...)=DEFINITION'' works.
  3239. '-D' and '-U' options are processed in the order they are given on
  3240. the command line. All '-imacros FILE' and '-include FILE' options
  3241. are processed after all '-D' and '-U' options.
  3242. '-U NAME'
  3243. Cancel any previous definition of NAME, either built in or provided
  3244. with a '-D' option.
  3245. '-include FILE'
  3246. Process FILE as if '#include "file"' appeared as the first line of
  3247. the primary source file. However, the first directory searched for
  3248. FILE is the preprocessor's working directory _instead of_ the
  3249. directory containing the main source file. If not found there, it
  3250. is searched for in the remainder of the '#include "..."' search
  3251. chain as normal.
  3252. If multiple '-include' options are given, the files are included in
  3253. the order they appear on the command line.
  3254. '-imacros FILE'
  3255. Exactly like '-include', except that any output produced by
  3256. scanning FILE is thrown away. Macros it defines remain defined.
  3257. This allows you to acquire all the macros from a header without
  3258. also processing its declarations.
  3259. All files specified by '-imacros' are processed before all files
  3260. specified by '-include'.
  3261. '-undef'
  3262. Do not predefine any system-specific or GCC-specific macros. The
  3263. standard predefined macros remain defined. *Note Standard
  3264. Predefined Macros::.
  3265. '-pthread'
  3266. Define additional macros required for using the POSIX threads
  3267. library. You should use this option consistently for both
  3268. compilation and linking. This option is supported on GNU/Linux
  3269. targets, most other Unix derivatives, and also on x86 Cygwin and
  3270. MinGW targets.
  3271. '-M'
  3272. Instead of outputting the result of preprocessing, output a rule
  3273. suitable for 'make' describing the dependencies of the main source
  3274. file. The preprocessor outputs one 'make' rule containing the
  3275. object file name for that source file, a colon, and the names of
  3276. all the included files, including those coming from '-include' or
  3277. '-imacros' command-line options.
  3278. Unless specified explicitly (with '-MT' or '-MQ'), the object file
  3279. name consists of the name of the source file with any suffix
  3280. replaced with object file suffix and with any leading directory
  3281. parts removed. If there are many included files then the rule is
  3282. split into several lines using '\'-newline. The rule has no
  3283. commands.
  3284. This option does not suppress the preprocessor's debug output, such
  3285. as '-dM'. To avoid mixing such debug output with the dependency
  3286. rules you should explicitly specify the dependency output file with
  3287. '-MF', or use an environment variable like 'DEPENDENCIES_OUTPUT'
  3288. (*note Environment Variables::). Debug output is still sent to the
  3289. regular output stream as normal.
  3290. Passing '-M' to the driver implies '-E', and suppresses warnings
  3291. with an implicit '-w'.
  3292. '-MM'
  3293. Like '-M' but do not mention header files that are found in system
  3294. header directories, nor header files that are included, directly or
  3295. indirectly, from such a header.
  3296. This implies that the choice of angle brackets or double quotes in
  3297. an '#include' directive does not in itself determine whether that
  3298. header appears in '-MM' dependency output.
  3299. '-MF FILE'
  3300. When used with '-M' or '-MM', specifies a file to write the
  3301. dependencies to. If no '-MF' switch is given the preprocessor
  3302. sends the rules to the same place it would send preprocessed
  3303. output.
  3304. When used with the driver options '-MD' or '-MMD', '-MF' overrides
  3305. the default dependency output file.
  3306. If FILE is '-', then the dependencies are written to 'stdout'.
  3307. '-MG'
  3308. In conjunction with an option such as '-M' requesting dependency
  3309. generation, '-MG' assumes missing header files are generated files
  3310. and adds them to the dependency list without raising an error. The
  3311. dependency filename is taken directly from the '#include' directive
  3312. without prepending any path. '-MG' also suppresses preprocessed
  3313. output, as a missing header file renders this useless.
  3314. This feature is used in automatic updating of makefiles.
  3315. '-Mno-modules'
  3316. Disable dependency generation for compiled module interfaces.
  3317. '-MP'
  3318. This option instructs CPP to add a phony target for each dependency
  3319. other than the main file, causing each to depend on nothing. These
  3320. dummy rules work around errors 'make' gives if you remove header
  3321. files without updating the 'Makefile' to match.
  3322. This is typical output:
  3323. test.o: test.c test.h
  3324. test.h:
  3325. '-MT TARGET'
  3326. Change the target of the rule emitted by dependency generation. By
  3327. default CPP takes the name of the main input file, deletes any
  3328. directory components and any file suffix such as '.c', and appends
  3329. the platform's usual object suffix. The result is the target.
  3330. An '-MT' option sets the target to be exactly the string you
  3331. specify. If you want multiple targets, you can specify them as a
  3332. single argument to '-MT', or use multiple '-MT' options.
  3333. For example, '-MT '$(objpfx)foo.o'' might give
  3334. $(objpfx)foo.o: foo.c
  3335. '-MQ TARGET'
  3336. Same as '-MT', but it quotes any characters which are special to
  3337. Make. '-MQ '$(objpfx)foo.o'' gives
  3338. $$(objpfx)foo.o: foo.c
  3339. The default target is automatically quoted, as if it were given
  3340. with '-MQ'.
  3341. '-MD'
  3342. '-MD' is equivalent to '-M -MF FILE', except that '-E' is not
  3343. implied. The driver determines FILE based on whether an '-o'
  3344. option is given. If it is, the driver uses its argument but with a
  3345. suffix of '.d', otherwise it takes the name of the input file,
  3346. removes any directory components and suffix, and applies a '.d'
  3347. suffix.
  3348. If '-MD' is used in conjunction with '-E', any '-o' switch is
  3349. understood to specify the dependency output file (*note -MF:
  3350. dashMF.), but if used without '-E', each '-o' is understood to
  3351. specify a target object file.
  3352. Since '-E' is not implied, '-MD' can be used to generate a
  3353. dependency output file as a side effect of the compilation process.
  3354. '-MMD'
  3355. Like '-MD' except mention only user header files, not system header
  3356. files.
  3357. '-fpreprocessed'
  3358. Indicate to the preprocessor that the input file has already been
  3359. preprocessed. This suppresses things like macro expansion,
  3360. trigraph conversion, escaped newline splicing, and processing of
  3361. most directives. The preprocessor still recognizes and removes
  3362. comments, so that you can pass a file preprocessed with '-C' to the
  3363. compiler without problems. In this mode the integrated
  3364. preprocessor is little more than a tokenizer for the front ends.
  3365. '-fpreprocessed' is implicit if the input file has one of the
  3366. extensions '.i', '.ii' or '.mi'. These are the extensions that GCC
  3367. uses for preprocessed files created by '-save-temps'.
  3368. '-fdirectives-only'
  3369. When preprocessing, handle directives, but do not expand macros.
  3370. The option's behavior depends on the '-E' and '-fpreprocessed'
  3371. options.
  3372. With '-E', preprocessing is limited to the handling of directives
  3373. such as '#define', '#ifdef', and '#error'. Other preprocessor
  3374. operations, such as macro expansion and trigraph conversion are not
  3375. performed. In addition, the '-dD' option is implicitly enabled.
  3376. With '-fpreprocessed', predefinition of command line and most
  3377. builtin macros is disabled. Macros such as '__LINE__', which are
  3378. contextually dependent, are handled normally. This enables
  3379. compilation of files previously preprocessed with '-E
  3380. -fdirectives-only'.
  3381. With both '-E' and '-fpreprocessed', the rules for '-fpreprocessed'
  3382. take precedence. This enables full preprocessing of files
  3383. previously preprocessed with '-E -fdirectives-only'.
  3384. '-fdollars-in-identifiers'
  3385. Accept '$' in identifiers. *Note Identifier characters::.
  3386. '-fextended-identifiers'
  3387. Accept universal character names and extended characters in
  3388. identifiers. This option is enabled by default for C99 (and later
  3389. C standard versions) and C++.
  3390. '-fno-canonical-system-headers'
  3391. When preprocessing, do not shorten system header paths with
  3392. canonicalization.
  3393. '-fmax-include-depth=DEPTH'
  3394. Set the maximum depth of the nested #include. The default is 200.
  3395. '-ftabstop=WIDTH'
  3396. Set the distance between tab stops. This helps the preprocessor
  3397. report correct column numbers in warnings or errors, even if tabs
  3398. appear on the line. If the value is less than 1 or greater than
  3399. 100, the option is ignored. The default is 8.
  3400. '-ftrack-macro-expansion[=LEVEL]'
  3401. Track locations of tokens across macro expansions. This allows the
  3402. compiler to emit diagnostic about the current macro expansion stack
  3403. when a compilation error occurs in a macro expansion. Using this
  3404. option makes the preprocessor and the compiler consume more memory.
  3405. The LEVEL parameter can be used to choose the level of precision of
  3406. token location tracking thus decreasing the memory consumption if
  3407. necessary. Value '0' of LEVEL de-activates this option. Value '1'
  3408. tracks tokens locations in a degraded mode for the sake of minimal
  3409. memory overhead. In this mode all tokens resulting from the
  3410. expansion of an argument of a function-like macro have the same
  3411. location. Value '2' tracks tokens locations completely. This
  3412. value is the most memory hungry. When this option is given no
  3413. argument, the default parameter value is '2'.
  3414. Note that '-ftrack-macro-expansion=2' is activated by default.
  3415. '-fmacro-prefix-map=OLD=NEW'
  3416. When preprocessing files residing in directory 'OLD', expand the
  3417. '__FILE__' and '__BASE_FILE__' macros as if the files resided in
  3418. directory 'NEW' instead. This can be used to change an absolute
  3419. path to a relative path by using '.' for NEW which can result in
  3420. more reproducible builds that are location independent. This
  3421. option also affects '__builtin_FILE()' during compilation. See
  3422. also '-ffile-prefix-map'.
  3423. '-fexec-charset=CHARSET'
  3424. Set the execution character set, used for string and character
  3425. constants. The default is UTF-8. CHARSET can be any encoding
  3426. supported by the system's 'iconv' library routine.
  3427. '-fwide-exec-charset=CHARSET'
  3428. Set the wide execution character set, used for wide string and
  3429. character constants. The default is UTF-32 or UTF-16, whichever
  3430. corresponds to the width of 'wchar_t'. As with '-fexec-charset',
  3431. CHARSET can be any encoding supported by the system's 'iconv'
  3432. library routine; however, you will have problems with encodings
  3433. that do not fit exactly in 'wchar_t'.
  3434. '-finput-charset=CHARSET'
  3435. Set the input character set, used for translation from the
  3436. character set of the input file to the source character set used by
  3437. GCC. If the locale does not specify, or GCC cannot get this
  3438. information from the locale, the default is UTF-8. This can be
  3439. overridden by either the locale or this command-line option.
  3440. Currently the command-line option takes precedence if there's a
  3441. conflict. CHARSET can be any encoding supported by the system's
  3442. 'iconv' library routine.
  3443. '-fworking-directory'
  3444. Enable generation of linemarkers in the preprocessor output that
  3445. let the compiler know the current working directory at the time of
  3446. preprocessing. When this option is enabled, the preprocessor
  3447. emits, after the initial linemarker, a second linemarker with the
  3448. current working directory followed by two slashes. GCC uses this
  3449. directory, when it's present in the preprocessed input, as the
  3450. directory emitted as the current working directory in some
  3451. debugging information formats. This option is implicitly enabled
  3452. if debugging information is enabled, but this can be inhibited with
  3453. the negated form '-fno-working-directory'. If the '-P' flag is
  3454. present in the command line, this option has no effect, since no
  3455. '#line' directives are emitted whatsoever.
  3456. '-A PREDICATE=ANSWER'
  3457. Make an assertion with the predicate PREDICATE and answer ANSWER.
  3458. This form is preferred to the older form '-A PREDICATE(ANSWER)',
  3459. which is still supported, because it does not use shell special
  3460. characters. *Note Obsolete Features::.
  3461. '-A -PREDICATE=ANSWER'
  3462. Cancel an assertion with the predicate PREDICATE and answer ANSWER.
  3463. '-C'
  3464. Do not discard comments. All comments are passed through to the
  3465. output file, except for comments in processed directives, which are
  3466. deleted along with the directive.
  3467. You should be prepared for side effects when using '-C'; it causes
  3468. the preprocessor to treat comments as tokens in their own right.
  3469. For example, comments appearing at the start of what would be a
  3470. directive line have the effect of turning that line into an
  3471. ordinary source line, since the first token on the line is no
  3472. longer a '#'.
  3473. '-CC'
  3474. Do not discard comments, including during macro expansion. This is
  3475. like '-C', except that comments contained within macros are also
  3476. passed through to the output file where the macro is expanded.
  3477. In addition to the side effects of the '-C' option, the '-CC'
  3478. option causes all C++-style comments inside a macro to be converted
  3479. to C-style comments. This is to prevent later use of that macro
  3480. from inadvertently commenting out the remainder of the source line.
  3481. The '-CC' option is generally used to support lint comments.
  3482. '-P'
  3483. Inhibit generation of linemarkers in the output from the
  3484. preprocessor. This might be useful when running the preprocessor
  3485. on something that is not C code, and will be sent to a program
  3486. which might be confused by the linemarkers. *Note Preprocessor
  3487. Output::.
  3488. '-traditional'
  3489. '-traditional-cpp'
  3490. Try to imitate the behavior of pre-standard C preprocessors, as
  3491. opposed to ISO C preprocessors. *Note Traditional Mode::.
  3492. Note that GCC does not otherwise attempt to emulate a pre-standard
  3493. C compiler, and these options are only supported with the '-E'
  3494. switch, or when invoking CPP explicitly.
  3495. '-trigraphs'
  3496. Support ISO C trigraphs. These are three-character sequences, all
  3497. starting with '??', that are defined by ISO C to stand for single
  3498. characters. For example, '??/' stands for '\', so ''??/n'' is a
  3499. character constant for a newline. *Note Initial processing::.
  3500. By default, GCC ignores trigraphs, but in standard-conforming modes
  3501. it converts them. See the '-std' and '-ansi' options.
  3502. '-remap'
  3503. Enable special code to work around file systems which only permit
  3504. very short file names, such as MS-DOS.
  3505. '-H'
  3506. Print the name of each header file used, in addition to other
  3507. normal activities. Each name is indented to show how deep in the
  3508. '#include' stack it is. Precompiled header files are also printed,
  3509. even if they are found to be invalid; an invalid precompiled header
  3510. file is printed with '...x' and a valid one with '...!' .
  3511. '-dLETTERS'
  3512. Says to make debugging dumps during compilation as specified by
  3513. LETTERS. The flags documented here are those relevant to the
  3514. preprocessor. Other LETTERS are interpreted by the compiler
  3515. proper, or reserved for future versions of GCC, and so are silently
  3516. ignored. If you specify LETTERS whose behavior conflicts, the
  3517. result is undefined.
  3518. '-dM'
  3519. Instead of the normal output, generate a list of '#define'
  3520. directives for all the macros defined during the execution of
  3521. the preprocessor, including predefined macros. This gives you
  3522. a way of finding out what is predefined in your version of the
  3523. preprocessor. Assuming you have no file 'foo.h', the command
  3524. touch foo.h; cpp -dM foo.h
  3525. shows all the predefined macros.
  3526. '-dD'
  3527. Like '-dM' except in two respects: it does _not_ include the
  3528. predefined macros, and it outputs _both_ the '#define'
  3529. directives and the result of preprocessing. Both kinds of
  3530. output go to the standard output file.
  3531. '-dN'
  3532. Like '-dD', but emit only the macro names, not their
  3533. expansions.
  3534. '-dI'
  3535. Output '#include' directives in addition to the result of
  3536. preprocessing.
  3537. '-dU'
  3538. Like '-dD' except that only macros that are expanded, or whose
  3539. definedness is tested in preprocessor directives, are output;
  3540. the output is delayed until the use or test of the macro; and
  3541. '#undef' directives are also output for macros tested but
  3542. undefined at the time.
  3543. '-fdebug-cpp'
  3544. This option is only useful for debugging GCC. When used from CPP or
  3545. with '-E', it dumps debugging information about location maps.
  3546. Every token in the output is preceded by the dump of the map its
  3547. location belongs to.
  3548. When used from GCC without '-E', this option has no effect.
  3549. '-I DIR'
  3550. '-iquote DIR'
  3551. '-isystem DIR'
  3552. '-idirafter DIR'
  3553. Add the directory DIR to the list of directories to be searched for
  3554. header files during preprocessing. *Note Search Path::. If DIR
  3555. begins with '=' or '$SYSROOT', then the '=' or '$SYSROOT' is
  3556. replaced by the sysroot prefix; see '--sysroot' and '-isysroot'.
  3557. Directories specified with '-iquote' apply only to the quote form
  3558. of the directive, '#include "FILE"'. Directories specified with
  3559. '-I', '-isystem', or '-idirafter' apply to lookup for both the
  3560. '#include "FILE"' and '#include <FILE>' directives.
  3561. You can specify any number or combination of these options on the
  3562. command line to search for header files in several directories.
  3563. The lookup order is as follows:
  3564. 1. For the quote form of the include directive, the directory of
  3565. the current file is searched first.
  3566. 2. For the quote form of the include directive, the directories
  3567. specified by '-iquote' options are searched in left-to-right
  3568. order, as they appear on the command line.
  3569. 3. Directories specified with '-I' options are scanned in
  3570. left-to-right order.
  3571. 4. Directories specified with '-isystem' options are scanned in
  3572. left-to-right order.
  3573. 5. Standard system directories are scanned.
  3574. 6. Directories specified with '-idirafter' options are scanned in
  3575. left-to-right order.
  3576. You can use '-I' to override a system header file, substituting
  3577. your own version, since these directories are searched before the
  3578. standard system header file directories. However, you should not
  3579. use this option to add directories that contain vendor-supplied
  3580. system header files; use '-isystem' for that.
  3581. The '-isystem' and '-idirafter' options also mark the directory as
  3582. a system directory, so that it gets the same special treatment that
  3583. is applied to the standard system directories. *Note System
  3584. Headers::.
  3585. If a standard system include directory, or a directory specified
  3586. with '-isystem', is also specified with '-I', the '-I' option is
  3587. ignored. The directory is still searched but as a system directory
  3588. at its normal position in the system include chain. This is to
  3589. ensure that GCC's procedure to fix buggy system headers and the
  3590. ordering for the '#include_next' directive are not inadvertently
  3591. changed. If you really need to change the search order for system
  3592. directories, use the '-nostdinc' and/or '-isystem' options. *Note
  3593. System Headers::.
  3594. '-I-'
  3595. Split the include path. This option has been deprecated. Please
  3596. use '-iquote' instead for '-I' directories before the '-I-' and
  3597. remove the '-I-' option.
  3598. Any directories specified with '-I' options before '-I-' are
  3599. searched only for headers requested with '#include "FILE"'; they
  3600. are not searched for '#include <FILE>'. If additional directories
  3601. are specified with '-I' options after the '-I-', those directories
  3602. are searched for all '#include' directives.
  3603. In addition, '-I-' inhibits the use of the directory of the current
  3604. file directory as the first search directory for '#include "FILE"'.
  3605. There is no way to override this effect of '-I-'. *Note Search
  3606. Path::.
  3607. '-iprefix PREFIX'
  3608. Specify PREFIX as the prefix for subsequent '-iwithprefix' options.
  3609. If the prefix represents a directory, you should include the final
  3610. '/'.
  3611. '-iwithprefix DIR'
  3612. '-iwithprefixbefore DIR'
  3613. Append DIR to the prefix specified previously with '-iprefix', and
  3614. add the resulting directory to the include search path.
  3615. '-iwithprefixbefore' puts it in the same place '-I' would;
  3616. '-iwithprefix' puts it where '-idirafter' would.
  3617. '-isysroot DIR'
  3618. This option is like the '--sysroot' option, but applies only to
  3619. header files (except for Darwin targets, where it applies to both
  3620. header files and libraries). See the '--sysroot' option for more
  3621. information.
  3622. '-imultilib DIR'
  3623. Use DIR as a subdirectory of the directory containing
  3624. target-specific C++ headers.
  3625. '-nostdinc'
  3626. Do not search the standard system directories for header files.
  3627. Only the directories explicitly specified with '-I', '-iquote',
  3628. '-isystem', and/or '-idirafter' options (and the directory of the
  3629. current file, if appropriate) are searched.
  3630. '-nostdinc++'
  3631. Do not search for header files in the C++-specific standard
  3632. directories, but do still search the other standard directories.
  3633. (This option is used when building the C++ library.)
  3634. '-Wcomment'
  3635. '-Wcomments'
  3636. Warn whenever a comment-start sequence '/*' appears in a '/*'
  3637. comment, or whenever a backslash-newline appears in a '//' comment.
  3638. This warning is enabled by '-Wall'.
  3639. '-Wtrigraphs'
  3640. Warn if any trigraphs are encountered that might change the meaning
  3641. of the program. Trigraphs within comments are not warned about,
  3642. except those that would form escaped newlines.
  3643. This option is implied by '-Wall'. If '-Wall' is not given, this
  3644. option is still enabled unless trigraphs are enabled. To get
  3645. trigraph conversion without warnings, but get the other '-Wall'
  3646. warnings, use '-trigraphs -Wall -Wno-trigraphs'.
  3647. '-Wundef'
  3648. Warn if an undefined identifier is evaluated in an '#if' directive.
  3649. Such identifiers are replaced with zero.
  3650. '-Wexpansion-to-defined'
  3651. Warn whenever 'defined' is encountered in the expansion of a macro
  3652. (including the case where the macro is expanded by an '#if'
  3653. directive). Such usage is not portable. This warning is also
  3654. enabled by '-Wpedantic' and '-Wextra'.
  3655. '-Wunused-macros'
  3656. Warn about macros defined in the main file that are unused. A
  3657. macro is "used" if it is expanded or tested for existence at least
  3658. once. The preprocessor also warns if the macro has not been used
  3659. at the time it is redefined or undefined.
  3660. Built-in macros, macros defined on the command line, and macros
  3661. defined in include files are not warned about.
  3662. _Note:_ If a macro is actually used, but only used in skipped
  3663. conditional blocks, then the preprocessor reports it as unused. To
  3664. avoid the warning in such a case, you might improve the scope of
  3665. the macro's definition by, for example, moving it into the first
  3666. skipped block. Alternatively, you could provide a dummy use with
  3667. something like:
  3668. #if defined the_macro_causing_the_warning
  3669. #endif
  3670. '-Wno-endif-labels'
  3671. Do not warn whenever an '#else' or an '#endif' are followed by
  3672. text. This sometimes happens in older programs with code of the
  3673. form
  3674. #if FOO
  3675. ...
  3676. #else FOO
  3677. ...
  3678. #endif FOO
  3679. The second and third 'FOO' should be in comments. This warning is
  3680. on by default.
  3681. 
  3682. File: cpp.info, Node: Environment Variables, Next: GNU Free Documentation License, Prev: Invocation, Up: Top
  3683. 13 Environment Variables
  3684. ************************
  3685. This section describes the environment variables that affect how CPP
  3686. operates. You can use them to specify directories or prefixes to use
  3687. when searching for include files, or to control dependency output.
  3688. Note that you can also specify places to search using options such as
  3689. '-I', and control dependency output with options like '-M' (*note
  3690. Invocation::). These take precedence over environment variables, which
  3691. in turn take precedence over the configuration of GCC.
  3692. 'CPATH'
  3693. 'C_INCLUDE_PATH'
  3694. 'CPLUS_INCLUDE_PATH'
  3695. 'OBJC_INCLUDE_PATH'
  3696. Each variable's value is a list of directories separated by a
  3697. special character, much like 'PATH', in which to look for header
  3698. files. The special character, 'PATH_SEPARATOR', is
  3699. target-dependent and determined at GCC build time. For Microsoft
  3700. Windows-based targets it is a semicolon, and for almost all other
  3701. targets it is a colon.
  3702. 'CPATH' specifies a list of directories to be searched as if
  3703. specified with '-I', but after any paths given with '-I' options on
  3704. the command line. This environment variable is used regardless of
  3705. which language is being preprocessed.
  3706. The remaining environment variables apply only when preprocessing
  3707. the particular language indicated. Each specifies a list of
  3708. directories to be searched as if specified with '-isystem', but
  3709. after any paths given with '-isystem' options on the command line.
  3710. In all these variables, an empty element instructs the compiler to
  3711. search its current working directory. Empty elements can appear at
  3712. the beginning or end of a path. For instance, if the value of
  3713. 'CPATH' is ':/special/include', that has the same effect as
  3714. '-I. -I/special/include'.
  3715. See also *note Search Path::.
  3716. 'DEPENDENCIES_OUTPUT'
  3717. If this variable is set, its value specifies how to output
  3718. dependencies for Make based on the non-system header files
  3719. processed by the compiler. System header files are ignored in the
  3720. dependency output.
  3721. The value of 'DEPENDENCIES_OUTPUT' can be just a file name, in
  3722. which case the Make rules are written to that file, guessing the
  3723. target name from the source file name. Or the value can have the
  3724. form 'FILE TARGET', in which case the rules are written to file
  3725. FILE using TARGET as the target name.
  3726. In other words, this environment variable is equivalent to
  3727. combining the options '-MM' and '-MF' (*note Invocation::), with an
  3728. optional '-MT' switch too.
  3729. 'SUNPRO_DEPENDENCIES'
  3730. This variable is the same as 'DEPENDENCIES_OUTPUT' (see above),
  3731. except that system header files are not ignored, so it implies '-M'
  3732. rather than '-MM'. However, the dependence on the main input file
  3733. is omitted. *Note Invocation::.
  3734. 'SOURCE_DATE_EPOCH'
  3735. If this variable is set, its value specifies a UNIX timestamp to be
  3736. used in replacement of the current date and time in the '__DATE__'
  3737. and '__TIME__' macros, so that the embedded timestamps become
  3738. reproducible.
  3739. The value of 'SOURCE_DATE_EPOCH' must be a UNIX timestamp, defined
  3740. as the number of seconds (excluding leap seconds) since 01 Jan 1970
  3741. 00:00:00 represented in ASCII; identical to the output of 'date
  3742. +%s' on GNU/Linux and other systems that support the '%s' extension
  3743. in the 'date' command.
  3744. The value should be a known timestamp such as the last modification
  3745. time of the source or package and it should be set by the build
  3746. process.
  3747. 
  3748. File: cpp.info, Node: GNU Free Documentation License, Next: Index of Directives, Prev: Environment Variables, Up: Top
  3749. GNU Free Documentation License
  3750. ******************************
  3751. Version 1.3, 3 November 2008
  3752. Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
  3753. <http://fsf.org/>
  3754. Everyone is permitted to copy and distribute verbatim copies
  3755. of this license document, but changing it is not allowed.
  3756. 0. PREAMBLE
  3757. The purpose of this License is to make a manual, textbook, or other
  3758. functional and useful document "free" in the sense of freedom: to
  3759. assure everyone the effective freedom to copy and redistribute it,
  3760. with or without modifying it, either commercially or
  3761. noncommercially. Secondarily, this License preserves for the
  3762. author and publisher a way to get credit for their work, while not
  3763. being considered responsible for modifications made by others.
  3764. This License is a kind of "copyleft", which means that derivative
  3765. works of the document must themselves be free in the same sense.
  3766. It complements the GNU General Public License, which is a copyleft
  3767. license designed for free software.
  3768. We have designed this License in order to use it for manuals for
  3769. free software, because free software needs free documentation: a
  3770. free program should come with manuals providing the same freedoms
  3771. that the software does. But this License is not limited to
  3772. software manuals; it can be used for any textual work, regardless
  3773. of subject matter or whether it is published as a printed book. We
  3774. recommend this License principally for works whose purpose is
  3775. instruction or reference.
  3776. 1. APPLICABILITY AND DEFINITIONS
  3777. This License applies to any manual or other work, in any medium,
  3778. that contains a notice placed by the copyright holder saying it can
  3779. be distributed under the terms of this License. Such a notice
  3780. grants a world-wide, royalty-free license, unlimited in duration,
  3781. to use that work under the conditions stated herein. The
  3782. "Document", below, refers to any such manual or work. Any member
  3783. of the public is a licensee, and is addressed as "you". You accept
  3784. the license if you copy, modify or distribute the work in a way
  3785. requiring permission under copyright law.
  3786. A "Modified Version" of the Document means any work containing the
  3787. Document or a portion of it, either copied verbatim, or with
  3788. modifications and/or translated into another language.
  3789. A "Secondary Section" is a named appendix or a front-matter section
  3790. of the Document that deals exclusively with the relationship of the
  3791. publishers or authors of the Document to the Document's overall
  3792. subject (or to related matters) and contains nothing that could
  3793. fall directly within that overall subject. (Thus, if the Document
  3794. is in part a textbook of mathematics, a Secondary Section may not
  3795. explain any mathematics.) The relationship could be a matter of
  3796. historical connection with the subject or with related matters, or
  3797. of legal, commercial, philosophical, ethical or political position
  3798. regarding them.
  3799. The "Invariant Sections" are certain Secondary Sections whose
  3800. titles are designated, as being those of Invariant Sections, in the
  3801. notice that says that the Document is released under this License.
  3802. If a section does not fit the above definition of Secondary then it
  3803. is not allowed to be designated as Invariant. The Document may
  3804. contain zero Invariant Sections. If the Document does not identify
  3805. any Invariant Sections then there are none.
  3806. The "Cover Texts" are certain short passages of text that are
  3807. listed, as Front-Cover Texts or Back-Cover Texts, in the notice
  3808. that says that the Document is released under this License. A
  3809. Front-Cover Text may be at most 5 words, and a Back-Cover Text may
  3810. be at most 25 words.
  3811. A "Transparent" copy of the Document means a machine-readable copy,
  3812. represented in a format whose specification is available to the
  3813. general public, that is suitable for revising the document
  3814. straightforwardly with generic text editors or (for images composed
  3815. of pixels) generic paint programs or (for drawings) some widely
  3816. available drawing editor, and that is suitable for input to text
  3817. formatters or for automatic translation to a variety of formats
  3818. suitable for input to text formatters. A copy made in an otherwise
  3819. Transparent file format whose markup, or absence of markup, has
  3820. been arranged to thwart or discourage subsequent modification by
  3821. readers is not Transparent. An image format is not Transparent if
  3822. used for any substantial amount of text. A copy that is not
  3823. "Transparent" is called "Opaque".
  3824. Examples of suitable formats for Transparent copies include plain
  3825. ASCII without markup, Texinfo input format, LaTeX input format,
  3826. SGML or XML using a publicly available DTD, and standard-conforming
  3827. simple HTML, PostScript or PDF designed for human modification.
  3828. Examples of transparent image formats include PNG, XCF and JPG.
  3829. Opaque formats include proprietary formats that can be read and
  3830. edited only by proprietary word processors, SGML or XML for which
  3831. the DTD and/or processing tools are not generally available, and
  3832. the machine-generated HTML, PostScript or PDF produced by some word
  3833. processors for output purposes only.
  3834. The "Title Page" means, for a printed book, the title page itself,
  3835. plus such following pages as are needed to hold, legibly, the
  3836. material this License requires to appear in the title page. For
  3837. works in formats which do not have any title page as such, "Title
  3838. Page" means the text near the most prominent appearance of the
  3839. work's title, preceding the beginning of the body of the text.
  3840. The "publisher" means any person or entity that distributes copies
  3841. of the Document to the public.
  3842. A section "Entitled XYZ" means a named subunit of the Document
  3843. whose title either is precisely XYZ or contains XYZ in parentheses
  3844. following text that translates XYZ in another language. (Here XYZ
  3845. stands for a specific section name mentioned below, such as
  3846. "Acknowledgements", "Dedications", "Endorsements", or "History".)
  3847. To "Preserve the Title" of such a section when you modify the
  3848. Document means that it remains a section "Entitled XYZ" according
  3849. to this definition.
  3850. The Document may include Warranty Disclaimers next to the notice
  3851. which states that this License applies to the Document. These
  3852. Warranty Disclaimers are considered to be included by reference in
  3853. this License, but only as regards disclaiming warranties: any other
  3854. implication that these Warranty Disclaimers may have is void and
  3855. has no effect on the meaning of this License.
  3856. 2. VERBATIM COPYING
  3857. You may copy and distribute the Document in any medium, either
  3858. commercially or noncommercially, provided that this License, the
  3859. copyright notices, and the license notice saying this License
  3860. applies to the Document are reproduced in all copies, and that you
  3861. add no other conditions whatsoever to those of this License. You
  3862. may not use technical measures to obstruct or control the reading
  3863. or further copying of the copies you make or distribute. However,
  3864. you may accept compensation in exchange for copies. If you
  3865. distribute a large enough number of copies you must also follow the
  3866. conditions in section 3.
  3867. You may also lend copies, under the same conditions stated above,
  3868. and you may publicly display copies.
  3869. 3. COPYING IN QUANTITY
  3870. If you publish printed copies (or copies in media that commonly
  3871. have printed covers) of the Document, numbering more than 100, and
  3872. the Document's license notice requires Cover Texts, you must
  3873. enclose the copies in covers that carry, clearly and legibly, all
  3874. these Cover Texts: Front-Cover Texts on the front cover, and
  3875. Back-Cover Texts on the back cover. Both covers must also clearly
  3876. and legibly identify you as the publisher of these copies. The
  3877. front cover must present the full title with all words of the title
  3878. equally prominent and visible. You may add other material on the
  3879. covers in addition. Copying with changes limited to the covers, as
  3880. long as they preserve the title of the Document and satisfy these
  3881. conditions, can be treated as verbatim copying in other respects.
  3882. If the required texts for either cover are too voluminous to fit
  3883. legibly, you should put the first ones listed (as many as fit
  3884. reasonably) on the actual cover, and continue the rest onto
  3885. adjacent pages.
  3886. If you publish or distribute Opaque copies of the Document
  3887. numbering more than 100, you must either include a machine-readable
  3888. Transparent copy along with each Opaque copy, or state in or with
  3889. each Opaque copy a computer-network location from which the general
  3890. network-using public has access to download using public-standard
  3891. network protocols a complete Transparent copy of the Document, free
  3892. of added material. If you use the latter option, you must take
  3893. reasonably prudent steps, when you begin distribution of Opaque
  3894. copies in quantity, to ensure that this Transparent copy will
  3895. remain thus accessible at the stated location until at least one
  3896. year after the last time you distribute an Opaque copy (directly or
  3897. through your agents or retailers) of that edition to the public.
  3898. It is requested, but not required, that you contact the authors of
  3899. the Document well before redistributing any large number of copies,
  3900. to give them a chance to provide you with an updated version of the
  3901. Document.
  3902. 4. MODIFICATIONS
  3903. You may copy and distribute a Modified Version of the Document
  3904. under the conditions of sections 2 and 3 above, provided that you
  3905. release the Modified Version under precisely this License, with the
  3906. Modified Version filling the role of the Document, thus licensing
  3907. distribution and modification of the Modified Version to whoever
  3908. possesses a copy of it. In addition, you must do these things in
  3909. the Modified Version:
  3910. A. Use in the Title Page (and on the covers, if any) a title
  3911. distinct from that of the Document, and from those of previous
  3912. versions (which should, if there were any, be listed in the
  3913. History section of the Document). You may use the same title
  3914. as a previous version if the original publisher of that
  3915. version gives permission.
  3916. B. List on the Title Page, as authors, one or more persons or
  3917. entities responsible for authorship of the modifications in
  3918. the Modified Version, together with at least five of the
  3919. principal authors of the Document (all of its principal
  3920. authors, if it has fewer than five), unless they release you
  3921. from this requirement.
  3922. C. State on the Title page the name of the publisher of the
  3923. Modified Version, as the publisher.
  3924. D. Preserve all the copyright notices of the Document.
  3925. E. Add an appropriate copyright notice for your modifications
  3926. adjacent to the other copyright notices.
  3927. F. Include, immediately after the copyright notices, a license
  3928. notice giving the public permission to use the Modified
  3929. Version under the terms of this License, in the form shown in
  3930. the Addendum below.
  3931. G. Preserve in that license notice the full lists of Invariant
  3932. Sections and required Cover Texts given in the Document's
  3933. license notice.
  3934. H. Include an unaltered copy of this License.
  3935. I. Preserve the section Entitled "History", Preserve its Title,
  3936. and add to it an item stating at least the title, year, new
  3937. authors, and publisher of the Modified Version as given on the
  3938. Title Page. If there is no section Entitled "History" in the
  3939. Document, create one stating the title, year, authors, and
  3940. publisher of the Document as given on its Title Page, then add
  3941. an item describing the Modified Version as stated in the
  3942. previous sentence.
  3943. J. Preserve the network location, if any, given in the Document
  3944. for public access to a Transparent copy of the Document, and
  3945. likewise the network locations given in the Document for
  3946. previous versions it was based on. These may be placed in the
  3947. "History" section. You may omit a network location for a work
  3948. that was published at least four years before the Document
  3949. itself, or if the original publisher of the version it refers
  3950. to gives permission.
  3951. K. For any section Entitled "Acknowledgements" or "Dedications",
  3952. Preserve the Title of the section, and preserve in the section
  3953. all the substance and tone of each of the contributor
  3954. acknowledgements and/or dedications given therein.
  3955. L. Preserve all the Invariant Sections of the Document, unaltered
  3956. in their text and in their titles. Section numbers or the
  3957. equivalent are not considered part of the section titles.
  3958. M. Delete any section Entitled "Endorsements". Such a section
  3959. may not be included in the Modified Version.
  3960. N. Do not retitle any existing section to be Entitled
  3961. "Endorsements" or to conflict in title with any Invariant
  3962. Section.
  3963. O. Preserve any Warranty Disclaimers.
  3964. If the Modified Version includes new front-matter sections or
  3965. appendices that qualify as Secondary Sections and contain no
  3966. material copied from the Document, you may at your option designate
  3967. some or all of these sections as invariant. To do this, add their
  3968. titles to the list of Invariant Sections in the Modified Version's
  3969. license notice. These titles must be distinct from any other
  3970. section titles.
  3971. You may add a section Entitled "Endorsements", provided it contains
  3972. nothing but endorsements of your Modified Version by various
  3973. parties--for example, statements of peer review or that the text
  3974. has been approved by an organization as the authoritative
  3975. definition of a standard.
  3976. You may add a passage of up to five words as a Front-Cover Text,
  3977. and a passage of up to 25 words as a Back-Cover Text, to the end of
  3978. the list of Cover Texts in the Modified Version. Only one passage
  3979. of Front-Cover Text and one of Back-Cover Text may be added by (or
  3980. through arrangements made by) any one entity. If the Document
  3981. already includes a cover text for the same cover, previously added
  3982. by you or by arrangement made by the same entity you are acting on
  3983. behalf of, you may not add another; but you may replace the old
  3984. one, on explicit permission from the previous publisher that added
  3985. the old one.
  3986. The author(s) and publisher(s) of the Document do not by this
  3987. License give permission to use their names for publicity for or to
  3988. assert or imply endorsement of any Modified Version.
  3989. 5. COMBINING DOCUMENTS
  3990. You may combine the Document with other documents released under
  3991. this License, under the terms defined in section 4 above for
  3992. modified versions, provided that you include in the combination all
  3993. of the Invariant Sections of all of the original documents,
  3994. unmodified, and list them all as Invariant Sections of your
  3995. combined work in its license notice, and that you preserve all
  3996. their Warranty Disclaimers.
  3997. The combined work need only contain one copy of this License, and
  3998. multiple identical Invariant Sections may be replaced with a single
  3999. copy. If there are multiple Invariant Sections with the same name
  4000. but different contents, make the title of each such section unique
  4001. by adding at the end of it, in parentheses, the name of the
  4002. original author or publisher of that section if known, or else a
  4003. unique number. Make the same adjustment to the section titles in
  4004. the list of Invariant Sections in the license notice of the
  4005. combined work.
  4006. In the combination, you must combine any sections Entitled
  4007. "History" in the various original documents, forming one section
  4008. Entitled "History"; likewise combine any sections Entitled
  4009. "Acknowledgements", and any sections Entitled "Dedications". You
  4010. must delete all sections Entitled "Endorsements."
  4011. 6. COLLECTIONS OF DOCUMENTS
  4012. You may make a collection consisting of the Document and other
  4013. documents released under this License, and replace the individual
  4014. copies of this License in the various documents with a single copy
  4015. that is included in the collection, provided that you follow the
  4016. rules of this License for verbatim copying of each of the documents
  4017. in all other respects.
  4018. You may extract a single document from such a collection, and
  4019. distribute it individually under this License, provided you insert
  4020. a copy of this License into the extracted document, and follow this
  4021. License in all other respects regarding verbatim copying of that
  4022. document.
  4023. 7. AGGREGATION WITH INDEPENDENT WORKS
  4024. A compilation of the Document or its derivatives with other
  4025. separate and independent documents or works, in or on a volume of a
  4026. storage or distribution medium, is called an "aggregate" if the
  4027. copyright resulting from the compilation is not used to limit the
  4028. legal rights of the compilation's users beyond what the individual
  4029. works permit. When the Document is included in an aggregate, this
  4030. License does not apply to the other works in the aggregate which
  4031. are not themselves derivative works of the Document.
  4032. If the Cover Text requirement of section 3 is applicable to these
  4033. copies of the Document, then if the Document is less than one half
  4034. of the entire aggregate, the Document's Cover Texts may be placed
  4035. on covers that bracket the Document within the aggregate, or the
  4036. electronic equivalent of covers if the Document is in electronic
  4037. form. Otherwise they must appear on printed covers that bracket
  4038. the whole aggregate.
  4039. 8. TRANSLATION
  4040. Translation is considered a kind of modification, so you may
  4041. distribute translations of the Document under the terms of section
  4042. 4. Replacing Invariant Sections with translations requires special
  4043. permission from their copyright holders, but you may include
  4044. translations of some or all Invariant Sections in addition to the
  4045. original versions of these Invariant Sections. You may include a
  4046. translation of this License, and all the license notices in the
  4047. Document, and any Warranty Disclaimers, provided that you also
  4048. include the original English version of this License and the
  4049. original versions of those notices and disclaimers. In case of a
  4050. disagreement between the translation and the original version of
  4051. this License or a notice or disclaimer, the original version will
  4052. prevail.
  4053. If a section in the Document is Entitled "Acknowledgements",
  4054. "Dedications", or "History", the requirement (section 4) to
  4055. Preserve its Title (section 1) will typically require changing the
  4056. actual title.
  4057. 9. TERMINATION
  4058. You may not copy, modify, sublicense, or distribute the Document
  4059. except as expressly provided under this License. Any attempt
  4060. otherwise to copy, modify, sublicense, or distribute it is void,
  4061. and will automatically terminate your rights under this License.
  4062. However, if you cease all violation of this License, then your
  4063. license from a particular copyright holder is reinstated (a)
  4064. provisionally, unless and until the copyright holder explicitly and
  4065. finally terminates your license, and (b) permanently, if the
  4066. copyright holder fails to notify you of the violation by some
  4067. reasonable means prior to 60 days after the cessation.
  4068. Moreover, your license from a particular copyright holder is
  4069. reinstated permanently if the copyright holder notifies you of the
  4070. violation by some reasonable means, this is the first time you have
  4071. received notice of violation of this License (for any work) from
  4072. that copyright holder, and you cure the violation prior to 30 days
  4073. after your receipt of the notice.
  4074. Termination of your rights under this section does not terminate
  4075. the licenses of parties who have received copies or rights from you
  4076. under this License. If your rights have been terminated and not
  4077. permanently reinstated, receipt of a copy of some or all of the
  4078. same material does not give you any rights to use it.
  4079. 10. FUTURE REVISIONS OF THIS LICENSE
  4080. The Free Software Foundation may publish new, revised versions of
  4081. the GNU Free Documentation License from time to time. Such new
  4082. versions will be similar in spirit to the present version, but may
  4083. differ in detail to address new problems or concerns. See
  4084. <http://www.gnu.org/copyleft/>.
  4085. Each version of the License is given a distinguishing version
  4086. number. If the Document specifies that a particular numbered
  4087. version of this License "or any later version" applies to it, you
  4088. have the option of following the terms and conditions either of
  4089. that specified version or of any later version that has been
  4090. published (not as a draft) by the Free Software Foundation. If the
  4091. Document does not specify a version number of this License, you may
  4092. choose any version ever published (not as a draft) by the Free
  4093. Software Foundation. If the Document specifies that a proxy can
  4094. decide which future versions of this License can be used, that
  4095. proxy's public statement of acceptance of a version permanently
  4096. authorizes you to choose that version for the Document.
  4097. 11. RELICENSING
  4098. "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
  4099. World Wide Web server that publishes copyrightable works and also
  4100. provides prominent facilities for anybody to edit those works. A
  4101. public wiki that anybody can edit is an example of such a server.
  4102. A "Massive Multiauthor Collaboration" (or "MMC") contained in the
  4103. site means any set of copyrightable works thus published on the MMC
  4104. site.
  4105. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
  4106. license published by Creative Commons Corporation, a not-for-profit
  4107. corporation with a principal place of business in San Francisco,
  4108. California, as well as future copyleft versions of that license
  4109. published by that same organization.
  4110. "Incorporate" means to publish or republish a Document, in whole or
  4111. in part, as part of another Document.
  4112. An MMC is "eligible for relicensing" if it is licensed under this
  4113. License, and if all works that were first published under this
  4114. License somewhere other than this MMC, and subsequently
  4115. incorporated in whole or in part into the MMC, (1) had no cover
  4116. texts or invariant sections, and (2) were thus incorporated prior
  4117. to November 1, 2008.
  4118. The operator of an MMC Site may republish an MMC contained in the
  4119. site under CC-BY-SA on the same site at any time before August 1,
  4120. 2009, provided the MMC is eligible for relicensing.
  4121. ADDENDUM: How to use this License for your documents
  4122. ====================================================
  4123. To use this License in a document you have written, include a copy of
  4124. the License in the document and put the following copyright and license
  4125. notices just after the title page:
  4126. Copyright (C) YEAR YOUR NAME.
  4127. Permission is granted to copy, distribute and/or modify this document
  4128. under the terms of the GNU Free Documentation License, Version 1.3
  4129. or any later version published by the Free Software Foundation;
  4130. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
  4131. Texts. A copy of the license is included in the section entitled ``GNU
  4132. Free Documentation License''.
  4133. If you have Invariant Sections, Front-Cover Texts and Back-Cover
  4134. Texts, replace the "with...Texts." line with this:
  4135. with the Invariant Sections being LIST THEIR TITLES, with
  4136. the Front-Cover Texts being LIST, and with the Back-Cover Texts
  4137. being LIST.
  4138. If you have Invariant Sections without Cover Texts, or some other
  4139. combination of the three, merge those two alternatives to suit the
  4140. situation.
  4141. If your document contains nontrivial examples of program code, we
  4142. recommend releasing these examples in parallel under your choice of free
  4143. software license, such as the GNU General Public License, to permit
  4144. their use in free software.
  4145. 
  4146. File: cpp.info, Node: Index of Directives, Next: Option Index, Prev: GNU Free Documentation License, Up: Top
  4147. Index of Directives
  4148. *******************
  4149. �[index�]
  4150. * Menu:
  4151. * #assert: Obsolete Features. (line 48)
  4152. * #define: Object-like Macros. (line 11)
  4153. * #elif: Elif. (line 6)
  4154. * #else: Else. (line 6)
  4155. * #endif: Ifdef. (line 6)
  4156. * #error: Diagnostics. (line 6)
  4157. * #ident: Other Directives. (line 6)
  4158. * #if: Conditional Syntax. (line 6)
  4159. * #ifdef: Ifdef. (line 6)
  4160. * #ifndef: Ifdef. (line 40)
  4161. * #import: Alternatives to Wrapper #ifndef.
  4162. (line 11)
  4163. * #include: Include Syntax. (line 6)
  4164. * #include_next: Wrapper Headers. (line 6)
  4165. * #line: Line Control. (line 20)
  4166. * #pragma GCC dependency: Pragmas. (line 43)
  4167. * #pragma GCC error: Pragmas. (line 88)
  4168. * #pragma GCC poison: Pragmas. (line 55)
  4169. * #pragma GCC system_header: System Headers. (line 25)
  4170. * #pragma GCC system_header <1>: Pragmas. (line 82)
  4171. * #pragma GCC warning: Pragmas. (line 87)
  4172. * #pragma once: Pragmas. (line 96)
  4173. * #sccs: Other Directives. (line 6)
  4174. * #unassert: Obsolete Features. (line 59)
  4175. * #undef: Undefining and Redefining Macros.
  4176. (line 6)
  4177. * #warning: Diagnostics. (line 27)
  4178. 
  4179. File: cpp.info, Node: Option Index, Next: Concept Index, Prev: Index of Directives, Up: Top
  4180. Option Index
  4181. ************
  4182. CPP's command-line options and environment variables are indexed here
  4183. without any initial '-' or '--'.
  4184. �[index�]
  4185. * Menu:
  4186. * A: Invocation. (line 335)
  4187. * C: Invocation. (line 344)
  4188. * CC: Invocation. (line 356)
  4189. * CPATH: Environment Variables.
  4190. (line 15)
  4191. * CPLUS_INCLUDE_PATH: Environment Variables.
  4192. (line 17)
  4193. * C_INCLUDE_PATH: Environment Variables.
  4194. (line 16)
  4195. * D: Invocation. (line 43)
  4196. * d: Invocation. (line 405)
  4197. * dD: Invocation. (line 424)
  4198. * DEPENDENCIES_OUTPUT: Environment Variables.
  4199. (line 44)
  4200. * dI: Invocation. (line 434)
  4201. * dM: Invocation. (line 413)
  4202. * dN: Invocation. (line 430)
  4203. * dU: Invocation. (line 438)
  4204. * fdebug-cpp: Invocation. (line 445)
  4205. * fdirectives-only: Invocation. (line 230)
  4206. * fdollars-in-identifiers: Invocation. (line 251)
  4207. * fexec-charset: Invocation. (line 298)
  4208. * fextended-identifiers: Invocation. (line 254)
  4209. * finput-charset: Invocation. (line 311)
  4210. * fmacro-prefix-map: Invocation. (line 289)
  4211. * fmax-include-depth: Invocation. (line 263)
  4212. * fno-canonical-system-headers: Invocation. (line 259)
  4213. * fno-working-directory: Invocation. (line 321)
  4214. * fpreprocessed: Invocation. (line 217)
  4215. * ftabstop: Invocation. (line 266)
  4216. * ftrack-macro-expansion: Invocation. (line 272)
  4217. * fwide-exec-charset: Invocation. (line 303)
  4218. * fworking-directory: Invocation. (line 321)
  4219. * H: Invocation. (line 398)
  4220. * I: Invocation. (line 456)
  4221. * I-: Invocation. (line 510)
  4222. * idirafter: Invocation. (line 456)
  4223. * imacros: Invocation. (line 81)
  4224. * imultilib: Invocation. (line 544)
  4225. * include: Invocation. (line 70)
  4226. * iprefix: Invocation. (line 526)
  4227. * iquote: Invocation. (line 456)
  4228. * isysroot: Invocation. (line 538)
  4229. * isystem: Invocation. (line 456)
  4230. * iwithprefix: Invocation. (line 532)
  4231. * iwithprefixbefore: Invocation. (line 532)
  4232. * M: Invocation. (line 102)
  4233. * MD: Invocation. (line 197)
  4234. * MF: Invocation. (line 136)
  4235. * MG: Invocation. (line 147)
  4236. * MM: Invocation. (line 127)
  4237. * MMD: Invocation. (line 213)
  4238. * Mno-modules: Invocation. (line 157)
  4239. * MP: Invocation. (line 160)
  4240. * MQ: Invocation. (line 187)
  4241. * MT: Invocation. (line 172)
  4242. * nostdinc: Invocation. (line 548)
  4243. * nostdinc++: Invocation. (line 554)
  4244. * OBJC_INCLUDE_PATH: Environment Variables.
  4245. (line 18)
  4246. * P: Invocation. (line 368)
  4247. * pthread: Invocation. (line 95)
  4248. * remap: Invocation. (line 394)
  4249. * SOURCE_DATE_EPOCH: Environment Variables.
  4250. (line 66)
  4251. * SUNPRO_DEPENDENCIES: Environment Variables.
  4252. (line 60)
  4253. * traditional: Invocation. (line 376)
  4254. * traditional-cpp: Invocation. (line 376)
  4255. * trigraphs: Invocation. (line 385)
  4256. * U: Invocation. (line 66)
  4257. * undef: Invocation. (line 90)
  4258. * Wcomment: Invocation. (line 560)
  4259. * Wcomments: Invocation. (line 560)
  4260. * Wendif-labels: Invocation. (line 604)
  4261. * Wexpansion-to-defined: Invocation. (line 579)
  4262. * Wno-endif-labels: Invocation. (line 604)
  4263. * Wno-undef: Invocation. (line 575)
  4264. * Wtrigraphs: Invocation. (line 565)
  4265. * Wundef: Invocation. (line 575)
  4266. * Wunused-macros: Invocation. (line 585)
  4267. 
  4268. File: cpp.info, Node: Concept Index, Prev: Option Index, Up: Top
  4269. Concept Index
  4270. *************
  4271. �[index�]
  4272. * Menu:
  4273. * # operator: Stringizing. (line 6)
  4274. * ## operator: Concatenation. (line 6)
  4275. * _Pragma: Pragmas. (line 13)
  4276. * __has_attribute: __has_attribute. (line 6)
  4277. * __has_builtin: __has_builtin. (line 6)
  4278. * __has_cpp_attribute: __has_cpp_attribute. (line 6)
  4279. * __has_c_attribute: __has_c_attribute. (line 6)
  4280. * __has_include: __has_include. (line 6)
  4281. * alternative tokens: Tokenization. (line 100)
  4282. * arguments: Macro Arguments. (line 6)
  4283. * arguments in macro definitions: Macro Arguments. (line 6)
  4284. * assertions: Obsolete Features. (line 13)
  4285. * assertions, canceling: Obsolete Features. (line 59)
  4286. * backslash-newline: Initial processing. (line 61)
  4287. * block comments: Initial processing. (line 77)
  4288. * C language, traditional: Invocation. (line 374)
  4289. * C++ named operators: C++ Named Operators. (line 6)
  4290. * character constants: Tokenization. (line 81)
  4291. * character set, execution: Invocation. (line 298)
  4292. * character set, input: Invocation. (line 311)
  4293. * character set, wide execution: Invocation. (line 303)
  4294. * command line: Invocation. (line 6)
  4295. * commenting out code: Deleted Code. (line 6)
  4296. * comments: Initial processing. (line 77)
  4297. * common predefined macros: Common Predefined Macros.
  4298. (line 6)
  4299. * computed includes: Computed Includes. (line 6)
  4300. * concatenation: Concatenation. (line 6)
  4301. * conditional group: Ifdef. (line 14)
  4302. * conditionals: Conditionals. (line 6)
  4303. * continued lines: Initial processing. (line 61)
  4304. * controlling macro: Once-Only Headers. (line 35)
  4305. * defined: Defined. (line 6)
  4306. * dependencies for make as output: Environment Variables.
  4307. (line 45)
  4308. * dependencies for make as output <1>: Environment Variables.
  4309. (line 61)
  4310. * dependencies, make: Invocation. (line 102)
  4311. * diagnostic: Diagnostics. (line 6)
  4312. * digraphs: Tokenization. (line 100)
  4313. * directive line: The preprocessing language.
  4314. (line 6)
  4315. * directive name: The preprocessing language.
  4316. (line 6)
  4317. * directives: The preprocessing language.
  4318. (line 6)
  4319. * empty macro arguments: Macro Arguments. (line 66)
  4320. * environment variables: Environment Variables.
  4321. (line 6)
  4322. * expansion of arguments: Argument Prescan. (line 6)
  4323. * FDL, GNU Free Documentation License: GNU Free Documentation License.
  4324. (line 6)
  4325. * function-like macros: Function-like Macros.
  4326. (line 6)
  4327. * grouping options: Invocation. (line 38)
  4328. * guard macro: Once-Only Headers. (line 35)
  4329. * header file: Header Files. (line 6)
  4330. * header file names: Tokenization. (line 81)
  4331. * identifiers: Tokenization. (line 33)
  4332. * implementation limits: Implementation limits.
  4333. (line 6)
  4334. * implementation-defined behavior: Implementation-defined behavior.
  4335. (line 6)
  4336. * including just once: Once-Only Headers. (line 6)
  4337. * invocation: Invocation. (line 6)
  4338. * iso646.h: C++ Named Operators. (line 6)
  4339. * line comments: Initial processing. (line 77)
  4340. * line control: Line Control. (line 6)
  4341. * line endings: Initial processing. (line 14)
  4342. * linemarkers: Preprocessor Output. (line 27)
  4343. * macro argument expansion: Argument Prescan. (line 6)
  4344. * macro arguments and directives: Directives Within Macro Arguments.
  4345. (line 6)
  4346. * macros in include: Computed Includes. (line 6)
  4347. * macros with arguments: Macro Arguments. (line 6)
  4348. * macros with variable arguments: Variadic Macros. (line 6)
  4349. * make: Invocation. (line 102)
  4350. * manifest constants: Object-like Macros. (line 6)
  4351. * named operators: C++ Named Operators. (line 6)
  4352. * newlines in macro arguments: Newlines in Arguments.
  4353. (line 6)
  4354. * null directive: Other Directives. (line 15)
  4355. * numbers: Tokenization. (line 58)
  4356. * object-like macro: Object-like Macros. (line 6)
  4357. * options: Invocation. (line 42)
  4358. * options, grouping: Invocation. (line 38)
  4359. * other tokens: Tokenization. (line 114)
  4360. * output format: Preprocessor Output. (line 12)
  4361. * overriding a header file: Wrapper Headers. (line 6)
  4362. * parentheses in macro bodies: Operator Precedence Problems.
  4363. (line 6)
  4364. * pitfalls of macros: Macro Pitfalls. (line 6)
  4365. * pragma directive: Pragmas. (line 6)
  4366. * predefined macros: Predefined Macros. (line 6)
  4367. * predefined macros, system-specific: System-specific Predefined Macros.
  4368. (line 6)
  4369. * predicates: Obsolete Features. (line 26)
  4370. * preprocessing directives: The preprocessing language.
  4371. (line 6)
  4372. * preprocessing numbers: Tokenization. (line 58)
  4373. * preprocessing tokens: Tokenization. (line 6)
  4374. * prescan of macro arguments: Argument Prescan. (line 6)
  4375. * problems with macros: Macro Pitfalls. (line 6)
  4376. * punctuators: Tokenization. (line 100)
  4377. * redefining macros: Undefining and Redefining Macros.
  4378. (line 6)
  4379. * repeated inclusion: Once-Only Headers. (line 6)
  4380. * reporting errors: Diagnostics. (line 6)
  4381. * reporting warnings: Diagnostics. (line 6)
  4382. * reserved namespace: System-specific Predefined Macros.
  4383. (line 6)
  4384. * self-reference: Self-Referential Macros.
  4385. (line 6)
  4386. * semicolons (after macro calls): Swallowing the Semicolon.
  4387. (line 6)
  4388. * side effects (in macro arguments): Duplication of Side Effects.
  4389. (line 6)
  4390. * standard predefined macros.: Standard Predefined Macros.
  4391. (line 6)
  4392. * string constants: Tokenization. (line 81)
  4393. * string literals: Tokenization. (line 81)
  4394. * stringizing: Stringizing. (line 6)
  4395. * symbolic constants: Object-like Macros. (line 6)
  4396. * system header files: Header Files. (line 13)
  4397. * system header files <1>: System Headers. (line 6)
  4398. * system-specific predefined macros: System-specific Predefined Macros.
  4399. (line 6)
  4400. * testing predicates: Obsolete Features. (line 37)
  4401. * token concatenation: Concatenation. (line 6)
  4402. * token pasting: Concatenation. (line 6)
  4403. * tokens: Tokenization. (line 6)
  4404. * traditional C language: Invocation. (line 374)
  4405. * trigraphs: Initial processing. (line 32)
  4406. * undefining macros: Undefining and Redefining Macros.
  4407. (line 6)
  4408. * unsafe macros: Duplication of Side Effects.
  4409. (line 6)
  4410. * variable number of arguments: Variadic Macros. (line 6)
  4411. * variadic macros: Variadic Macros. (line 6)
  4412. * wrapper #ifndef: Once-Only Headers. (line 6)
  4413. * wrapper headers: Wrapper Headers. (line 6)
  4414. 
  4415. Tag Table:
  4416. Node: Top945
  4417. Node: Overview3506
  4418. Node: Character sets6344
  4419. Ref: Character sets-Footnote-18516
  4420. Node: Initial processing8697
  4421. Ref: trigraphs10256
  4422. Node: Tokenization14456
  4423. Ref: Tokenization-Footnote-121286
  4424. Node: The preprocessing language21397
  4425. Node: Header Files24276
  4426. Node: Include Syntax26192
  4427. Node: Include Operation27829
  4428. Node: Search Path29677
  4429. Node: Once-Only Headers31899
  4430. Node: Alternatives to Wrapper #ifndef33558
  4431. Node: Computed Includes35207
  4432. Node: Wrapper Headers38365
  4433. Node: System Headers40788
  4434. Node: Macros42389
  4435. Node: Object-like Macros43526
  4436. Node: Function-like Macros47116
  4437. Node: Macro Arguments48732
  4438. Node: Stringizing52871
  4439. Node: Concatenation56032
  4440. Node: Variadic Macros59129
  4441. Node: Predefined Macros64081
  4442. Node: Standard Predefined Macros64669
  4443. Node: Common Predefined Macros71043
  4444. Node: System-specific Predefined Macros92603
  4445. Node: C++ Named Operators94626
  4446. Node: Undefining and Redefining Macros95590
  4447. Node: Directives Within Macro Arguments97688
  4448. Node: Macro Pitfalls98629
  4449. Node: Misnesting99162
  4450. Node: Operator Precedence Problems100274
  4451. Node: Swallowing the Semicolon102140
  4452. Node: Duplication of Side Effects104163
  4453. Node: Self-Referential Macros106346
  4454. Node: Argument Prescan108755
  4455. Node: Newlines in Arguments112506
  4456. Node: Conditionals113457
  4457. Node: Conditional Uses115153
  4458. Node: Conditional Syntax116511
  4459. Node: Ifdef116933
  4460. Node: If120090
  4461. Node: Defined122394
  4462. Node: Else123787
  4463. Node: Elif124357
  4464. Node: __has_attribute125670
  4465. Node: __has_cpp_attribute127264
  4466. Node: __has_c_attribute128154
  4467. Node: __has_builtin128927
  4468. Node: __has_include130060
  4469. Node: Deleted Code131649
  4470. Node: Diagnostics132896
  4471. Node: Line Control134445
  4472. Node: Pragmas136723
  4473. Node: Other Directives141120
  4474. Node: Preprocessor Output142170
  4475. Node: Traditional Mode145323
  4476. Node: Traditional lexical analysis146460
  4477. Node: Traditional macros148963
  4478. Node: Traditional miscellany152760
  4479. Node: Traditional warnings153756
  4480. Node: Implementation Details155953
  4481. Node: Implementation-defined behavior156516
  4482. Ref: Identifier characters157266
  4483. Node: Implementation limits160314
  4484. Node: Obsolete Features162987
  4485. Node: Invocation165831
  4486. Ref: dashMF171866
  4487. Ref: fdollars-in-identifiers176528
  4488. Ref: Wtrigraphs190654
  4489. Node: Environment Variables192709
  4490. Node: GNU Free Documentation License196400
  4491. Node: Index of Directives221545
  4492. Node: Option Index223698
  4493. Node: Concept Index229800
  4494. 
  4495. End Tag Table
  4496. 
  4497. Local Variables:
  4498. coding: utf-8
  4499. End: