No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

hace 3 años
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558
  1. This is cpp.info, produced by makeinfo version 6.5 from cpp.texi.
  2. Copyright (C) 1987-2020 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-2020 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, or an
  1339. unspecified value strictly larger than '201703L' for the
  1340. experimental languages enabled by '-std=c++2a' and '-std=gnu++2a'.
  1341. '__OBJC__'
  1342. This macro is defined, with value 1, when the Objective-C compiler
  1343. is in use. You can use '__OBJC__' to test whether a header is
  1344. compiled by a C compiler or an Objective-C compiler.
  1345. '__ASSEMBLER__'
  1346. This macro is defined with value 1 when preprocessing assembly
  1347. language.
  1348. 
  1349. File: cpp.info, Node: Common Predefined Macros, Next: System-specific Predefined Macros, Prev: Standard Predefined Macros, Up: Predefined Macros
  1350. 3.7.2 Common Predefined Macros
  1351. ------------------------------
  1352. The common predefined macros are GNU C extensions. They are available
  1353. with the same meanings regardless of the machine or operating system on
  1354. which you are using GNU C or GNU Fortran. Their names all start with
  1355. double underscores.
  1356. '__COUNTER__'
  1357. This macro expands to sequential integral values starting from 0.
  1358. In conjunction with the '##' operator, this provides a convenient
  1359. means to generate unique identifiers. Care must be taken to ensure
  1360. that '__COUNTER__' is not expanded prior to inclusion of
  1361. precompiled headers which use it. Otherwise, the precompiled
  1362. headers will not be used.
  1363. '__GFORTRAN__'
  1364. The GNU Fortran compiler defines this.
  1365. '__GNUC__'
  1366. '__GNUC_MINOR__'
  1367. '__GNUC_PATCHLEVEL__'
  1368. These macros are defined by all GNU compilers that use the C
  1369. preprocessor: C, C++, Objective-C and Fortran. Their values are
  1370. the major version, minor version, and patch level of the compiler,
  1371. as integer constants. For example, GCC version X.Y.Z defines
  1372. '__GNUC__' to X, '__GNUC_MINOR__' to Y, and '__GNUC_PATCHLEVEL__'
  1373. to Z. These macros are also defined if you invoke the preprocessor
  1374. directly.
  1375. If all you need to know is whether or not your program is being
  1376. compiled by GCC, or a non-GCC compiler that claims to accept the
  1377. GNU C dialects, you can simply test '__GNUC__'. If you need to
  1378. write code which depends on a specific version, you must be more
  1379. careful. Each time the minor version is increased, the patch level
  1380. is reset to zero; each time the major version is increased, the
  1381. minor version and patch level are reset. If you wish to use the
  1382. predefined macros directly in the conditional, you will need to
  1383. write it like this:
  1384. /* Test for GCC > 3.2.0 */
  1385. #if __GNUC__ > 3 || \
  1386. (__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || \
  1387. (__GNUC_MINOR__ == 2 && \
  1388. __GNUC_PATCHLEVEL__ > 0))
  1389. Another approach is to use the predefined macros to calculate a
  1390. single number, then compare that against a threshold:
  1391. #define GCC_VERSION (__GNUC__ * 10000 \
  1392. + __GNUC_MINOR__ * 100 \
  1393. + __GNUC_PATCHLEVEL__)
  1394. ...
  1395. /* Test for GCC > 3.2.0 */
  1396. #if GCC_VERSION > 30200
  1397. Many people find this form easier to understand.
  1398. '__GNUG__'
  1399. The GNU C++ compiler defines this. Testing it is equivalent to
  1400. testing '(__GNUC__ && __cplusplus)'.
  1401. '__STRICT_ANSI__'
  1402. GCC defines this macro if and only if the '-ansi' switch, or a
  1403. '-std' switch specifying strict conformance to some version of ISO
  1404. C or ISO C++, was specified when GCC was invoked. It is defined to
  1405. '1'. This macro exists primarily to direct GNU libc's header files
  1406. to use only definitions found in standard C.
  1407. '__BASE_FILE__'
  1408. This macro expands to the name of the main input file, in the form
  1409. of a C string constant. This is the source file that was specified
  1410. on the command line of the preprocessor or C compiler.
  1411. '__INCLUDE_LEVEL__'
  1412. This macro expands to a decimal integer constant that represents
  1413. the depth of nesting in include files. The value of this macro is
  1414. incremented on every '#include' directive and decremented at the
  1415. end of every included file. It starts out at 0, its value within
  1416. the base file specified on the command line.
  1417. '__ELF__'
  1418. This macro is defined if the target uses the ELF object format.
  1419. '__VERSION__'
  1420. This macro expands to a string constant which describes the version
  1421. of the compiler in use. You should not rely on its contents having
  1422. any particular form, but it can be counted on to contain at least
  1423. the release number.
  1424. '__OPTIMIZE__'
  1425. '__OPTIMIZE_SIZE__'
  1426. '__NO_INLINE__'
  1427. These macros describe the compilation mode. '__OPTIMIZE__' is
  1428. defined in all optimizing compilations. '__OPTIMIZE_SIZE__' is
  1429. defined if the compiler is optimizing for size, not speed.
  1430. '__NO_INLINE__' is defined if no functions will be inlined into
  1431. their callers (when not optimizing, or when inlining has been
  1432. specifically disabled by '-fno-inline').
  1433. These macros cause certain GNU header files to provide optimized
  1434. definitions, using macros or inline functions, of system library
  1435. functions. You should not use these macros in any way unless you
  1436. make sure that programs will execute with the same effect whether
  1437. or not they are defined. If they are defined, their value is 1.
  1438. '__GNUC_GNU_INLINE__'
  1439. GCC defines this macro if functions declared 'inline' will be
  1440. handled in GCC's traditional gnu90 mode. Object files will contain
  1441. externally visible definitions of all functions declared 'inline'
  1442. without 'extern' or 'static'. They will not contain any
  1443. definitions of any functions declared 'extern inline'.
  1444. '__GNUC_STDC_INLINE__'
  1445. GCC defines this macro if functions declared 'inline' will be
  1446. handled according to the ISO C99 or later standards. Object files
  1447. will contain externally visible definitions of all functions
  1448. declared 'extern inline'. They will not contain definitions of any
  1449. functions declared 'inline' without 'extern'.
  1450. If this macro is defined, GCC supports the 'gnu_inline' function
  1451. attribute as a way to always get the gnu90 behavior.
  1452. '__CHAR_UNSIGNED__'
  1453. GCC defines this macro if and only if the data type 'char' is
  1454. unsigned on the target machine. It exists to cause the standard
  1455. header file 'limits.h' to work correctly. You should not use this
  1456. macro yourself; instead, refer to the standard macros defined in
  1457. 'limits.h'.
  1458. '__WCHAR_UNSIGNED__'
  1459. Like '__CHAR_UNSIGNED__', this macro is defined if and only if the
  1460. data type 'wchar_t' is unsigned and the front-end is in C++ mode.
  1461. '__REGISTER_PREFIX__'
  1462. This macro expands to a single token (not a string constant) which
  1463. is the prefix applied to CPU register names in assembly language
  1464. for this target. You can use it to write assembly that is usable
  1465. in multiple environments. For example, in the 'm68k-aout'
  1466. environment it expands to nothing, but in the 'm68k-coff'
  1467. environment it expands to a single '%'.
  1468. '__USER_LABEL_PREFIX__'
  1469. This macro expands to a single token which is the prefix applied to
  1470. user labels (symbols visible to C code) in assembly. For example,
  1471. in the 'm68k-aout' environment it expands to an '_', but in the
  1472. 'm68k-coff' environment it expands to nothing.
  1473. This macro will have the correct definition even if
  1474. '-f(no-)underscores' is in use, but it will not be correct if
  1475. target-specific options that adjust this prefix are used (e.g. the
  1476. OSF/rose '-mno-underscores' option).
  1477. '__SIZE_TYPE__'
  1478. '__PTRDIFF_TYPE__'
  1479. '__WCHAR_TYPE__'
  1480. '__WINT_TYPE__'
  1481. '__INTMAX_TYPE__'
  1482. '__UINTMAX_TYPE__'
  1483. '__SIG_ATOMIC_TYPE__'
  1484. '__INT8_TYPE__'
  1485. '__INT16_TYPE__'
  1486. '__INT32_TYPE__'
  1487. '__INT64_TYPE__'
  1488. '__UINT8_TYPE__'
  1489. '__UINT16_TYPE__'
  1490. '__UINT32_TYPE__'
  1491. '__UINT64_TYPE__'
  1492. '__INT_LEAST8_TYPE__'
  1493. '__INT_LEAST16_TYPE__'
  1494. '__INT_LEAST32_TYPE__'
  1495. '__INT_LEAST64_TYPE__'
  1496. '__UINT_LEAST8_TYPE__'
  1497. '__UINT_LEAST16_TYPE__'
  1498. '__UINT_LEAST32_TYPE__'
  1499. '__UINT_LEAST64_TYPE__'
  1500. '__INT_FAST8_TYPE__'
  1501. '__INT_FAST16_TYPE__'
  1502. '__INT_FAST32_TYPE__'
  1503. '__INT_FAST64_TYPE__'
  1504. '__UINT_FAST8_TYPE__'
  1505. '__UINT_FAST16_TYPE__'
  1506. '__UINT_FAST32_TYPE__'
  1507. '__UINT_FAST64_TYPE__'
  1508. '__INTPTR_TYPE__'
  1509. '__UINTPTR_TYPE__'
  1510. These macros are defined to the correct underlying types for the
  1511. 'size_t', 'ptrdiff_t', 'wchar_t', 'wint_t', 'intmax_t',
  1512. 'uintmax_t', 'sig_atomic_t', 'int8_t', 'int16_t', 'int32_t',
  1513. 'int64_t', 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t',
  1514. 'int_least8_t', 'int_least16_t', 'int_least32_t', 'int_least64_t',
  1515. 'uint_least8_t', 'uint_least16_t', 'uint_least32_t',
  1516. 'uint_least64_t', 'int_fast8_t', 'int_fast16_t', 'int_fast32_t',
  1517. 'int_fast64_t', 'uint_fast8_t', 'uint_fast16_t', 'uint_fast32_t',
  1518. 'uint_fast64_t', 'intptr_t', and 'uintptr_t' typedefs,
  1519. respectively. They exist to make the standard header files
  1520. 'stddef.h', 'stdint.h', and 'wchar.h' work correctly. You should
  1521. not use these macros directly; instead, include the appropriate
  1522. headers and use the typedefs. Some of these macros may not be
  1523. defined on particular systems if GCC does not provide a 'stdint.h'
  1524. header on those systems.
  1525. '__CHAR_BIT__'
  1526. Defined to the number of bits used in the representation of the
  1527. 'char' data type. It exists to make the standard header given
  1528. numerical limits work correctly. You should not use this macro
  1529. directly; instead, include the appropriate headers.
  1530. '__SCHAR_MAX__'
  1531. '__WCHAR_MAX__'
  1532. '__SHRT_MAX__'
  1533. '__INT_MAX__'
  1534. '__LONG_MAX__'
  1535. '__LONG_LONG_MAX__'
  1536. '__WINT_MAX__'
  1537. '__SIZE_MAX__'
  1538. '__PTRDIFF_MAX__'
  1539. '__INTMAX_MAX__'
  1540. '__UINTMAX_MAX__'
  1541. '__SIG_ATOMIC_MAX__'
  1542. '__INT8_MAX__'
  1543. '__INT16_MAX__'
  1544. '__INT32_MAX__'
  1545. '__INT64_MAX__'
  1546. '__UINT8_MAX__'
  1547. '__UINT16_MAX__'
  1548. '__UINT32_MAX__'
  1549. '__UINT64_MAX__'
  1550. '__INT_LEAST8_MAX__'
  1551. '__INT_LEAST16_MAX__'
  1552. '__INT_LEAST32_MAX__'
  1553. '__INT_LEAST64_MAX__'
  1554. '__UINT_LEAST8_MAX__'
  1555. '__UINT_LEAST16_MAX__'
  1556. '__UINT_LEAST32_MAX__'
  1557. '__UINT_LEAST64_MAX__'
  1558. '__INT_FAST8_MAX__'
  1559. '__INT_FAST16_MAX__'
  1560. '__INT_FAST32_MAX__'
  1561. '__INT_FAST64_MAX__'
  1562. '__UINT_FAST8_MAX__'
  1563. '__UINT_FAST16_MAX__'
  1564. '__UINT_FAST32_MAX__'
  1565. '__UINT_FAST64_MAX__'
  1566. '__INTPTR_MAX__'
  1567. '__UINTPTR_MAX__'
  1568. '__WCHAR_MIN__'
  1569. '__WINT_MIN__'
  1570. '__SIG_ATOMIC_MIN__'
  1571. Defined to the maximum value of the 'signed char', 'wchar_t',
  1572. 'signed short', 'signed int', 'signed long', 'signed long long',
  1573. 'wint_t', 'size_t', 'ptrdiff_t', 'intmax_t', 'uintmax_t',
  1574. 'sig_atomic_t', 'int8_t', 'int16_t', 'int32_t', 'int64_t',
  1575. 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t', 'int_least8_t',
  1576. 'int_least16_t', 'int_least32_t', 'int_least64_t', 'uint_least8_t',
  1577. 'uint_least16_t', 'uint_least32_t', 'uint_least64_t',
  1578. 'int_fast8_t', 'int_fast16_t', 'int_fast32_t', 'int_fast64_t',
  1579. 'uint_fast8_t', 'uint_fast16_t', 'uint_fast32_t', 'uint_fast64_t',
  1580. 'intptr_t', and 'uintptr_t' types and to the minimum value of the
  1581. 'wchar_t', 'wint_t', and 'sig_atomic_t' types respectively. They
  1582. exist to make the standard header given numerical limits work
  1583. correctly. You should not use these macros directly; instead,
  1584. include the appropriate headers. Some of these macros may not be
  1585. defined on particular systems if GCC does not provide a 'stdint.h'
  1586. header on those systems.
  1587. '__INT8_C'
  1588. '__INT16_C'
  1589. '__INT32_C'
  1590. '__INT64_C'
  1591. '__UINT8_C'
  1592. '__UINT16_C'
  1593. '__UINT32_C'
  1594. '__UINT64_C'
  1595. '__INTMAX_C'
  1596. '__UINTMAX_C'
  1597. Defined to implementations of the standard 'stdint.h' macros with
  1598. the same names without the leading '__'. They exist the make the
  1599. implementation of that header work correctly. You should not use
  1600. these macros directly; instead, include the appropriate headers.
  1601. Some of these macros may not be defined on particular systems if
  1602. GCC does not provide a 'stdint.h' header on those systems.
  1603. '__SCHAR_WIDTH__'
  1604. '__SHRT_WIDTH__'
  1605. '__INT_WIDTH__'
  1606. '__LONG_WIDTH__'
  1607. '__LONG_LONG_WIDTH__'
  1608. '__PTRDIFF_WIDTH__'
  1609. '__SIG_ATOMIC_WIDTH__'
  1610. '__SIZE_WIDTH__'
  1611. '__WCHAR_WIDTH__'
  1612. '__WINT_WIDTH__'
  1613. '__INT_LEAST8_WIDTH__'
  1614. '__INT_LEAST16_WIDTH__'
  1615. '__INT_LEAST32_WIDTH__'
  1616. '__INT_LEAST64_WIDTH__'
  1617. '__INT_FAST8_WIDTH__'
  1618. '__INT_FAST16_WIDTH__'
  1619. '__INT_FAST32_WIDTH__'
  1620. '__INT_FAST64_WIDTH__'
  1621. '__INTPTR_WIDTH__'
  1622. '__INTMAX_WIDTH__'
  1623. Defined to the bit widths of the corresponding types. They exist
  1624. to make the implementations of 'limits.h' and 'stdint.h' behave
  1625. correctly. You should not use these macros directly; instead,
  1626. include the appropriate headers. Some of these macros may not be
  1627. defined on particular systems if GCC does not provide a 'stdint.h'
  1628. header on those systems.
  1629. '__SIZEOF_INT__'
  1630. '__SIZEOF_LONG__'
  1631. '__SIZEOF_LONG_LONG__'
  1632. '__SIZEOF_SHORT__'
  1633. '__SIZEOF_POINTER__'
  1634. '__SIZEOF_FLOAT__'
  1635. '__SIZEOF_DOUBLE__'
  1636. '__SIZEOF_LONG_DOUBLE__'
  1637. '__SIZEOF_SIZE_T__'
  1638. '__SIZEOF_WCHAR_T__'
  1639. '__SIZEOF_WINT_T__'
  1640. '__SIZEOF_PTRDIFF_T__'
  1641. Defined to the number of bytes of the C standard data types: 'int',
  1642. 'long', 'long long', 'short', 'void *', 'float', 'double', 'long
  1643. double', 'size_t', 'wchar_t', 'wint_t' and 'ptrdiff_t'.
  1644. '__BYTE_ORDER__'
  1645. '__ORDER_LITTLE_ENDIAN__'
  1646. '__ORDER_BIG_ENDIAN__'
  1647. '__ORDER_PDP_ENDIAN__'
  1648. '__BYTE_ORDER__' is defined to one of the values
  1649. '__ORDER_LITTLE_ENDIAN__', '__ORDER_BIG_ENDIAN__', or
  1650. '__ORDER_PDP_ENDIAN__' to reflect the layout of multi-byte and
  1651. multi-word quantities in memory. If '__BYTE_ORDER__' is equal to
  1652. '__ORDER_LITTLE_ENDIAN__' or '__ORDER_BIG_ENDIAN__', then
  1653. multi-byte and multi-word quantities are laid out identically: the
  1654. byte (word) at the lowest address is the least significant or most
  1655. significant byte (word) of the quantity, respectively. If
  1656. '__BYTE_ORDER__' is equal to '__ORDER_PDP_ENDIAN__', then bytes in
  1657. 16-bit words are laid out in a little-endian fashion, whereas the
  1658. 16-bit subwords of a 32-bit quantity are laid out in big-endian
  1659. fashion.
  1660. You should use these macros for testing like this:
  1661. /* Test for a little-endian machine */
  1662. #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
  1663. '__FLOAT_WORD_ORDER__'
  1664. '__FLOAT_WORD_ORDER__' is defined to one of the values
  1665. '__ORDER_LITTLE_ENDIAN__' or '__ORDER_BIG_ENDIAN__' to reflect the
  1666. layout of the words of multi-word floating-point quantities.
  1667. '__DEPRECATED'
  1668. This macro is defined, with value 1, when compiling a C++ source
  1669. file with warnings about deprecated constructs enabled. These
  1670. warnings are enabled by default, but can be disabled with
  1671. '-Wno-deprecated'.
  1672. '__EXCEPTIONS'
  1673. This macro is defined, with value 1, when compiling a C++ source
  1674. file with exceptions enabled. If '-fno-exceptions' is used when
  1675. compiling the file, then this macro is not defined.
  1676. '__GXX_RTTI'
  1677. This macro is defined, with value 1, when compiling a C++ source
  1678. file with runtime type identification enabled. If '-fno-rtti' is
  1679. used when compiling the file, then this macro is not defined.
  1680. '__USING_SJLJ_EXCEPTIONS__'
  1681. This macro is defined, with value 1, if the compiler uses the old
  1682. mechanism based on 'setjmp' and 'longjmp' for exception handling.
  1683. '__GXX_EXPERIMENTAL_CXX0X__'
  1684. This macro is defined when compiling a C++ source file with the
  1685. option '-std=c++0x' or '-std=gnu++0x'. It indicates that some
  1686. features likely to be included in C++0x are available. Note that
  1687. these features are experimental, and may change or be removed in
  1688. future versions of GCC.
  1689. '__GXX_WEAK__'
  1690. This macro is defined when compiling a C++ source file. It has the
  1691. value 1 if the compiler will use weak symbols, COMDAT sections, or
  1692. other similar techniques to collapse symbols with "vague linkage"
  1693. that are defined in multiple translation units. If the compiler
  1694. will not collapse such symbols, this macro is defined with value 0.
  1695. In general, user code should not need to make use of this macro;
  1696. the purpose of this macro is to ease implementation of the C++
  1697. runtime library provided with G++.
  1698. '__NEXT_RUNTIME__'
  1699. This macro is defined, with value 1, if (and only if) the NeXT
  1700. runtime (as in '-fnext-runtime') is in use for Objective-C. If the
  1701. GNU runtime is used, this macro is not defined, so that you can use
  1702. this macro to determine which runtime (NeXT or GNU) is being used.
  1703. '__LP64__'
  1704. '_LP64'
  1705. These macros are defined, with value 1, if (and only if) the
  1706. compilation is for a target where 'long int' and pointer both use
  1707. 64-bits and 'int' uses 32-bit.
  1708. '__SSP__'
  1709. This macro is defined, with value 1, when '-fstack-protector' is in
  1710. use.
  1711. '__SSP_ALL__'
  1712. This macro is defined, with value 2, when '-fstack-protector-all'
  1713. is in use.
  1714. '__SSP_STRONG__'
  1715. This macro is defined, with value 3, when
  1716. '-fstack-protector-strong' is in use.
  1717. '__SSP_EXPLICIT__'
  1718. This macro is defined, with value 4, when
  1719. '-fstack-protector-explicit' is in use.
  1720. '__SANITIZE_ADDRESS__'
  1721. This macro is defined, with value 1, when '-fsanitize=address' or
  1722. '-fsanitize=kernel-address' are in use.
  1723. '__SANITIZE_THREAD__'
  1724. This macro is defined, with value 1, when '-fsanitize=thread' is in
  1725. use.
  1726. '__TIMESTAMP__'
  1727. This macro expands to a string constant that describes the date and
  1728. time of the last modification of the current source file. The
  1729. string constant contains abbreviated day of the week, month, day of
  1730. the month, time in hh:mm:ss form, year and looks like
  1731. '"Sun Sep 16 01:03:52 1973"'. If the day of the month is less than
  1732. 10, it is padded with a space on the left.
  1733. If GCC cannot determine the current date, it will emit a warning
  1734. message (once per compilation) and '__TIMESTAMP__' will expand to
  1735. '"??? ??? ?? ??:??:?? ????"'.
  1736. '__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1'
  1737. '__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2'
  1738. '__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4'
  1739. '__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8'
  1740. '__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16'
  1741. These macros are defined when the target processor supports atomic
  1742. compare and swap operations on operands 1, 2, 4, 8 or 16 bytes in
  1743. length, respectively.
  1744. '__HAVE_SPECULATION_SAFE_VALUE'
  1745. This macro is defined with the value 1 to show that this version of
  1746. GCC supports '__builtin_speculation_safe_value'.
  1747. '__GCC_HAVE_DWARF2_CFI_ASM'
  1748. This macro is defined when the compiler is emitting DWARF CFI
  1749. directives to the assembler. When this is defined, it is possible
  1750. to emit those same directives in inline assembly.
  1751. '__FP_FAST_FMA'
  1752. '__FP_FAST_FMAF'
  1753. '__FP_FAST_FMAL'
  1754. These macros are defined with value 1 if the backend supports the
  1755. 'fma', 'fmaf', and 'fmal' builtin functions, so that the include
  1756. file 'math.h' can define the macros 'FP_FAST_FMA', 'FP_FAST_FMAF',
  1757. and 'FP_FAST_FMAL' for compatibility with the 1999 C standard.
  1758. '__FP_FAST_FMAF16'
  1759. '__FP_FAST_FMAF32'
  1760. '__FP_FAST_FMAF64'
  1761. '__FP_FAST_FMAF128'
  1762. '__FP_FAST_FMAF32X'
  1763. '__FP_FAST_FMAF64X'
  1764. '__FP_FAST_FMAF128X'
  1765. These macros are defined with the value 1 if the backend supports
  1766. the 'fma' functions using the additional '_FloatN' and '_FloatNx'
  1767. types that are defined in ISO/IEC TS 18661-3:2015. The include
  1768. file 'math.h' can define the 'FP_FAST_FMAFN' and 'FP_FAST_FMAFNx'
  1769. macros if the user defined '__STDC_WANT_IEC_60559_TYPES_EXT__'
  1770. before including 'math.h'.
  1771. '__GCC_IEC_559'
  1772. This macro is defined to indicate the intended level of support for
  1773. IEEE 754 (IEC 60559) floating-point arithmetic. It expands to a
  1774. nonnegative integer value. If 0, it indicates that the combination
  1775. of the compiler configuration and the command-line options is not
  1776. intended to support IEEE 754 arithmetic for 'float' and 'double' as
  1777. defined in C99 and C11 Annex F (for example, that the standard
  1778. rounding modes and exceptions are not supported, or that
  1779. optimizations are enabled that conflict with IEEE 754 semantics).
  1780. If 1, it indicates that IEEE 754 arithmetic is intended to be
  1781. supported; this does not mean that all relevant language features
  1782. are supported by GCC. If 2 or more, it additionally indicates
  1783. support for IEEE 754-2008 (in particular, that the binary encodings
  1784. for quiet and signaling NaNs are as specified in IEEE 754-2008).
  1785. This macro does not indicate the default state of command-line
  1786. options that control optimizations that C99 and C11 permit to be
  1787. controlled by standard pragmas, where those standards do not
  1788. require a particular default state. It does not indicate whether
  1789. optimizations respect signaling NaN semantics (the macro for that
  1790. is '__SUPPORT_SNAN__'). It does not indicate support for decimal
  1791. floating point or the IEEE 754 binary16 and binary128 types.
  1792. '__GCC_IEC_559_COMPLEX'
  1793. This macro is defined to indicate the intended level of support for
  1794. IEEE 754 (IEC 60559) floating-point arithmetic for complex numbers,
  1795. as defined in C99 and C11 Annex G. It expands to a nonnegative
  1796. integer value. If 0, it indicates that the combination of the
  1797. compiler configuration and the command-line options is not intended
  1798. to support Annex G requirements (for example, because
  1799. '-fcx-limited-range' was used). If 1 or more, it indicates that it
  1800. is intended to support those requirements; this does not mean that
  1801. all relevant language features are supported by GCC.
  1802. '__NO_MATH_ERRNO__'
  1803. This macro is defined if '-fno-math-errno' is used, or enabled by
  1804. another option such as '-ffast-math' or by default.
  1805. 
  1806. File: cpp.info, Node: System-specific Predefined Macros, Next: C++ Named Operators, Prev: Common Predefined Macros, Up: Predefined Macros
  1807. 3.7.3 System-specific Predefined Macros
  1808. ---------------------------------------
  1809. The C preprocessor normally predefines several macros that indicate what
  1810. type of system and machine is in use. They are obviously different on
  1811. each target supported by GCC. This manual, being for all systems and
  1812. machines, cannot tell you what their names are, but you can use 'cpp
  1813. -dM' to see them all. *Note Invocation::. All system-specific
  1814. predefined macros expand to a constant value, so you can test them with
  1815. either '#ifdef' or '#if'.
  1816. The C standard requires that all system-specific macros be part of
  1817. the "reserved namespace". All names which begin with two underscores,
  1818. or an underscore and a capital letter, are reserved for the compiler and
  1819. library to use as they wish. However, historically system-specific
  1820. macros have had names with no special prefix; for instance, it is common
  1821. to find 'unix' defined on Unix systems. For all such macros, GCC
  1822. provides a parallel macro with two underscores added at the beginning
  1823. and the end. If 'unix' is defined, '__unix__' will be defined too.
  1824. There will never be more than two underscores; the parallel of '_mips'
  1825. is '__mips__'.
  1826. When the '-ansi' option, or any '-std' option that requests strict
  1827. conformance, is given to the compiler, all the system-specific
  1828. predefined macros outside the reserved namespace are suppressed. The
  1829. parallel macros, inside the reserved namespace, remain defined.
  1830. We are slowly phasing out all predefined macros which are outside the
  1831. reserved namespace. You should never use them in new programs, and we
  1832. encourage you to correct older code to use the parallel macros whenever
  1833. you find it. We don't recommend you use the system-specific macros that
  1834. are in the reserved namespace, either. It is better in the long run to
  1835. check specifically for features you need, using a tool such as
  1836. 'autoconf'.
  1837. 
  1838. File: cpp.info, Node: C++ Named Operators, Prev: System-specific Predefined Macros, Up: Predefined Macros
  1839. 3.7.4 C++ Named Operators
  1840. -------------------------
  1841. In C++, there are eleven keywords which are simply alternate spellings
  1842. of operators normally written with punctuation. These keywords are
  1843. treated as such even in the preprocessor. They function as operators in
  1844. '#if', and they cannot be defined as macros or poisoned. In C, you can
  1845. request that those keywords take their C++ meaning by including
  1846. 'iso646.h'. That header defines each one as a normal object-like macro
  1847. expanding to the appropriate punctuator.
  1848. These are the named operators and their corresponding punctuators:
  1849. Named Operator Punctuator
  1850. 'and' '&&'
  1851. 'and_eq' '&='
  1852. 'bitand' '&'
  1853. 'bitor' '|'
  1854. 'compl' '~'
  1855. 'not' '!'
  1856. 'not_eq' '!='
  1857. 'or' '||'
  1858. 'or_eq' '|='
  1859. 'xor' '^'
  1860. 'xor_eq' '^='
  1861. 
  1862. File: cpp.info, Node: Undefining and Redefining Macros, Next: Directives Within Macro Arguments, Prev: Predefined Macros, Up: Macros
  1863. 3.8 Undefining and Redefining Macros
  1864. ====================================
  1865. If a macro ceases to be useful, it may be "undefined" with the '#undef'
  1866. directive. '#undef' takes a single argument, the name of the macro to
  1867. undefine. You use the bare macro name, even if the macro is
  1868. function-like. It is an error if anything appears on the line after the
  1869. macro name. '#undef' has no effect if the name is not a macro.
  1870. #define FOO 4
  1871. x = FOO; ==> x = 4;
  1872. #undef FOO
  1873. x = FOO; ==> x = FOO;
  1874. Once a macro has been undefined, that identifier may be "redefined"
  1875. as a macro by a subsequent '#define' directive. The new definition need
  1876. not have any resemblance to the old definition.
  1877. However, if an identifier which is currently a macro is redefined,
  1878. then the new definition must be "effectively the same" as the old one.
  1879. Two macro definitions are effectively the same if:
  1880. * Both are the same type of macro (object- or function-like).
  1881. * All the tokens of the replacement list are the same.
  1882. * If there are any parameters, they are the same.
  1883. * Whitespace appears in the same places in both. It need not be
  1884. exactly the same amount of whitespace, though. Remember that
  1885. comments count as whitespace.
  1886. These definitions are effectively the same:
  1887. #define FOUR (2 + 2)
  1888. #define FOUR (2 + 2)
  1889. #define FOUR (2 /* two */ + 2)
  1890. but these are not:
  1891. #define FOUR (2 + 2)
  1892. #define FOUR ( 2+2 )
  1893. #define FOUR (2 * 2)
  1894. #define FOUR(score,and,seven,years,ago) (2 + 2)
  1895. If a macro is redefined with a definition that is not effectively the
  1896. same as the old one, the preprocessor issues a warning and changes the
  1897. macro to use the new definition. If the new definition is effectively
  1898. the same, the redefinition is silently ignored. This allows, for
  1899. instance, two different headers to define a common macro. The
  1900. preprocessor will only complain if the definitions do not match.
  1901. 
  1902. File: cpp.info, Node: Directives Within Macro Arguments, Next: Macro Pitfalls, Prev: Undefining and Redefining Macros, Up: Macros
  1903. 3.9 Directives Within Macro Arguments
  1904. =====================================
  1905. Occasionally it is convenient to use preprocessor directives within the
  1906. arguments of a macro. The C and C++ standards declare that behavior in
  1907. these cases is undefined. GNU CPP processes arbitrary directives within
  1908. macro arguments in exactly the same way as it would have processed the
  1909. directive were the function-like macro invocation not present.
  1910. If, within a macro invocation, that macro is redefined, then the new
  1911. definition takes effect in time for argument pre-expansion, but the
  1912. original definition is still used for argument replacement. Here is a
  1913. pathological example:
  1914. #define f(x) x x
  1915. f (1
  1916. #undef f
  1917. #define f 2
  1918. f)
  1919. which expands to
  1920. 1 2 1 2
  1921. with the semantics described above.
  1922. 
  1923. File: cpp.info, Node: Macro Pitfalls, Prev: Directives Within Macro Arguments, Up: Macros
  1924. 3.10 Macro Pitfalls
  1925. ===================
  1926. In this section we describe some special rules that apply to macros and
  1927. macro expansion, and point out certain cases in which the rules have
  1928. counter-intuitive consequences that you must watch out for.
  1929. * Menu:
  1930. * Misnesting::
  1931. * Operator Precedence Problems::
  1932. * Swallowing the Semicolon::
  1933. * Duplication of Side Effects::
  1934. * Self-Referential Macros::
  1935. * Argument Prescan::
  1936. * Newlines in Arguments::
  1937. 
  1938. File: cpp.info, Node: Misnesting, Next: Operator Precedence Problems, Up: Macro Pitfalls
  1939. 3.10.1 Misnesting
  1940. -----------------
  1941. When a macro is called with arguments, the arguments are substituted
  1942. into the macro body and the result is checked, together with the rest of
  1943. the input file, for more macro calls. It is possible to piece together
  1944. a macro call coming partially from the macro body and partially from the
  1945. arguments. For example,
  1946. #define twice(x) (2*(x))
  1947. #define call_with_1(x) x(1)
  1948. call_with_1 (twice)
  1949. ==> twice(1)
  1950. ==> (2*(1))
  1951. Macro definitions do not have to have balanced parentheses. By
  1952. writing an unbalanced open parenthesis in a macro body, it is possible
  1953. to create a macro call that begins inside the macro body but ends
  1954. outside of it. For example,
  1955. #define strange(file) fprintf (file, "%s %d",
  1956. ...
  1957. strange(stderr) p, 35)
  1958. ==> fprintf (stderr, "%s %d", p, 35)
  1959. The ability to piece together a macro call can be useful, but the use
  1960. of unbalanced open parentheses in a macro body is just confusing, and
  1961. should be avoided.
  1962. 
  1963. File: cpp.info, Node: Operator Precedence Problems, Next: Swallowing the Semicolon, Prev: Misnesting, Up: Macro Pitfalls
  1964. 3.10.2 Operator Precedence Problems
  1965. -----------------------------------
  1966. You may have noticed that in most of the macro definition examples shown
  1967. above, each occurrence of a macro argument name had parentheses around
  1968. it. In addition, another pair of parentheses usually surround the
  1969. entire macro definition. Here is why it is best to write macros that
  1970. way.
  1971. Suppose you define a macro as follows,
  1972. #define ceil_div(x, y) (x + y - 1) / y
  1973. whose purpose is to divide, rounding up. (One use for this operation is
  1974. to compute how many 'int' objects are needed to hold a certain number of
  1975. 'char' objects.) Then suppose it is used as follows:
  1976. a = ceil_div (b & c, sizeof (int));
  1977. ==> a = (b & c + sizeof (int) - 1) / sizeof (int);
  1978. This does not do what is intended. The operator-precedence rules of C
  1979. make it equivalent to this:
  1980. a = (b & (c + sizeof (int) - 1)) / sizeof (int);
  1981. What we want is this:
  1982. a = ((b & c) + sizeof (int) - 1)) / sizeof (int);
  1983. Defining the macro as
  1984. #define ceil_div(x, y) ((x) + (y) - 1) / (y)
  1985. provides the desired result.
  1986. Unintended grouping can result in another way. Consider 'sizeof
  1987. ceil_div(1, 2)'. That has the appearance of a C expression that would
  1988. compute the size of the type of 'ceil_div (1, 2)', but in fact it means
  1989. something very different. Here is what it expands to:
  1990. sizeof ((1) + (2) - 1) / (2)
  1991. This would take the size of an integer and divide it by two. The
  1992. precedence rules have put the division outside the 'sizeof' when it was
  1993. intended to be inside.
  1994. Parentheses around the entire macro definition prevent such problems.
  1995. Here, then, is the recommended way to define 'ceil_div':
  1996. #define ceil_div(x, y) (((x) + (y) - 1) / (y))
  1997. 
  1998. File: cpp.info, Node: Swallowing the Semicolon, Next: Duplication of Side Effects, Prev: Operator Precedence Problems, Up: Macro Pitfalls
  1999. 3.10.3 Swallowing the Semicolon
  2000. -------------------------------
  2001. Often it is desirable to define a macro that expands into a compound
  2002. statement. Consider, for example, the following macro, that advances a
  2003. pointer (the argument 'p' says where to find it) across whitespace
  2004. characters:
  2005. #define SKIP_SPACES(p, limit) \
  2006. { char *lim = (limit); \
  2007. while (p < lim) { \
  2008. if (*p++ != ' ') { \
  2009. p--; break; }}}
  2010. Here backslash-newline is used to split the macro definition, which must
  2011. be a single logical line, so that it resembles the way such code would
  2012. be laid out if not part of a macro definition.
  2013. A call to this macro might be 'SKIP_SPACES (p, lim)'. Strictly
  2014. speaking, the call expands to a compound statement, which is a complete
  2015. statement with no need for a semicolon to end it. However, since it
  2016. looks like a function call, it minimizes confusion if you can use it
  2017. like a function call, writing a semicolon afterward, as in 'SKIP_SPACES
  2018. (p, lim);'
  2019. This can cause trouble before 'else' statements, because the
  2020. semicolon is actually a null statement. Suppose you write
  2021. if (*p != 0)
  2022. SKIP_SPACES (p, lim);
  2023. else ...
  2024. The presence of two statements--the compound statement and a null
  2025. statement--in between the 'if' condition and the 'else' makes invalid C
  2026. code.
  2027. The definition of the macro 'SKIP_SPACES' can be altered to solve
  2028. this problem, using a 'do ... while' statement. Here is how:
  2029. #define SKIP_SPACES(p, limit) \
  2030. do { char *lim = (limit); \
  2031. while (p < lim) { \
  2032. if (*p++ != ' ') { \
  2033. p--; break; }}} \
  2034. while (0)
  2035. Now 'SKIP_SPACES (p, lim);' expands into
  2036. do {...} while (0);
  2037. which is one statement. The loop executes exactly once; most compilers
  2038. generate no extra code for it.
  2039. 
  2040. File: cpp.info, Node: Duplication of Side Effects, Next: Self-Referential Macros, Prev: Swallowing the Semicolon, Up: Macro Pitfalls
  2041. 3.10.4 Duplication of Side Effects
  2042. ----------------------------------
  2043. Many C programs define a macro 'min', for "minimum", like this:
  2044. #define min(X, Y) ((X) < (Y) ? (X) : (Y))
  2045. When you use this macro with an argument containing a side effect, as
  2046. shown here,
  2047. next = min (x + y, foo (z));
  2048. it expands as follows:
  2049. next = ((x + y) < (foo (z)) ? (x + y) : (foo (z)));
  2050. where 'x + y' has been substituted for 'X' and 'foo (z)' for 'Y'.
  2051. The function 'foo' is used only once in the statement as it appears
  2052. in the program, but the expression 'foo (z)' has been substituted twice
  2053. into the macro expansion. As a result, 'foo' might be called two times
  2054. when the statement is executed. If it has side effects or if it takes a
  2055. long time to compute, the results might not be what you intended. We
  2056. say that 'min' is an "unsafe" macro.
  2057. The best solution to this problem is to define 'min' in a way that
  2058. computes the value of 'foo (z)' only once. The C language offers no
  2059. standard way to do this, but it can be done with GNU extensions as
  2060. follows:
  2061. #define min(X, Y) \
  2062. ({ typeof (X) x_ = (X); \
  2063. typeof (Y) y_ = (Y); \
  2064. (x_ < y_) ? x_ : y_; })
  2065. The '({ ... })' notation produces a compound statement that acts as
  2066. an expression. Its value is the value of its last statement. This
  2067. permits us to define local variables and assign each argument to one.
  2068. The local variables have underscores after their names to reduce the
  2069. risk of conflict with an identifier of wider scope (it is impossible to
  2070. avoid this entirely). Now each argument is evaluated exactly once.
  2071. If you do not wish to use GNU C extensions, the only solution is to
  2072. be careful when _using_ the macro 'min'. For example, you can calculate
  2073. the value of 'foo (z)', save it in a variable, and use that variable in
  2074. 'min':
  2075. #define min(X, Y) ((X) < (Y) ? (X) : (Y))
  2076. ...
  2077. {
  2078. int tem = foo (z);
  2079. next = min (x + y, tem);
  2080. }
  2081. (where we assume that 'foo' returns type 'int').
  2082. 
  2083. File: cpp.info, Node: Self-Referential Macros, Next: Argument Prescan, Prev: Duplication of Side Effects, Up: Macro Pitfalls
  2084. 3.10.5 Self-Referential Macros
  2085. ------------------------------
  2086. A "self-referential" macro is one whose name appears in its definition.
  2087. Recall that all macro definitions are rescanned for more macros to
  2088. replace. If the self-reference were considered a use of the macro, it
  2089. would produce an infinitely large expansion. To prevent this, the
  2090. self-reference is not considered a macro call. It is passed into the
  2091. preprocessor output unchanged. Consider an example:
  2092. #define foo (4 + foo)
  2093. where 'foo' is also a variable in your program.
  2094. Following the ordinary rules, each reference to 'foo' will expand
  2095. into '(4 + foo)'; then this will be rescanned and will expand into '(4 +
  2096. (4 + foo))'; and so on until the computer runs out of memory.
  2097. The self-reference rule cuts this process short after one step, at
  2098. '(4 + foo)'. Therefore, this macro definition has the possibly useful
  2099. effect of causing the program to add 4 to the value of 'foo' wherever
  2100. 'foo' is referred to.
  2101. In most cases, it is a bad idea to take advantage of this feature. A
  2102. person reading the program who sees that 'foo' is a variable will not
  2103. expect that it is a macro as well. The reader will come across the
  2104. identifier 'foo' in the program and think its value should be that of
  2105. the variable 'foo', whereas in fact the value is four greater.
  2106. One common, useful use of self-reference is to create a macro which
  2107. expands to itself. If you write
  2108. #define EPERM EPERM
  2109. then the macro 'EPERM' expands to 'EPERM'. Effectively, it is left
  2110. alone by the preprocessor whenever it's used in running text. You can
  2111. tell that it's a macro with '#ifdef'. You might do this if you want to
  2112. define numeric constants with an 'enum', but have '#ifdef' be true for
  2113. each constant.
  2114. If a macro 'x' expands to use a macro 'y', and the expansion of 'y'
  2115. refers to the macro 'x', that is an "indirect self-reference" of 'x'.
  2116. 'x' is not expanded in this case either. Thus, if we have
  2117. #define x (4 + y)
  2118. #define y (2 * x)
  2119. then 'x' and 'y' expand as follows:
  2120. x ==> (4 + y)
  2121. ==> (4 + (2 * x))
  2122. y ==> (2 * x)
  2123. ==> (2 * (4 + y))
  2124. Each macro is expanded when it appears in the definition of the other
  2125. macro, but not when it indirectly appears in its own definition.
  2126. 
  2127. File: cpp.info, Node: Argument Prescan, Next: Newlines in Arguments, Prev: Self-Referential Macros, Up: Macro Pitfalls
  2128. 3.10.6 Argument Prescan
  2129. -----------------------
  2130. Macro arguments are completely macro-expanded before they are
  2131. substituted into a macro body, unless they are stringized or pasted with
  2132. other tokens. After substitution, the entire macro body, including the
  2133. substituted arguments, is scanned again for macros to be expanded. The
  2134. result is that the arguments are scanned _twice_ to expand macro calls
  2135. in them.
  2136. Most of the time, this has no effect. If the argument contained any
  2137. macro calls, they are expanded during the first scan. The result
  2138. therefore contains no macro calls, so the second scan does not change
  2139. it. If the argument were substituted as given, with no prescan, the
  2140. single remaining scan would find the same macro calls and produce the
  2141. same results.
  2142. You might expect the double scan to change the results when a
  2143. self-referential macro is used in an argument of another macro (*note
  2144. Self-Referential Macros::): the self-referential macro would be expanded
  2145. once in the first scan, and a second time in the second scan. However,
  2146. this is not what happens. The self-references that do not expand in the
  2147. first scan are marked so that they will not expand in the second scan
  2148. either.
  2149. You might wonder, "Why mention the prescan, if it makes no
  2150. difference? And why not skip it and make the preprocessor faster?" The
  2151. answer is that the prescan does make a difference in three special
  2152. cases:
  2153. * Nested calls to a macro.
  2154. We say that "nested" calls to a macro occur when a macro's argument
  2155. contains a call to that very macro. For example, if 'f' is a macro
  2156. that expects one argument, 'f (f (1))' is a nested pair of calls to
  2157. 'f'. The desired expansion is made by expanding 'f (1)' and
  2158. substituting that into the definition of 'f'. The prescan causes
  2159. the expected result to happen. Without the prescan, 'f (1)' itself
  2160. would be substituted as an argument, and the inner use of 'f' would
  2161. appear during the main scan as an indirect self-reference and would
  2162. not be expanded.
  2163. * Macros that call other macros that stringize or concatenate.
  2164. If an argument is stringized or concatenated, the prescan does not
  2165. occur. If you _want_ to expand a macro, then stringize or
  2166. concatenate its expansion, you can do that by causing one macro to
  2167. call another macro that does the stringizing or concatenation. For
  2168. instance, if you have
  2169. #define AFTERX(x) X_ ## x
  2170. #define XAFTERX(x) AFTERX(x)
  2171. #define TABLESIZE 1024
  2172. #define BUFSIZE TABLESIZE
  2173. then 'AFTERX(BUFSIZE)' expands to 'X_BUFSIZE', and
  2174. 'XAFTERX(BUFSIZE)' expands to 'X_1024'. (Not to 'X_TABLESIZE'.
  2175. Prescan always does a complete expansion.)
  2176. * Macros used in arguments, whose expansions contain unshielded
  2177. commas.
  2178. This can cause a macro expanded on the second scan to be called
  2179. with the wrong number of arguments. Here is an example:
  2180. #define foo a,b
  2181. #define bar(x) lose(x)
  2182. #define lose(x) (1 + (x))
  2183. We would like 'bar(foo)' to turn into '(1 + (foo))', which would
  2184. then turn into '(1 + (a,b))'. Instead, 'bar(foo)' expands into
  2185. 'lose(a,b)', and you get an error because 'lose' requires a single
  2186. argument. In this case, the problem is easily solved by the same
  2187. parentheses that ought to be used to prevent misnesting of
  2188. arithmetic operations:
  2189. #define foo (a,b)
  2190. or
  2191. #define bar(x) lose((x))
  2192. The extra pair of parentheses prevents the comma in 'foo''s
  2193. definition from being interpreted as an argument separator.
  2194. 
  2195. File: cpp.info, Node: Newlines in Arguments, Prev: Argument Prescan, Up: Macro Pitfalls
  2196. 3.10.7 Newlines in Arguments
  2197. ----------------------------
  2198. The invocation of a function-like macro can extend over many logical
  2199. lines. However, in the present implementation, the entire expansion
  2200. comes out on one line. Thus line numbers emitted by the compiler or
  2201. debugger refer to the line the invocation started on, which might be
  2202. different to the line containing the argument causing the problem.
  2203. Here is an example illustrating this:
  2204. #define ignore_second_arg(a,b,c) a; c
  2205. ignore_second_arg (foo (),
  2206. ignored (),
  2207. syntax error);
  2208. The syntax error triggered by the tokens 'syntax error' results in an
  2209. error message citing line three--the line of ignore_second_arg-- even
  2210. though the problematic code comes from line five.
  2211. We consider this a bug, and intend to fix it in the near future.
  2212. 
  2213. File: cpp.info, Node: Conditionals, Next: Diagnostics, Prev: Macros, Up: Top
  2214. 4 Conditionals
  2215. **************
  2216. A "conditional" is a directive that instructs the preprocessor to select
  2217. whether or not to include a chunk of code in the final token stream
  2218. passed to the compiler. Preprocessor conditionals can test arithmetic
  2219. expressions, or whether a name is defined as a macro, or both
  2220. simultaneously using the special 'defined' operator.
  2221. A conditional in the C preprocessor resembles in some ways an 'if'
  2222. statement in C, but it is important to understand the difference between
  2223. them. The condition in an 'if' statement is tested during the execution
  2224. of your program. Its purpose is to allow your program to behave
  2225. differently from run to run, depending on the data it is operating on.
  2226. The condition in a preprocessing conditional directive is tested when
  2227. your program is compiled. Its purpose is to allow different code to be
  2228. included in the program depending on the situation at the time of
  2229. compilation.
  2230. However, the distinction is becoming less clear. Modern compilers
  2231. often do test 'if' statements when a program is compiled, if their
  2232. conditions are known not to vary at run time, and eliminate code which
  2233. can never be executed. If you can count on your compiler to do this,
  2234. you may find that your program is more readable if you use 'if'
  2235. statements with constant conditions (perhaps determined by macros). Of
  2236. course, you can only use this to exclude code, not type definitions or
  2237. other preprocessing directives, and you can only do it if the code
  2238. remains syntactically valid when it is not to be used.
  2239. * Menu:
  2240. * Conditional Uses::
  2241. * Conditional Syntax::
  2242. * Deleted Code::
  2243. 
  2244. File: cpp.info, Node: Conditional Uses, Next: Conditional Syntax, Up: Conditionals
  2245. 4.1 Conditional Uses
  2246. ====================
  2247. There are three general reasons to use a conditional.
  2248. * A program may need to use different code depending on the machine
  2249. or operating system it is to run on. In some cases the code for
  2250. one operating system may be erroneous on another operating system;
  2251. for example, it might refer to data types or constants that do not
  2252. exist on the other system. When this happens, it is not enough to
  2253. avoid executing the invalid code. Its mere presence will cause the
  2254. compiler to reject the program. With a preprocessing conditional,
  2255. the offending code can be effectively excised from the program when
  2256. it is not valid.
  2257. * You may want to be able to compile the same source file into two
  2258. different programs. One version might make frequent time-consuming
  2259. consistency checks on its intermediate data, or print the values of
  2260. those data for debugging, and the other not.
  2261. * A conditional whose condition is always false is one way to exclude
  2262. code from the program but keep it as a sort of comment for future
  2263. reference.
  2264. Simple programs that do not need system-specific logic or complex
  2265. debugging hooks generally will not need to use preprocessing
  2266. conditionals.
  2267. 
  2268. File: cpp.info, Node: Conditional Syntax, Next: Deleted Code, Prev: Conditional Uses, Up: Conditionals
  2269. 4.2 Conditional Syntax
  2270. ======================
  2271. A conditional in the C preprocessor begins with a "conditional
  2272. directive": '#if', '#ifdef' or '#ifndef'.
  2273. * Menu:
  2274. * Ifdef::
  2275. * If::
  2276. * Defined::
  2277. * Else::
  2278. * Elif::
  2279. * __has_attribute::
  2280. * __has_cpp_attribute::
  2281. * __has_builtin::
  2282. * __has_include::
  2283. 
  2284. File: cpp.info, Node: Ifdef, Next: If, Up: Conditional Syntax
  2285. 4.2.1 Ifdef
  2286. -----------
  2287. The simplest sort of conditional is
  2288. #ifdef MACRO
  2289. CONTROLLED TEXT
  2290. #endif /* MACRO */
  2291. This block is called a "conditional group". CONTROLLED TEXT will be
  2292. included in the output of the preprocessor if and only if MACRO is
  2293. defined. We say that the conditional "succeeds" if MACRO is defined,
  2294. "fails" if it is not.
  2295. The CONTROLLED TEXT inside of a conditional can include preprocessing
  2296. directives. They are executed only if the conditional succeeds. You
  2297. can nest conditional groups inside other conditional groups, but they
  2298. must be completely nested. In other words, '#endif' always matches the
  2299. nearest '#ifdef' (or '#ifndef', or '#if'). Also, you cannot start a
  2300. conditional group in one file and end it in another.
  2301. Even if a conditional fails, the CONTROLLED TEXT inside it is still
  2302. run through initial transformations and tokenization. Therefore, it
  2303. must all be lexically valid C. Normally the only way this matters is
  2304. that all comments and string literals inside a failing conditional group
  2305. must still be properly ended.
  2306. The comment following the '#endif' is not required, but it is a good
  2307. practice if there is a lot of CONTROLLED TEXT, because it helps people
  2308. match the '#endif' to the corresponding '#ifdef'. Older programs
  2309. sometimes put MACRO directly after the '#endif' without enclosing it in
  2310. a comment. This is invalid code according to the C standard. CPP
  2311. accepts it with a warning. It never affects which '#ifndef' the
  2312. '#endif' matches.
  2313. Sometimes you wish to use some code if a macro is _not_ defined. You
  2314. can do this by writing '#ifndef' instead of '#ifdef'. One common use of
  2315. '#ifndef' is to include code only the first time a header file is
  2316. included. *Note Once-Only Headers::.
  2317. Macro definitions can vary between compilations for several reasons.
  2318. Here are some samples.
  2319. * Some macros are predefined on each kind of machine (*note
  2320. System-specific Predefined Macros::). This allows you to provide
  2321. code specially tuned for a particular machine.
  2322. * System header files define more macros, associated with the
  2323. features they implement. You can test these macros with
  2324. conditionals to avoid using a system feature on a machine where it
  2325. is not implemented.
  2326. * Macros can be defined or undefined with the '-D' and '-U'
  2327. command-line options when you compile the program. You can arrange
  2328. to compile the same source file into two different programs by
  2329. choosing a macro name to specify which program you want, writing
  2330. conditionals to test whether or how this macro is defined, and then
  2331. controlling the state of the macro with command-line options,
  2332. perhaps set in the Makefile. *Note Invocation::.
  2333. * Your program might have a special header file (often called
  2334. 'config.h') that is adjusted when the program is compiled. It can
  2335. define or not define macros depending on the features of the system
  2336. and the desired capabilities of the program. The adjustment can be
  2337. automated by a tool such as 'autoconf', or done by hand.
  2338. 
  2339. File: cpp.info, Node: If, Next: Defined, Prev: Ifdef, Up: Conditional Syntax
  2340. 4.2.2 If
  2341. --------
  2342. The '#if' directive allows you to test the value of an arithmetic
  2343. expression, rather than the mere existence of one macro. Its syntax is
  2344. #if EXPRESSION
  2345. CONTROLLED TEXT
  2346. #endif /* EXPRESSION */
  2347. EXPRESSION is a C expression of integer type, subject to stringent
  2348. restrictions. It may contain
  2349. * Integer constants.
  2350. * Character constants, which are interpreted as they would be in
  2351. normal code.
  2352. * Arithmetic operators for addition, subtraction, multiplication,
  2353. division, bitwise operations, shifts, comparisons, and logical
  2354. operations ('&&' and '||'). The latter two obey the usual
  2355. short-circuiting rules of standard C.
  2356. * Macros. All macros in the expression are expanded before actual
  2357. computation of the expression's value begins.
  2358. * Uses of the 'defined' operator, which lets you check whether macros
  2359. are defined in the middle of an '#if'.
  2360. * Identifiers that are not macros, which are all considered to be the
  2361. number zero. This allows you to write '#if MACRO' instead of
  2362. '#ifdef MACRO', if you know that MACRO, when defined, will always
  2363. have a nonzero value. Function-like macros used without their
  2364. function call parentheses are also treated as zero.
  2365. In some contexts this shortcut is undesirable. The '-Wundef'
  2366. option causes GCC to warn whenever it encounters an identifier
  2367. which is not a macro in an '#if'.
  2368. The preprocessor does not know anything about types in the language.
  2369. Therefore, 'sizeof' operators are not recognized in '#if', and neither
  2370. are 'enum' constants. They will be taken as identifiers which are not
  2371. macros, and replaced by zero. In the case of 'sizeof', this is likely
  2372. to cause the expression to be invalid.
  2373. The preprocessor calculates the value of EXPRESSION. It carries out
  2374. all calculations in the widest integer type known to the compiler; on
  2375. most machines supported by GCC this is 64 bits. This is not the same
  2376. rule as the compiler uses to calculate the value of a constant
  2377. expression, and may give different results in some cases. If the value
  2378. comes out to be nonzero, the '#if' succeeds and the CONTROLLED TEXT is
  2379. included; otherwise it is skipped.
  2380. 
  2381. File: cpp.info, Node: Defined, Next: Else, Prev: If, Up: Conditional Syntax
  2382. 4.2.3 Defined
  2383. -------------
  2384. The special operator 'defined' is used in '#if' and '#elif' expressions
  2385. to test whether a certain name is defined as a macro. 'defined NAME'
  2386. and 'defined (NAME)' are both expressions whose value is 1 if NAME is
  2387. defined as a macro at the current point in the program, and 0 otherwise.
  2388. Thus, '#if defined MACRO' is precisely equivalent to '#ifdef MACRO'.
  2389. 'defined' is useful when you wish to test more than one macro for
  2390. existence at once. For example,
  2391. #if defined (__vax__) || defined (__ns16000__)
  2392. would succeed if either of the names '__vax__' or '__ns16000__' is
  2393. defined as a macro.
  2394. Conditionals written like this:
  2395. #if defined BUFSIZE && BUFSIZE >= 1024
  2396. can generally be simplified to just '#if BUFSIZE >= 1024', since if
  2397. 'BUFSIZE' is not defined, it will be interpreted as having the value
  2398. zero.
  2399. If the 'defined' operator appears as a result of a macro expansion,
  2400. the C standard says the behavior is undefined. GNU cpp treats it as a
  2401. genuine 'defined' operator and evaluates it normally. It will warn
  2402. wherever your code uses this feature if you use the command-line option
  2403. '-Wpedantic', since other compilers may handle it differently. The
  2404. warning is also enabled by '-Wextra', and can also be enabled
  2405. individually with '-Wexpansion-to-defined'.
  2406. 
  2407. File: cpp.info, Node: Else, Next: Elif, Prev: Defined, Up: Conditional Syntax
  2408. 4.2.4 Else
  2409. ----------
  2410. The '#else' directive can be added to a conditional to provide
  2411. alternative text to be used if the condition fails. This is what it
  2412. looks like:
  2413. #if EXPRESSION
  2414. TEXT-IF-TRUE
  2415. #else /* Not EXPRESSION */
  2416. TEXT-IF-FALSE
  2417. #endif /* Not EXPRESSION */
  2418. If EXPRESSION is nonzero, the TEXT-IF-TRUE is included and the
  2419. TEXT-IF-FALSE is skipped. If EXPRESSION is zero, the opposite happens.
  2420. You can use '#else' with '#ifdef' and '#ifndef', too.
  2421. 
  2422. File: cpp.info, Node: Elif, Next: __has_attribute, Prev: Else, Up: Conditional Syntax
  2423. 4.2.5 Elif
  2424. ----------
  2425. One common case of nested conditionals is used to check for more than
  2426. two possible alternatives. For example, you might have
  2427. #if X == 1
  2428. ...
  2429. #else /* X != 1 */
  2430. #if X == 2
  2431. ...
  2432. #else /* X != 2 */
  2433. ...
  2434. #endif /* X != 2 */
  2435. #endif /* X != 1 */
  2436. Another conditional directive, '#elif', allows this to be abbreviated
  2437. as follows:
  2438. #if X == 1
  2439. ...
  2440. #elif X == 2
  2441. ...
  2442. #else /* X != 2 and X != 1*/
  2443. ...
  2444. #endif /* X != 2 and X != 1*/
  2445. '#elif' stands for "else if". Like '#else', it goes in the middle of
  2446. a conditional group and subdivides it; it does not require a matching
  2447. '#endif' of its own. Like '#if', the '#elif' directive includes an
  2448. expression to be tested. The text following the '#elif' is processed
  2449. only if the original '#if'-condition failed and the '#elif' condition
  2450. succeeds.
  2451. More than one '#elif' can go in the same conditional group. Then the
  2452. text after each '#elif' is processed only if the '#elif' condition
  2453. succeeds after the original '#if' and all previous '#elif' directives
  2454. within it have failed.
  2455. '#else' is allowed after any number of '#elif' directives, but
  2456. '#elif' may not follow '#else'.
  2457. 
  2458. File: cpp.info, Node: __has_attribute, Next: __has_cpp_attribute, Prev: Elif, Up: Conditional Syntax
  2459. 4.2.6 '__has_attribute'
  2460. -----------------------
  2461. The special operator '__has_attribute (OPERAND)' may be used in '#if'
  2462. and '#elif' expressions to test whether the attribute referenced by its
  2463. OPERAND is recognized by GCC. Using the operator in other contexts is
  2464. not valid. In C code, OPERAND must be a valid identifier. In C++ code,
  2465. OPERAND may be optionally introduced by the 'ATTRIBUTE-SCOPE::' prefix.
  2466. The ATTRIBUTE-SCOPE prefix identifies the "namespace" within which the
  2467. attribute is recognized. The scope of GCC attributes is 'gnu' or
  2468. '__gnu__'. The '__has_attribute' operator by itself, without any
  2469. OPERAND or parentheses, acts as a predefined macro so that support for
  2470. it can be tested in portable code. Thus, the recommended use of the
  2471. operator is as follows:
  2472. #if defined __has_attribute
  2473. # if __has_attribute (nonnull)
  2474. # define ATTR_NONNULL __attribute__ ((nonnull))
  2475. # endif
  2476. #endif
  2477. The first '#if' test succeeds only when the operator is supported by
  2478. the version of GCC (or another compiler) being used. Only when that
  2479. test succeeds is it valid to use '__has_attribute' as a preprocessor
  2480. operator. As a result, combining the two tests into a single expression
  2481. as shown below would only be valid with a compiler that supports the
  2482. operator but not with others that don't.
  2483. #if defined __has_attribute && __has_attribute (nonnull) /* not portable */
  2484. ...
  2485. #endif
  2486. 
  2487. File: cpp.info, Node: __has_cpp_attribute, Next: __has_builtin, Prev: __has_attribute, Up: Conditional Syntax
  2488. 4.2.7 '__has_cpp_attribute'
  2489. ---------------------------
  2490. The special operator '__has_cpp_attribute (OPERAND)' may be used in
  2491. '#if' and '#elif' expressions in C++ code to test whether the attribute
  2492. referenced by its OPERAND is recognized by GCC. '__has_cpp_attribute
  2493. (OPERAND)' is equivalent to '__has_attribute (OPERAND)' except that when
  2494. OPERAND designates a supported standard attribute it evaluates to an
  2495. integer constant of the form 'YYYYMM' indicating the year and month when
  2496. the attribute was first introduced into the C++ standard. For
  2497. additional information including the dates of the introduction of
  2498. current standard attributes, see
  2499. SD-6: SG10 Feature Test Recommendations (https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations/).
  2500. 
  2501. File: cpp.info, Node: __has_builtin, Next: __has_include, Prev: __has_cpp_attribute, Up: Conditional Syntax
  2502. 4.2.8 '__has_builtin'
  2503. ---------------------
  2504. The special operator '__has_builtin (OPERAND)' may be used in constant
  2505. integer contexts and in preprocessor '#if' and '#elif' expressions to
  2506. test whether the symbol named by its OPERAND is recognized as a built-in
  2507. function by GCC in the current language and conformance mode. It
  2508. evaluates to a constant integer with a nonzero value if the argument
  2509. refers to such a function, and to zero otherwise. The operator may also
  2510. be used in preprocessor '#if' and '#elif' expressions. The
  2511. '__has_builtin' operator by itself, without any OPERAND or parentheses,
  2512. acts as a predefined macro so that support for it can be tested in
  2513. portable code. Thus, the recommended use of the operator is as follows:
  2514. #if defined __has_builtin
  2515. # if __has_builtin (__builtin_object_size)
  2516. # define builtin_object_size(ptr) __builtin_object_size (ptr, 2)
  2517. # endif
  2518. #endif
  2519. #ifndef builtin_object_size
  2520. # define builtin_object_size(ptr) ((size_t)-1)
  2521. #endif
  2522. 
  2523. File: cpp.info, Node: __has_include, Prev: __has_builtin, Up: Conditional Syntax
  2524. 4.2.9 '__has_include'
  2525. ---------------------
  2526. The special operator '__has_include (OPERAND)' may be used in '#if' and
  2527. '#elif' expressions to test whether the header referenced by its OPERAND
  2528. can be included using the '#include' directive. Using the operator in
  2529. other contexts is not valid. The OPERAND takes the same form as the
  2530. file in the '#include' directive (*note Include Syntax::) and evaluates
  2531. to a nonzero value if the header can be included and to zero otherwise.
  2532. Note that that the ability to include a header doesn't imply that the
  2533. header doesn't contain invalid constructs or '#error' directives that
  2534. would cause the preprocessor to fail.
  2535. The '__has_include' operator by itself, without any OPERAND or
  2536. parentheses, acts as a predefined macro so that support for it can be
  2537. tested in portable code. Thus, the recommended use of the operator is
  2538. as follows:
  2539. #if defined __has_include
  2540. # if __has_include (<stdatomic.h>)
  2541. # include <stdatomic.h>
  2542. # endif
  2543. #endif
  2544. The first '#if' test succeeds only when the operator is supported by
  2545. the version of GCC (or another compiler) being used. Only when that
  2546. test succeeds is it valid to use '__has_include' as a preprocessor
  2547. operator. As a result, combining the two tests into a single expression
  2548. as shown below would only be valid with a compiler that supports the
  2549. operator but not with others that don't.
  2550. #if defined __has_include && __has_include ("header.h") /* not portable */
  2551. ...
  2552. #endif
  2553. 
  2554. File: cpp.info, Node: Deleted Code, Prev: Conditional Syntax, Up: Conditionals
  2555. 4.3 Deleted Code
  2556. ================
  2557. If you replace or delete a part of the program but want to keep the old
  2558. code around for future reference, you often cannot simply comment it
  2559. out. Block comments do not nest, so the first comment inside the old
  2560. code will end the commenting-out. The probable result is a flood of
  2561. syntax errors.
  2562. One way to avoid this problem is to use an always-false conditional
  2563. instead. For instance, put '#if 0' before the deleted code and '#endif'
  2564. after it. This works even if the code being turned off contains
  2565. conditionals, but they must be entire conditionals (balanced '#if' and
  2566. '#endif').
  2567. Some people use '#ifdef notdef' instead. This is risky, because
  2568. 'notdef' might be accidentally defined as a macro, and then the
  2569. conditional would succeed. '#if 0' can be counted on to fail.
  2570. Do not use '#if 0' for comments which are not C code. Use a real
  2571. comment, instead. The interior of '#if 0' must consist of complete
  2572. tokens; in particular, single-quote characters must balance. Comments
  2573. often contain unbalanced single-quote characters (known in English as
  2574. apostrophes). These confuse '#if 0'. They don't confuse '/*'.
  2575. 
  2576. File: cpp.info, Node: Diagnostics, Next: Line Control, Prev: Conditionals, Up: Top
  2577. 5 Diagnostics
  2578. *************
  2579. The directive '#error' causes the preprocessor to report a fatal error.
  2580. The tokens forming the rest of the line following '#error' are used as
  2581. the error message.
  2582. You would use '#error' inside of a conditional that detects a
  2583. combination of parameters which you know the program does not properly
  2584. support. For example, if you know that the program will not run
  2585. properly on a VAX, you might write
  2586. #ifdef __vax__
  2587. #error "Won't work on VAXen. See comments at get_last_object."
  2588. #endif
  2589. If you have several configuration parameters that must be set up by
  2590. the installation in a consistent way, you can use conditionals to detect
  2591. an inconsistency and report it with '#error'. For example,
  2592. #if !defined(FOO) && defined(BAR)
  2593. #error "BAR requires FOO."
  2594. #endif
  2595. The directive '#warning' is like '#error', but causes the
  2596. preprocessor to issue a warning and continue preprocessing. The tokens
  2597. following '#warning' are used as the warning message.
  2598. You might use '#warning' in obsolete header files, with a message
  2599. directing the user to the header file which should be used instead.
  2600. Neither '#error' nor '#warning' macro-expands its argument. Internal
  2601. whitespace sequences are each replaced with a single space. The line
  2602. must consist of complete tokens. It is wisest to make the argument of
  2603. these directives be a single string constant; this avoids problems with
  2604. apostrophes and the like.
  2605. 
  2606. File: cpp.info, Node: Line Control, Next: Pragmas, Prev: Diagnostics, Up: Top
  2607. 6 Line Control
  2608. **************
  2609. The C preprocessor informs the C compiler of the location in your source
  2610. code where each token came from. Presently, this is just the file name
  2611. and line number. All the tokens resulting from macro expansion are
  2612. reported as having appeared on the line of the source file where the
  2613. outermost macro was used. We intend to be more accurate in the future.
  2614. If you write a program which generates source code, such as the
  2615. 'bison' parser generator, you may want to adjust the preprocessor's
  2616. notion of the current file name and line number by hand. Parts of the
  2617. output from 'bison' are generated from scratch, other parts come from a
  2618. standard parser file. The rest are copied verbatim from 'bison''s
  2619. input. You would like compiler error messages and symbolic debuggers to
  2620. be able to refer to 'bison''s input file.
  2621. 'bison' or any such program can arrange this by writing '#line'
  2622. directives into the output file. '#line' is a directive that specifies
  2623. the original line number and source file name for subsequent input in
  2624. the current preprocessor input file. '#line' has three variants:
  2625. '#line LINENUM'
  2626. LINENUM is a non-negative decimal integer constant. It specifies
  2627. the line number which should be reported for the following line of
  2628. input. Subsequent lines are counted from LINENUM.
  2629. '#line LINENUM FILENAME'
  2630. LINENUM is the same as for the first form, and has the same effect.
  2631. In addition, FILENAME is a string constant. The following line and
  2632. all subsequent lines are reported to come from the file it
  2633. specifies, until something else happens to change that. FILENAME
  2634. is interpreted according to the normal rules for a string constant:
  2635. backslash escapes are interpreted. This is different from
  2636. '#include'.
  2637. '#line ANYTHING ELSE'
  2638. ANYTHING ELSE is checked for macro calls, which are expanded. The
  2639. result should match one of the above two forms.
  2640. '#line' directives alter the results of the '__FILE__' and '__LINE__'
  2641. predefined macros from that point on. *Note Standard Predefined
  2642. Macros::. They do not have any effect on '#include''s idea of the
  2643. directory containing the current file.
  2644. 
  2645. File: cpp.info, Node: Pragmas, Next: Other Directives, Prev: Line Control, Up: Top
  2646. 7 Pragmas
  2647. *********
  2648. The '#pragma' directive is the method specified by the C standard for
  2649. providing additional information to the compiler, beyond what is
  2650. conveyed in the language itself. The forms of this directive (commonly
  2651. known as "pragmas") specified by C standard are prefixed with 'STDC'. A
  2652. C compiler is free to attach any meaning it likes to other pragmas.
  2653. Most GNU-defined, supported pragmas have been given a 'GCC' prefix.
  2654. C99 introduced the '_Pragma' operator. This feature addresses a
  2655. major problem with '#pragma': being a directive, it cannot be produced
  2656. as the result of macro expansion. '_Pragma' is an operator, much like
  2657. 'sizeof' or 'defined', and can be embedded in a macro.
  2658. Its syntax is '_Pragma (STRING-LITERAL)', where STRING-LITERAL can be
  2659. either a normal or wide-character string literal. It is destringized,
  2660. by replacing all '\\' with a single '\' and all '\"' with a '"'. The
  2661. result is then processed as if it had appeared as the right hand side of
  2662. a '#pragma' directive. For example,
  2663. _Pragma ("GCC dependency \"parse.y\"")
  2664. has the same effect as '#pragma GCC dependency "parse.y"'. The same
  2665. effect could be achieved using macros, for example
  2666. #define DO_PRAGMA(x) _Pragma (#x)
  2667. DO_PRAGMA (GCC dependency "parse.y")
  2668. The standard is unclear on where a '_Pragma' operator can appear.
  2669. The preprocessor does not accept it within a preprocessing conditional
  2670. directive like '#if'. To be safe, you are probably best keeping it out
  2671. of directives other than '#define', and putting it on a line of its own.
  2672. This manual documents the pragmas which are meaningful to the
  2673. preprocessor itself. Other pragmas are meaningful to the C or C++
  2674. compilers. They are documented in the GCC manual.
  2675. GCC plugins may provide their own pragmas.
  2676. '#pragma GCC dependency'
  2677. '#pragma GCC dependency' allows you to check the relative dates of
  2678. the current file and another file. If the other file is more
  2679. recent than the current file, a warning is issued. This is useful
  2680. if the current file is derived from the other file, and should be
  2681. regenerated. The other file is searched for using the normal
  2682. include search path. Optional trailing text can be used to give
  2683. more information in the warning message.
  2684. #pragma GCC dependency "parse.y"
  2685. #pragma GCC dependency "/usr/include/time.h" rerun fixincludes
  2686. '#pragma GCC poison'
  2687. Sometimes, there is an identifier that you want to remove
  2688. completely from your program, and make sure that it never creeps
  2689. back in. To enforce this, you can "poison" the identifier with
  2690. this pragma. '#pragma GCC poison' is followed by a list of
  2691. identifiers to poison. If any of those identifiers appears
  2692. anywhere in the source after the directive, it is a hard error.
  2693. For example,
  2694. #pragma GCC poison printf sprintf fprintf
  2695. sprintf(some_string, "hello");
  2696. will produce an error.
  2697. If a poisoned identifier appears as part of the expansion of a
  2698. macro which was defined before the identifier was poisoned, it will
  2699. _not_ cause an error. This lets you poison an identifier without
  2700. worrying about system headers defining macros that use it.
  2701. For example,
  2702. #define strrchr rindex
  2703. #pragma GCC poison rindex
  2704. strrchr(some_string, 'h');
  2705. will not produce an error.
  2706. '#pragma GCC system_header'
  2707. This pragma takes no arguments. It causes the rest of the code in
  2708. the current file to be treated as if it came from a system header.
  2709. *Note System Headers::.
  2710. '#pragma GCC warning'
  2711. '#pragma GCC error'
  2712. '#pragma GCC warning "message"' causes the preprocessor to issue a
  2713. warning diagnostic with the text 'message'. The message contained
  2714. in the pragma must be a single string literal. Similarly, '#pragma
  2715. GCC error "message"' issues an error message. Unlike the
  2716. '#warning' and '#error' directives, these pragmas can be embedded
  2717. in preprocessor macros using '_Pragma'.
  2718. '#pragma once'
  2719. If '#pragma once' is seen when scanning a header file, that file
  2720. will never be read again, no matter what. It is a less-portable
  2721. alternative to using '#ifndef' to guard the contents of header
  2722. files against multiple inclusions.
  2723. 
  2724. File: cpp.info, Node: Other Directives, Next: Preprocessor Output, Prev: Pragmas, Up: Top
  2725. 8 Other Directives
  2726. ******************
  2727. The '#ident' directive takes one argument, a string constant. On some
  2728. systems, that string constant is copied into a special segment of the
  2729. object file. On other systems, the directive is ignored. The '#sccs'
  2730. directive is a synonym for '#ident'.
  2731. These directives are not part of the C standard, but they are not
  2732. official GNU extensions either. What historical information we have
  2733. been able to find, suggests they originated with System V.
  2734. The "null directive" consists of a '#' followed by a newline, with
  2735. only whitespace (including comments) in between. A null directive is
  2736. understood as a preprocessing directive but has no effect on the
  2737. preprocessor output. The primary significance of the existence of the
  2738. null directive is that an input line consisting of just a '#' will
  2739. produce no output, rather than a line of output containing just a '#'.
  2740. Supposedly some old C programs contain such lines.
  2741. 
  2742. File: cpp.info, Node: Preprocessor Output, Next: Traditional Mode, Prev: Other Directives, Up: Top
  2743. 9 Preprocessor Output
  2744. *********************
  2745. When the C preprocessor is used with the C, C++, or Objective-C
  2746. compilers, it is integrated into the compiler and communicates a stream
  2747. of binary tokens directly to the compiler's parser. However, it can
  2748. also be used in the more conventional standalone mode, where it produces
  2749. textual output.
  2750. The output from the C preprocessor looks much like the input, except
  2751. that all preprocessing directive lines have been replaced with blank
  2752. lines and all comments with spaces. Long runs of blank lines are
  2753. discarded.
  2754. The ISO standard specifies that it is implementation defined whether
  2755. a preprocessor preserves whitespace between tokens, or replaces it with
  2756. e.g. a single space. In GNU CPP, whitespace between tokens is collapsed
  2757. to become a single space, with the exception that the first token on a
  2758. non-directive line is preceded with sufficient spaces that it appears in
  2759. the same column in the preprocessed output that it appeared in the
  2760. original source file. This is so the output is easy to read. CPP does
  2761. not insert any whitespace where there was none in the original source,
  2762. except where necessary to prevent an accidental token paste.
  2763. Source file name and line number information is conveyed by lines of
  2764. the form
  2765. # LINENUM FILENAME FLAGS
  2766. These are called "linemarkers". They are inserted as needed into the
  2767. output (but never within a string or character constant). They mean
  2768. that the following line originated in file FILENAME at line LINENUM.
  2769. FILENAME will never contain any non-printing characters; they are
  2770. replaced with octal escape sequences.
  2771. After the file name comes zero or more flags, which are '1', '2',
  2772. '3', or '4'. If there are multiple flags, spaces separate them. Here
  2773. is what the flags mean:
  2774. '1'
  2775. This indicates the start of a new file.
  2776. '2'
  2777. This indicates returning to a file (after having included another
  2778. file).
  2779. '3'
  2780. This indicates that the following text comes from a system header
  2781. file, so certain warnings should be suppressed.
  2782. '4'
  2783. This indicates that the following text should be treated as being
  2784. wrapped in an implicit 'extern "C"' block.
  2785. As an extension, the preprocessor accepts linemarkers in
  2786. non-assembler input files. They are treated like the corresponding
  2787. '#line' directive, (*note Line Control::), except that trailing flags
  2788. are permitted, and are interpreted with the meanings described above.
  2789. If multiple flags are given, they must be in ascending order.
  2790. Some directives may be duplicated in the output of the preprocessor.
  2791. These are '#ident' (always), '#pragma' (only if the preprocessor does
  2792. not handle the pragma itself), and '#define' and '#undef' (with certain
  2793. debugging options). If this happens, the '#' of the directive will
  2794. always be in the first column, and there will be no space between the
  2795. '#' and the directive name. If macro expansion happens to generate
  2796. tokens which might be mistaken for a duplicated directive, a space will
  2797. be inserted between the '#' and the directive name.
  2798. 
  2799. File: cpp.info, Node: Traditional Mode, Next: Implementation Details, Prev: Preprocessor Output, Up: Top
  2800. 10 Traditional Mode
  2801. *******************
  2802. Traditional (pre-standard) C preprocessing is rather different from the
  2803. preprocessing specified by the standard. When the preprocessor is
  2804. invoked with the '-traditional-cpp' option, it attempts to emulate a
  2805. traditional preprocessor.
  2806. This mode is not useful for compiling C code with GCC, but is
  2807. intended for use with non-C preprocessing applications. Thus
  2808. traditional mode semantics are supported only when invoking the
  2809. preprocessor explicitly, and not in the compiler front ends.
  2810. The implementation does not correspond precisely to the behavior of
  2811. early pre-standard versions of GCC, nor to any true traditional
  2812. preprocessor. After all, inconsistencies among traditional
  2813. implementations were a major motivation for C standardization. However,
  2814. we intend that it should be compatible with true traditional
  2815. preprocessors in all ways that actually matter.
  2816. * Menu:
  2817. * Traditional lexical analysis::
  2818. * Traditional macros::
  2819. * Traditional miscellany::
  2820. * Traditional warnings::
  2821. 
  2822. File: cpp.info, Node: Traditional lexical analysis, Next: Traditional macros, Up: Traditional Mode
  2823. 10.1 Traditional lexical analysis
  2824. =================================
  2825. The traditional preprocessor does not decompose its input into tokens
  2826. the same way a standards-conforming preprocessor does. The input is
  2827. simply treated as a stream of text with minimal internal form.
  2828. This implementation does not treat trigraphs (*note trigraphs::)
  2829. specially since they were an invention of the standards committee. It
  2830. handles arbitrarily-positioned escaped newlines properly and splices the
  2831. lines as you would expect; many traditional preprocessors did not do
  2832. this.
  2833. The form of horizontal whitespace in the input file is preserved in
  2834. the output. In particular, hard tabs remain hard tabs. This can be
  2835. useful if, for example, you are preprocessing a Makefile.
  2836. Traditional CPP only recognizes C-style block comments, and treats
  2837. the '/*' sequence as introducing a comment only if it lies outside
  2838. quoted text. Quoted text is introduced by the usual single and double
  2839. quotes, and also by an initial '<' in a '#include' directive.
  2840. Traditionally, comments are completely removed and are not replaced
  2841. with a space. Since a traditional compiler does its own tokenization of
  2842. the output of the preprocessor, this means that comments can effectively
  2843. be used as token paste operators. However, comments behave like
  2844. separators for text handled by the preprocessor itself, since it doesn't
  2845. re-lex its input. For example, in
  2846. #if foo/**/bar
  2847. 'foo' and 'bar' are distinct identifiers and expanded separately if they
  2848. happen to be macros. In other words, this directive is equivalent to
  2849. #if foo bar
  2850. rather than
  2851. #if foobar
  2852. Generally speaking, in traditional mode an opening quote need not
  2853. have a matching closing quote. In particular, a macro may be defined
  2854. with replacement text that contains an unmatched quote. Of course, if
  2855. you attempt to compile preprocessed output containing an unmatched quote
  2856. you will get a syntax error.
  2857. However, all preprocessing directives other than '#define' require
  2858. matching quotes. For example:
  2859. #define m This macro's fine and has an unmatched quote
  2860. "/* This is not a comment. */
  2861. /* This is a comment. The following #include directive
  2862. is ill-formed. */
  2863. #include <stdio.h
  2864. Just as for the ISO preprocessor, what would be a closing quote can
  2865. be escaped with a backslash to prevent the quoted text from closing.
  2866. 
  2867. File: cpp.info, Node: Traditional macros, Next: Traditional miscellany, Prev: Traditional lexical analysis, Up: Traditional Mode
  2868. 10.2 Traditional macros
  2869. =======================
  2870. The major difference between traditional and ISO macros is that the
  2871. former expand to text rather than to a token sequence. CPP removes all
  2872. leading and trailing horizontal whitespace from a macro's replacement
  2873. text before storing it, but preserves the form of internal whitespace.
  2874. One consequence is that it is legitimate for the replacement text to
  2875. contain an unmatched quote (*note Traditional lexical analysis::). An
  2876. unclosed string or character constant continues into the text following
  2877. the macro call. Similarly, the text at the end of a macro's expansion
  2878. can run together with the text after the macro invocation to produce a
  2879. single token.
  2880. Normally comments are removed from the replacement text after the
  2881. macro is expanded, but if the '-CC' option is passed on the command-line
  2882. comments are preserved. (In fact, the current implementation removes
  2883. comments even before saving the macro replacement text, but it careful
  2884. to do it in such a way that the observed effect is identical even in the
  2885. function-like macro case.)
  2886. The ISO stringizing operator '#' and token paste operator '##' have
  2887. no special meaning. As explained later, an effect similar to these
  2888. operators can be obtained in a different way. Macro names that are
  2889. embedded in quotes, either from the main file or after macro
  2890. replacement, do not expand.
  2891. CPP replaces an unquoted object-like macro name with its replacement
  2892. text, and then rescans it for further macros to replace. Unlike
  2893. standard macro expansion, traditional macro expansion has no provision
  2894. to prevent recursion. If an object-like macro appears unquoted in its
  2895. replacement text, it will be replaced again during the rescan pass, and
  2896. so on _ad infinitum_. GCC detects when it is expanding recursive
  2897. macros, emits an error message, and continues after the offending macro
  2898. invocation.
  2899. #define PLUS +
  2900. #define INC(x) PLUS+x
  2901. INC(foo);
  2902. ==> ++foo;
  2903. Function-like macros are similar in form but quite different in
  2904. behavior to their ISO counterparts. Their arguments are contained
  2905. within parentheses, are comma-separated, and can cross physical lines.
  2906. Commas within nested parentheses are not treated as argument separators.
  2907. Similarly, a quote in an argument cannot be left unclosed; a following
  2908. comma or parenthesis that comes before the closing quote is treated like
  2909. any other character. There is no facility for handling variadic macros.
  2910. This implementation removes all comments from macro arguments, unless
  2911. the '-C' option is given. The form of all other horizontal whitespace
  2912. in arguments is preserved, including leading and trailing whitespace.
  2913. In particular
  2914. f( )
  2915. is treated as an invocation of the macro 'f' with a single argument
  2916. consisting of a single space. If you want to invoke a function-like
  2917. macro that takes no arguments, you must not leave any whitespace between
  2918. the parentheses.
  2919. If a macro argument crosses a new line, the new line is replaced with
  2920. a space when forming the argument. If the previous line contained an
  2921. unterminated quote, the following line inherits the quoted state.
  2922. Traditional preprocessors replace parameters in the replacement text
  2923. with their arguments regardless of whether the parameters are within
  2924. quotes or not. This provides a way to stringize arguments. For example
  2925. #define str(x) "x"
  2926. str(/* A comment */some text )
  2927. ==> "some text "
  2928. Note that the comment is removed, but that the trailing space is
  2929. preserved. Here is an example of using a comment to effect token
  2930. pasting.
  2931. #define suffix(x) foo_/**/x
  2932. suffix(bar)
  2933. ==> foo_bar
  2934. 
  2935. File: cpp.info, Node: Traditional miscellany, Next: Traditional warnings, Prev: Traditional macros, Up: Traditional Mode
  2936. 10.3 Traditional miscellany
  2937. ===========================
  2938. Here are some things to be aware of when using the traditional
  2939. preprocessor.
  2940. * Preprocessing directives are recognized only when their leading '#'
  2941. appears in the first column. There can be no whitespace between
  2942. the beginning of the line and the '#', but whitespace can follow
  2943. the '#'.
  2944. * A true traditional C preprocessor does not recognize '#error' or
  2945. '#pragma', and may not recognize '#elif'. CPP supports all the
  2946. directives in traditional mode that it supports in ISO mode,
  2947. including extensions, with the exception that the effects of
  2948. '#pragma GCC poison' are undefined.
  2949. * __STDC__ is not defined.
  2950. * If you use digraphs the behavior is undefined.
  2951. * If a line that looks like a directive appears within macro
  2952. arguments, the behavior is undefined.
  2953. 
  2954. File: cpp.info, Node: Traditional warnings, Prev: Traditional miscellany, Up: Traditional Mode
  2955. 10.4 Traditional warnings
  2956. =========================
  2957. You can request warnings about features that did not exist, or worked
  2958. differently, in traditional C with the '-Wtraditional' option. GCC does
  2959. not warn about features of ISO C which you must use when you are using a
  2960. conforming compiler, such as the '#' and '##' operators.
  2961. Presently '-Wtraditional' warns about:
  2962. * Macro parameters that appear within string literals in the macro
  2963. body. In traditional C macro replacement takes place within string
  2964. literals, but does not in ISO C.
  2965. * In traditional C, some preprocessor directives did not exist.
  2966. Traditional preprocessors would only consider a line to be a
  2967. directive if the '#' appeared in column 1 on the line. Therefore
  2968. '-Wtraditional' warns about directives that traditional C
  2969. understands but would ignore because the '#' does not appear as the
  2970. first character on the line. It also suggests you hide directives
  2971. like '#pragma' not understood by traditional C by indenting them.
  2972. Some traditional implementations would not recognize '#elif', so it
  2973. suggests avoiding it altogether.
  2974. * A function-like macro that appears without an argument list. In
  2975. some traditional preprocessors this was an error. In ISO C it
  2976. merely means that the macro is not expanded.
  2977. * The unary plus operator. This did not exist in traditional C.
  2978. * The 'U' and 'LL' integer constant suffixes, which were not
  2979. available in traditional C. (Traditional C does support the 'L'
  2980. suffix for simple long integer constants.) You are not warned
  2981. about uses of these suffixes in macros defined in system headers.
  2982. For instance, 'UINT_MAX' may well be defined as '4294967295U', but
  2983. you will not be warned if you use 'UINT_MAX'.
  2984. You can usually avoid the warning, and the related warning about
  2985. constants which are so large that they are unsigned, by writing the
  2986. integer constant in question in hexadecimal, with no U suffix.
  2987. Take care, though, because this gives the wrong result in exotic
  2988. cases.
  2989. 
  2990. File: cpp.info, Node: Implementation Details, Next: Invocation, Prev: Traditional Mode, Up: Top
  2991. 11 Implementation Details
  2992. *************************
  2993. Here we document details of how the preprocessor's implementation
  2994. affects its user-visible behavior. You should try to avoid undue
  2995. reliance on behavior described here, as it is possible that it will
  2996. change subtly in future implementations.
  2997. Also documented here are obsolete features still supported by CPP.
  2998. * Menu:
  2999. * Implementation-defined behavior::
  3000. * Implementation limits::
  3001. * Obsolete Features::
  3002. 
  3003. File: cpp.info, Node: Implementation-defined behavior, Next: Implementation limits, Up: Implementation Details
  3004. 11.1 Implementation-defined behavior
  3005. ====================================
  3006. This is how CPP behaves in all the cases which the C standard describes
  3007. as "implementation-defined". This term means that the implementation is
  3008. free to do what it likes, but must document its choice and stick to it.
  3009. * The mapping of physical source file multi-byte characters to the
  3010. execution character set.
  3011. The input character set can be specified using the
  3012. '-finput-charset' option, while the execution character set may be
  3013. controlled using the '-fexec-charset' and '-fwide-exec-charset'
  3014. options.
  3015. * Identifier characters.
  3016. The C and C++ standards allow identifiers to be composed of '_' and
  3017. the alphanumeric characters. C++ also allows universal character
  3018. names. C99 and later C standards permit both universal character
  3019. names and implementation-defined characters. In both C and C++
  3020. modes, GCC accepts in identifiers exactly those extended characters
  3021. that correspond to universal character names permitted by the
  3022. chosen standard.
  3023. GCC allows the '$' character in identifiers as an extension for
  3024. most targets. This is true regardless of the 'std=' switch, since
  3025. this extension cannot conflict with standards-conforming programs.
  3026. When preprocessing assembler, however, dollars are not identifier
  3027. characters by default.
  3028. Currently the targets that by default do not permit '$' are AVR,
  3029. IP2K, MMIX, MIPS Irix 3, ARM aout, and PowerPC targets for the AIX
  3030. operating system.
  3031. You can override the default with '-fdollars-in-identifiers' or
  3032. 'fno-dollars-in-identifiers'. *Note fdollars-in-identifiers::.
  3033. * Non-empty sequences of whitespace characters.
  3034. In textual output, each whitespace sequence is collapsed to a
  3035. single space. For aesthetic reasons, the first token on each
  3036. non-directive line of output is preceded with sufficient spaces
  3037. that it appears in the same column as it did in the original source
  3038. file.
  3039. * The numeric value of character constants in preprocessor
  3040. expressions.
  3041. The preprocessor and compiler interpret character constants in the
  3042. same way; i.e. escape sequences such as '\a' are given the values
  3043. they would have on the target machine.
  3044. The compiler evaluates a multi-character character constant a
  3045. character at a time, shifting the previous value left by the number
  3046. of bits per target character, and then or-ing in the bit-pattern of
  3047. the new character truncated to the width of a target character.
  3048. The final bit-pattern is given type 'int', and is therefore signed,
  3049. regardless of whether single characters are signed or not. If
  3050. there are more characters in the constant than would fit in the
  3051. target 'int' the compiler issues a warning, and the excess leading
  3052. characters are ignored.
  3053. For example, ''ab'' for a target with an 8-bit 'char' would be
  3054. interpreted as
  3055. '(int) ((unsigned char) 'a' * 256 + (unsigned char) 'b')', and
  3056. ''\234a'' as
  3057. '(int) ((unsigned char) '\234' * 256 + (unsigned char) 'a')'.
  3058. * Source file inclusion.
  3059. For a discussion on how the preprocessor locates header files,
  3060. *note Include Operation::.
  3061. * Interpretation of the filename resulting from a macro-expanded
  3062. '#include' directive.
  3063. *Note Computed Includes::.
  3064. * Treatment of a '#pragma' directive that after macro-expansion
  3065. results in a standard pragma.
  3066. No macro expansion occurs on any '#pragma' directive line, so the
  3067. question does not arise.
  3068. Note that GCC does not yet implement any of the standard pragmas.
  3069. 
  3070. File: cpp.info, Node: Implementation limits, Next: Obsolete Features, Prev: Implementation-defined behavior, Up: Implementation Details
  3071. 11.2 Implementation limits
  3072. ==========================
  3073. CPP has a small number of internal limits. This section lists the
  3074. limits which the C standard requires to be no lower than some minimum,
  3075. and all the others known. It is intended that there should be as few
  3076. limits as possible. If you encounter an undocumented or inconvenient
  3077. limit, please report that as a bug. *Note Reporting Bugs: (gcc)Bugs.
  3078. Where we say something is limited "only by available memory", that
  3079. means that internal data structures impose no intrinsic limit, and space
  3080. is allocated with 'malloc' or equivalent. The actual limit will
  3081. therefore depend on many things, such as the size of other things
  3082. allocated by the compiler at the same time, the amount of memory
  3083. consumed by other processes on the same computer, etc.
  3084. * Nesting levels of '#include' files.
  3085. We impose an arbitrary limit of 200 levels, to avoid runaway
  3086. recursion. The standard requires at least 15 levels.
  3087. * Nesting levels of conditional inclusion.
  3088. The C standard mandates this be at least 63. CPP is limited only
  3089. by available memory.
  3090. * Levels of parenthesized expressions within a full expression.
  3091. The C standard requires this to be at least 63. In preprocessor
  3092. conditional expressions, it is limited only by available memory.
  3093. * Significant initial characters in an identifier or macro name.
  3094. The preprocessor treats all characters as significant. The C
  3095. standard requires only that the first 63 be significant.
  3096. * Number of macros simultaneously defined in a single translation
  3097. unit.
  3098. The standard requires at least 4095 be possible. CPP is limited
  3099. only by available memory.
  3100. * Number of parameters in a macro definition and arguments in a macro
  3101. call.
  3102. We allow 'USHRT_MAX', which is no smaller than 65,535. The minimum
  3103. required by the standard is 127.
  3104. * Number of characters on a logical source line.
  3105. The C standard requires a minimum of 4096 be permitted. CPP places
  3106. no limits on this, but you may get incorrect column numbers
  3107. reported in diagnostics for lines longer than 65,535 characters.
  3108. * Maximum size of a source file.
  3109. The standard does not specify any lower limit on the maximum size
  3110. of a source file. GNU cpp maps files into memory, so it is limited
  3111. by the available address space. This is generally at least two
  3112. gigabytes. Depending on the operating system, the size of physical
  3113. memory may or may not be a limitation.
  3114. 
  3115. File: cpp.info, Node: Obsolete Features, Prev: Implementation limits, Up: Implementation Details
  3116. 11.3 Obsolete Features
  3117. ======================
  3118. CPP has some features which are present mainly for compatibility with
  3119. older programs. We discourage their use in new code. In some cases, we
  3120. plan to remove the feature in a future version of GCC.
  3121. 11.3.1 Assertions
  3122. -----------------
  3123. "Assertions" are a deprecated alternative to macros in writing
  3124. conditionals to test what sort of computer or system the compiled
  3125. program will run on. Assertions are usually predefined, but you can
  3126. define them with preprocessing directives or command-line options.
  3127. Assertions were intended to provide a more systematic way to describe
  3128. the compiler's target system and we added them for compatibility with
  3129. existing compilers. In practice they are just as unpredictable as the
  3130. system-specific predefined macros. In addition, they are not part of
  3131. any standard, and only a few compilers support them. Therefore, the use
  3132. of assertions is *less* portable than the use of system-specific
  3133. predefined macros. We recommend you do not use them at all.
  3134. An assertion looks like this:
  3135. #PREDICATE (ANSWER)
  3136. PREDICATE must be a single identifier. ANSWER can be any sequence of
  3137. tokens; all characters are significant except for leading and trailing
  3138. whitespace, and differences in internal whitespace sequences are
  3139. ignored. (This is similar to the rules governing macro redefinition.)
  3140. Thus, '(x + y)' is different from '(x+y)' but equivalent to '( x + y )'.
  3141. Parentheses do not nest inside an answer.
  3142. To test an assertion, you write it in an '#if'. For example, this
  3143. conditional succeeds if either 'vax' or 'ns16000' has been asserted as
  3144. an answer for 'machine'.
  3145. #if #machine (vax) || #machine (ns16000)
  3146. You can test whether _any_ answer is asserted for a predicate by
  3147. omitting the answer in the conditional:
  3148. #if #machine
  3149. Assertions are made with the '#assert' directive. Its sole argument
  3150. is the assertion to make, without the leading '#' that identifies
  3151. assertions in conditionals.
  3152. #assert PREDICATE (ANSWER)
  3153. You may make several assertions with the same predicate and different
  3154. answers. Subsequent assertions do not override previous ones for the
  3155. same predicate. All the answers for any given predicate are
  3156. simultaneously true.
  3157. Assertions can be canceled with the '#unassert' directive. It has
  3158. the same syntax as '#assert'. In that form it cancels only the answer
  3159. which was specified on the '#unassert' line; other answers for that
  3160. predicate remain true. You can cancel an entire predicate by leaving
  3161. out the answer:
  3162. #unassert PREDICATE
  3163. In either form, if no such assertion has been made, '#unassert' has no
  3164. effect.
  3165. You can also make or cancel assertions using command-line options.
  3166. *Note Invocation::.
  3167. 
  3168. File: cpp.info, Node: Invocation, Next: Environment Variables, Prev: Implementation Details, Up: Top
  3169. 12 Invocation
  3170. *************
  3171. Most often when you use the C preprocessor you do not have to invoke it
  3172. explicitly: the C compiler does so automatically. However, the
  3173. preprocessor is sometimes useful on its own. You can invoke the
  3174. preprocessor either with the 'cpp' command, or via 'gcc -E'. In GCC,
  3175. the preprocessor is actually integrated with the compiler rather than a
  3176. separate program, and both of these commands invoke GCC and tell it to
  3177. stop after the preprocessing phase.
  3178. The 'cpp' options listed here are also accepted by 'gcc' and have the
  3179. same meaning. Likewise the 'cpp' command accepts all the usual 'gcc'
  3180. driver options, although those pertaining to compilation phases after
  3181. preprocessing are ignored.
  3182. Only options specific to preprocessing behavior are documented here.
  3183. Refer to the GCC manual for full documentation of other driver options.
  3184. The 'cpp' command expects two file names as arguments, INFILE and
  3185. OUTFILE. The preprocessor reads INFILE together with any other files it
  3186. specifies with '#include'. All the output generated by the combined
  3187. input files is written in OUTFILE.
  3188. Either INFILE or OUTFILE may be '-', which as INFILE means to read
  3189. from standard input and as OUTFILE means to write to standard output.
  3190. If either file is omitted, it means the same as if '-' had been
  3191. specified for that file. You can also use the '-o OUTFILE' option to
  3192. specify the output file.
  3193. Unless otherwise noted, or the option ends in '=', all options which
  3194. take an argument may have that argument appear either immediately after
  3195. the option, or with a space between option and argument: '-Ifoo' and '-I
  3196. foo' have the same effect.
  3197. Many options have multi-letter names; therefore multiple
  3198. single-letter options may _not_ be grouped: '-dM' is very different from
  3199. '-d -M'.
  3200. '-D NAME'
  3201. Predefine NAME as a macro, with definition '1'.
  3202. '-D NAME=DEFINITION'
  3203. The contents of DEFINITION are tokenized and processed as if they
  3204. appeared during translation phase three in a '#define' directive.
  3205. In particular, the definition is truncated by embedded newline
  3206. characters.
  3207. If you are invoking the preprocessor from a shell or shell-like
  3208. program you may need to use the shell's quoting syntax to protect
  3209. characters such as spaces that have a meaning in the shell syntax.
  3210. If you wish to define a function-like macro on the command line,
  3211. write its argument list with surrounding parentheses before the
  3212. equals sign (if any). Parentheses are meaningful to most shells,
  3213. so you should quote the option. With 'sh' and 'csh',
  3214. '-D'NAME(ARGS...)=DEFINITION'' works.
  3215. '-D' and '-U' options are processed in the order they are given on
  3216. the command line. All '-imacros FILE' and '-include FILE' options
  3217. are processed after all '-D' and '-U' options.
  3218. '-U NAME'
  3219. Cancel any previous definition of NAME, either built in or provided
  3220. with a '-D' option.
  3221. '-include FILE'
  3222. Process FILE as if '#include "file"' appeared as the first line of
  3223. the primary source file. However, the first directory searched for
  3224. FILE is the preprocessor's working directory _instead of_ the
  3225. directory containing the main source file. If not found there, it
  3226. is searched for in the remainder of the '#include "..."' search
  3227. chain as normal.
  3228. If multiple '-include' options are given, the files are included in
  3229. the order they appear on the command line.
  3230. '-imacros FILE'
  3231. Exactly like '-include', except that any output produced by
  3232. scanning FILE is thrown away. Macros it defines remain defined.
  3233. This allows you to acquire all the macros from a header without
  3234. also processing its declarations.
  3235. All files specified by '-imacros' are processed before all files
  3236. specified by '-include'.
  3237. '-undef'
  3238. Do not predefine any system-specific or GCC-specific macros. The
  3239. standard predefined macros remain defined. *Note Standard
  3240. Predefined Macros::.
  3241. '-pthread'
  3242. Define additional macros required for using the POSIX threads
  3243. library. You should use this option consistently for both
  3244. compilation and linking. This option is supported on GNU/Linux
  3245. targets, most other Unix derivatives, and also on x86 Cygwin and
  3246. MinGW targets.
  3247. '-M'
  3248. Instead of outputting the result of preprocessing, output a rule
  3249. suitable for 'make' describing the dependencies of the main source
  3250. file. The preprocessor outputs one 'make' rule containing the
  3251. object file name for that source file, a colon, and the names of
  3252. all the included files, including those coming from '-include' or
  3253. '-imacros' command-line options.
  3254. Unless specified explicitly (with '-MT' or '-MQ'), the object file
  3255. name consists of the name of the source file with any suffix
  3256. replaced with object file suffix and with any leading directory
  3257. parts removed. If there are many included files then the rule is
  3258. split into several lines using '\'-newline. The rule has no
  3259. commands.
  3260. This option does not suppress the preprocessor's debug output, such
  3261. as '-dM'. To avoid mixing such debug output with the dependency
  3262. rules you should explicitly specify the dependency output file with
  3263. '-MF', or use an environment variable like 'DEPENDENCIES_OUTPUT'
  3264. (*note Environment Variables::). Debug output is still sent to the
  3265. regular output stream as normal.
  3266. Passing '-M' to the driver implies '-E', and suppresses warnings
  3267. with an implicit '-w'.
  3268. '-MM'
  3269. Like '-M' but do not mention header files that are found in system
  3270. header directories, nor header files that are included, directly or
  3271. indirectly, from such a header.
  3272. This implies that the choice of angle brackets or double quotes in
  3273. an '#include' directive does not in itself determine whether that
  3274. header appears in '-MM' dependency output.
  3275. '-MF FILE'
  3276. When used with '-M' or '-MM', specifies a file to write the
  3277. dependencies to. If no '-MF' switch is given the preprocessor
  3278. sends the rules to the same place it would send preprocessed
  3279. output.
  3280. When used with the driver options '-MD' or '-MMD', '-MF' overrides
  3281. the default dependency output file.
  3282. If FILE is '-', then the dependencies are written to 'stdout'.
  3283. '-MG'
  3284. In conjunction with an option such as '-M' requesting dependency
  3285. generation, '-MG' assumes missing header files are generated files
  3286. and adds them to the dependency list without raising an error. The
  3287. dependency filename is taken directly from the '#include' directive
  3288. without prepending any path. '-MG' also suppresses preprocessed
  3289. output, as a missing header file renders this useless.
  3290. This feature is used in automatic updating of makefiles.
  3291. '-MP'
  3292. This option instructs CPP to add a phony target for each dependency
  3293. other than the main file, causing each to depend on nothing. These
  3294. dummy rules work around errors 'make' gives if you remove header
  3295. files without updating the 'Makefile' to match.
  3296. This is typical output:
  3297. test.o: test.c test.h
  3298. test.h:
  3299. '-MT TARGET'
  3300. Change the target of the rule emitted by dependency generation. By
  3301. default CPP takes the name of the main input file, deletes any
  3302. directory components and any file suffix such as '.c', and appends
  3303. the platform's usual object suffix. The result is the target.
  3304. An '-MT' option sets the target to be exactly the string you
  3305. specify. If you want multiple targets, you can specify them as a
  3306. single argument to '-MT', or use multiple '-MT' options.
  3307. For example, '-MT '$(objpfx)foo.o'' might give
  3308. $(objpfx)foo.o: foo.c
  3309. '-MQ TARGET'
  3310. Same as '-MT', but it quotes any characters which are special to
  3311. Make. '-MQ '$(objpfx)foo.o'' gives
  3312. $$(objpfx)foo.o: foo.c
  3313. The default target is automatically quoted, as if it were given
  3314. with '-MQ'.
  3315. '-MD'
  3316. '-MD' is equivalent to '-M -MF FILE', except that '-E' is not
  3317. implied. The driver determines FILE based on whether an '-o'
  3318. option is given. If it is, the driver uses its argument but with a
  3319. suffix of '.d', otherwise it takes the name of the input file,
  3320. removes any directory components and suffix, and applies a '.d'
  3321. suffix.
  3322. If '-MD' is used in conjunction with '-E', any '-o' switch is
  3323. understood to specify the dependency output file (*note -MF:
  3324. dashMF.), but if used without '-E', each '-o' is understood to
  3325. specify a target object file.
  3326. Since '-E' is not implied, '-MD' can be used to generate a
  3327. dependency output file as a side effect of the compilation process.
  3328. '-MMD'
  3329. Like '-MD' except mention only user header files, not system header
  3330. files.
  3331. '-fpreprocessed'
  3332. Indicate to the preprocessor that the input file has already been
  3333. preprocessed. This suppresses things like macro expansion,
  3334. trigraph conversion, escaped newline splicing, and processing of
  3335. most directives. The preprocessor still recognizes and removes
  3336. comments, so that you can pass a file preprocessed with '-C' to the
  3337. compiler without problems. In this mode the integrated
  3338. preprocessor is little more than a tokenizer for the front ends.
  3339. '-fpreprocessed' is implicit if the input file has one of the
  3340. extensions '.i', '.ii' or '.mi'. These are the extensions that GCC
  3341. uses for preprocessed files created by '-save-temps'.
  3342. '-fdirectives-only'
  3343. When preprocessing, handle directives, but do not expand macros.
  3344. The option's behavior depends on the '-E' and '-fpreprocessed'
  3345. options.
  3346. With '-E', preprocessing is limited to the handling of directives
  3347. such as '#define', '#ifdef', and '#error'. Other preprocessor
  3348. operations, such as macro expansion and trigraph conversion are not
  3349. performed. In addition, the '-dD' option is implicitly enabled.
  3350. With '-fpreprocessed', predefinition of command line and most
  3351. builtin macros is disabled. Macros such as '__LINE__', which are
  3352. contextually dependent, are handled normally. This enables
  3353. compilation of files previously preprocessed with '-E
  3354. -fdirectives-only'.
  3355. With both '-E' and '-fpreprocessed', the rules for '-fpreprocessed'
  3356. take precedence. This enables full preprocessing of files
  3357. previously preprocessed with '-E -fdirectives-only'.
  3358. '-fdollars-in-identifiers'
  3359. Accept '$' in identifiers. *Note Identifier characters::.
  3360. '-fextended-identifiers'
  3361. Accept universal character names and extended characters in
  3362. identifiers. This option is enabled by default for C99 (and later
  3363. C standard versions) and C++.
  3364. '-fno-canonical-system-headers'
  3365. When preprocessing, do not shorten system header paths with
  3366. canonicalization.
  3367. '-fmax-include-depth=DEPTH'
  3368. Set the maximum depth of the nested #include. The default is 200.
  3369. '-ftabstop=WIDTH'
  3370. Set the distance between tab stops. This helps the preprocessor
  3371. report correct column numbers in warnings or errors, even if tabs
  3372. appear on the line. If the value is less than 1 or greater than
  3373. 100, the option is ignored. The default is 8.
  3374. '-ftrack-macro-expansion[=LEVEL]'
  3375. Track locations of tokens across macro expansions. This allows the
  3376. compiler to emit diagnostic about the current macro expansion stack
  3377. when a compilation error occurs in a macro expansion. Using this
  3378. option makes the preprocessor and the compiler consume more memory.
  3379. The LEVEL parameter can be used to choose the level of precision of
  3380. token location tracking thus decreasing the memory consumption if
  3381. necessary. Value '0' of LEVEL de-activates this option. Value '1'
  3382. tracks tokens locations in a degraded mode for the sake of minimal
  3383. memory overhead. In this mode all tokens resulting from the
  3384. expansion of an argument of a function-like macro have the same
  3385. location. Value '2' tracks tokens locations completely. This
  3386. value is the most memory hungry. When this option is given no
  3387. argument, the default parameter value is '2'.
  3388. Note that '-ftrack-macro-expansion=2' is activated by default.
  3389. '-fmacro-prefix-map=OLD=NEW'
  3390. When preprocessing files residing in directory 'OLD', expand the
  3391. '__FILE__' and '__BASE_FILE__' macros as if the files resided in
  3392. directory 'NEW' instead. This can be used to change an absolute
  3393. path to a relative path by using '.' for NEW which can result in
  3394. more reproducible builds that are location independent. This
  3395. option also affects '__builtin_FILE()' during compilation. See
  3396. also '-ffile-prefix-map'.
  3397. '-fexec-charset=CHARSET'
  3398. Set the execution character set, used for string and character
  3399. constants. The default is UTF-8. CHARSET can be any encoding
  3400. supported by the system's 'iconv' library routine.
  3401. '-fwide-exec-charset=CHARSET'
  3402. Set the wide execution character set, used for wide string and
  3403. character constants. The default is UTF-32 or UTF-16, whichever
  3404. corresponds to the width of 'wchar_t'. As with '-fexec-charset',
  3405. CHARSET can be any encoding supported by the system's 'iconv'
  3406. library routine; however, you will have problems with encodings
  3407. that do not fit exactly in 'wchar_t'.
  3408. '-finput-charset=CHARSET'
  3409. Set the input character set, used for translation from the
  3410. character set of the input file to the source character set used by
  3411. GCC. If the locale does not specify, or GCC cannot get this
  3412. information from the locale, the default is UTF-8. This can be
  3413. overridden by either the locale or this command-line option.
  3414. Currently the command-line option takes precedence if there's a
  3415. conflict. CHARSET can be any encoding supported by the system's
  3416. 'iconv' library routine.
  3417. '-fworking-directory'
  3418. Enable generation of linemarkers in the preprocessor output that
  3419. let the compiler know the current working directory at the time of
  3420. preprocessing. When this option is enabled, the preprocessor
  3421. emits, after the initial linemarker, a second linemarker with the
  3422. current working directory followed by two slashes. GCC uses this
  3423. directory, when it's present in the preprocessed input, as the
  3424. directory emitted as the current working directory in some
  3425. debugging information formats. This option is implicitly enabled
  3426. if debugging information is enabled, but this can be inhibited with
  3427. the negated form '-fno-working-directory'. If the '-P' flag is
  3428. present in the command line, this option has no effect, since no
  3429. '#line' directives are emitted whatsoever.
  3430. '-A PREDICATE=ANSWER'
  3431. Make an assertion with the predicate PREDICATE and answer ANSWER.
  3432. This form is preferred to the older form '-A PREDICATE(ANSWER)',
  3433. which is still supported, because it does not use shell special
  3434. characters. *Note Obsolete Features::.
  3435. '-A -PREDICATE=ANSWER'
  3436. Cancel an assertion with the predicate PREDICATE and answer ANSWER.
  3437. '-C'
  3438. Do not discard comments. All comments are passed through to the
  3439. output file, except for comments in processed directives, which are
  3440. deleted along with the directive.
  3441. You should be prepared for side effects when using '-C'; it causes
  3442. the preprocessor to treat comments as tokens in their own right.
  3443. For example, comments appearing at the start of what would be a
  3444. directive line have the effect of turning that line into an
  3445. ordinary source line, since the first token on the line is no
  3446. longer a '#'.
  3447. '-CC'
  3448. Do not discard comments, including during macro expansion. This is
  3449. like '-C', except that comments contained within macros are also
  3450. passed through to the output file where the macro is expanded.
  3451. In addition to the side effects of the '-C' option, the '-CC'
  3452. option causes all C++-style comments inside a macro to be converted
  3453. to C-style comments. This is to prevent later use of that macro
  3454. from inadvertently commenting out the remainder of the source line.
  3455. The '-CC' option is generally used to support lint comments.
  3456. '-P'
  3457. Inhibit generation of linemarkers in the output from the
  3458. preprocessor. This might be useful when running the preprocessor
  3459. on something that is not C code, and will be sent to a program
  3460. which might be confused by the linemarkers. *Note Preprocessor
  3461. Output::.
  3462. '-traditional'
  3463. '-traditional-cpp'
  3464. Try to imitate the behavior of pre-standard C preprocessors, as
  3465. opposed to ISO C preprocessors. *Note Traditional Mode::.
  3466. Note that GCC does not otherwise attempt to emulate a pre-standard
  3467. C compiler, and these options are only supported with the '-E'
  3468. switch, or when invoking CPP explicitly.
  3469. '-trigraphs'
  3470. Support ISO C trigraphs. These are three-character sequences, all
  3471. starting with '??', that are defined by ISO C to stand for single
  3472. characters. For example, '??/' stands for '\', so ''??/n'' is a
  3473. character constant for a newline. *Note Initial processing::.
  3474. By default, GCC ignores trigraphs, but in standard-conforming modes
  3475. it converts them. See the '-std' and '-ansi' options.
  3476. '-remap'
  3477. Enable special code to work around file systems which only permit
  3478. very short file names, such as MS-DOS.
  3479. '-H'
  3480. Print the name of each header file used, in addition to other
  3481. normal activities. Each name is indented to show how deep in the
  3482. '#include' stack it is. Precompiled header files are also printed,
  3483. even if they are found to be invalid; an invalid precompiled header
  3484. file is printed with '...x' and a valid one with '...!' .
  3485. '-dLETTERS'
  3486. Says to make debugging dumps during compilation as specified by
  3487. LETTERS. The flags documented here are those relevant to the
  3488. preprocessor. Other LETTERS are interpreted by the compiler
  3489. proper, or reserved for future versions of GCC, and so are silently
  3490. ignored. If you specify LETTERS whose behavior conflicts, the
  3491. result is undefined.
  3492. '-dM'
  3493. Instead of the normal output, generate a list of '#define'
  3494. directives for all the macros defined during the execution of
  3495. the preprocessor, including predefined macros. This gives you
  3496. a way of finding out what is predefined in your version of the
  3497. preprocessor. Assuming you have no file 'foo.h', the command
  3498. touch foo.h; cpp -dM foo.h
  3499. shows all the predefined macros.
  3500. '-dD'
  3501. Like '-dM' except in two respects: it does _not_ include the
  3502. predefined macros, and it outputs _both_ the '#define'
  3503. directives and the result of preprocessing. Both kinds of
  3504. output go to the standard output file.
  3505. '-dN'
  3506. Like '-dD', but emit only the macro names, not their
  3507. expansions.
  3508. '-dI'
  3509. Output '#include' directives in addition to the result of
  3510. preprocessing.
  3511. '-dU'
  3512. Like '-dD' except that only macros that are expanded, or whose
  3513. definedness is tested in preprocessor directives, are output;
  3514. the output is delayed until the use or test of the macro; and
  3515. '#undef' directives are also output for macros tested but
  3516. undefined at the time.
  3517. '-fdebug-cpp'
  3518. This option is only useful for debugging GCC. When used from CPP or
  3519. with '-E', it dumps debugging information about location maps.
  3520. Every token in the output is preceded by the dump of the map its
  3521. location belongs to.
  3522. When used from GCC without '-E', this option has no effect.
  3523. '-I DIR'
  3524. '-iquote DIR'
  3525. '-isystem DIR'
  3526. '-idirafter DIR'
  3527. Add the directory DIR to the list of directories to be searched for
  3528. header files during preprocessing. *Note Search Path::. If DIR
  3529. begins with '=' or '$SYSROOT', then the '=' or '$SYSROOT' is
  3530. replaced by the sysroot prefix; see '--sysroot' and '-isysroot'.
  3531. Directories specified with '-iquote' apply only to the quote form
  3532. of the directive, '#include "FILE"'. Directories specified with
  3533. '-I', '-isystem', or '-idirafter' apply to lookup for both the
  3534. '#include "FILE"' and '#include <FILE>' directives.
  3535. You can specify any number or combination of these options on the
  3536. command line to search for header files in several directories.
  3537. The lookup order is as follows:
  3538. 1. For the quote form of the include directive, the directory of
  3539. the current file is searched first.
  3540. 2. For the quote form of the include directive, the directories
  3541. specified by '-iquote' options are searched in left-to-right
  3542. order, as they appear on the command line.
  3543. 3. Directories specified with '-I' options are scanned in
  3544. left-to-right order.
  3545. 4. Directories specified with '-isystem' options are scanned in
  3546. left-to-right order.
  3547. 5. Standard system directories are scanned.
  3548. 6. Directories specified with '-idirafter' options are scanned in
  3549. left-to-right order.
  3550. You can use '-I' to override a system header file, substituting
  3551. your own version, since these directories are searched before the
  3552. standard system header file directories. However, you should not
  3553. use this option to add directories that contain vendor-supplied
  3554. system header files; use '-isystem' for that.
  3555. The '-isystem' and '-idirafter' options also mark the directory as
  3556. a system directory, so that it gets the same special treatment that
  3557. is applied to the standard system directories. *Note System
  3558. Headers::.
  3559. If a standard system include directory, or a directory specified
  3560. with '-isystem', is also specified with '-I', the '-I' option is
  3561. ignored. The directory is still searched but as a system directory
  3562. at its normal position in the system include chain. This is to
  3563. ensure that GCC's procedure to fix buggy system headers and the
  3564. ordering for the '#include_next' directive are not inadvertently
  3565. changed. If you really need to change the search order for system
  3566. directories, use the '-nostdinc' and/or '-isystem' options. *Note
  3567. System Headers::.
  3568. '-I-'
  3569. Split the include path. This option has been deprecated. Please
  3570. use '-iquote' instead for '-I' directories before the '-I-' and
  3571. remove the '-I-' option.
  3572. Any directories specified with '-I' options before '-I-' are
  3573. searched only for headers requested with '#include "FILE"'; they
  3574. are not searched for '#include <FILE>'. If additional directories
  3575. are specified with '-I' options after the '-I-', those directories
  3576. are searched for all '#include' directives.
  3577. In addition, '-I-' inhibits the use of the directory of the current
  3578. file directory as the first search directory for '#include "FILE"'.
  3579. There is no way to override this effect of '-I-'. *Note Search
  3580. Path::.
  3581. '-iprefix PREFIX'
  3582. Specify PREFIX as the prefix for subsequent '-iwithprefix' options.
  3583. If the prefix represents a directory, you should include the final
  3584. '/'.
  3585. '-iwithprefix DIR'
  3586. '-iwithprefixbefore DIR'
  3587. Append DIR to the prefix specified previously with '-iprefix', and
  3588. add the resulting directory to the include search path.
  3589. '-iwithprefixbefore' puts it in the same place '-I' would;
  3590. '-iwithprefix' puts it where '-idirafter' would.
  3591. '-isysroot DIR'
  3592. This option is like the '--sysroot' option, but applies only to
  3593. header files (except for Darwin targets, where it applies to both
  3594. header files and libraries). See the '--sysroot' option for more
  3595. information.
  3596. '-imultilib DIR'
  3597. Use DIR as a subdirectory of the directory containing
  3598. target-specific C++ headers.
  3599. '-nostdinc'
  3600. Do not search the standard system directories for header files.
  3601. Only the directories explicitly specified with '-I', '-iquote',
  3602. '-isystem', and/or '-idirafter' options (and the directory of the
  3603. current file, if appropriate) are searched.
  3604. '-nostdinc++'
  3605. Do not search for header files in the C++-specific standard
  3606. directories, but do still search the other standard directories.
  3607. (This option is used when building the C++ library.)
  3608. '-Wcomment'
  3609. '-Wcomments'
  3610. Warn whenever a comment-start sequence '/*' appears in a '/*'
  3611. comment, or whenever a backslash-newline appears in a '//' comment.
  3612. This warning is enabled by '-Wall'.
  3613. '-Wtrigraphs'
  3614. Warn if any trigraphs are encountered that might change the meaning
  3615. of the program. Trigraphs within comments are not warned about,
  3616. except those that would form escaped newlines.
  3617. This option is implied by '-Wall'. If '-Wall' is not given, this
  3618. option is still enabled unless trigraphs are enabled. To get
  3619. trigraph conversion without warnings, but get the other '-Wall'
  3620. warnings, use '-trigraphs -Wall -Wno-trigraphs'.
  3621. '-Wundef'
  3622. Warn if an undefined identifier is evaluated in an '#if' directive.
  3623. Such identifiers are replaced with zero.
  3624. '-Wexpansion-to-defined'
  3625. Warn whenever 'defined' is encountered in the expansion of a macro
  3626. (including the case where the macro is expanded by an '#if'
  3627. directive). Such usage is not portable. This warning is also
  3628. enabled by '-Wpedantic' and '-Wextra'.
  3629. '-Wunused-macros'
  3630. Warn about macros defined in the main file that are unused. A
  3631. macro is "used" if it is expanded or tested for existence at least
  3632. once. The preprocessor also warns if the macro has not been used
  3633. at the time it is redefined or undefined.
  3634. Built-in macros, macros defined on the command line, and macros
  3635. defined in include files are not warned about.
  3636. _Note:_ If a macro is actually used, but only used in skipped
  3637. conditional blocks, then the preprocessor reports it as unused. To
  3638. avoid the warning in such a case, you might improve the scope of
  3639. the macro's definition by, for example, moving it into the first
  3640. skipped block. Alternatively, you could provide a dummy use with
  3641. something like:
  3642. #if defined the_macro_causing_the_warning
  3643. #endif
  3644. '-Wno-endif-labels'
  3645. Do not warn whenever an '#else' or an '#endif' are followed by
  3646. text. This sometimes happens in older programs with code of the
  3647. form
  3648. #if FOO
  3649. ...
  3650. #else FOO
  3651. ...
  3652. #endif FOO
  3653. The second and third 'FOO' should be in comments. This warning is
  3654. on by default.
  3655. 
  3656. File: cpp.info, Node: Environment Variables, Next: GNU Free Documentation License, Prev: Invocation, Up: Top
  3657. 13 Environment Variables
  3658. ************************
  3659. This section describes the environment variables that affect how CPP
  3660. operates. You can use them to specify directories or prefixes to use
  3661. when searching for include files, or to control dependency output.
  3662. Note that you can also specify places to search using options such as
  3663. '-I', and control dependency output with options like '-M' (*note
  3664. Invocation::). These take precedence over environment variables, which
  3665. in turn take precedence over the configuration of GCC.
  3666. 'CPATH'
  3667. 'C_INCLUDE_PATH'
  3668. 'CPLUS_INCLUDE_PATH'
  3669. 'OBJC_INCLUDE_PATH'
  3670. Each variable's value is a list of directories separated by a
  3671. special character, much like 'PATH', in which to look for header
  3672. files. The special character, 'PATH_SEPARATOR', is
  3673. target-dependent and determined at GCC build time. For Microsoft
  3674. Windows-based targets it is a semicolon, and for almost all other
  3675. targets it is a colon.
  3676. 'CPATH' specifies a list of directories to be searched as if
  3677. specified with '-I', but after any paths given with '-I' options on
  3678. the command line. This environment variable is used regardless of
  3679. which language is being preprocessed.
  3680. The remaining environment variables apply only when preprocessing
  3681. the particular language indicated. Each specifies a list of
  3682. directories to be searched as if specified with '-isystem', but
  3683. after any paths given with '-isystem' options on the command line.
  3684. In all these variables, an empty element instructs the compiler to
  3685. search its current working directory. Empty elements can appear at
  3686. the beginning or end of a path. For instance, if the value of
  3687. 'CPATH' is ':/special/include', that has the same effect as
  3688. '-I. -I/special/include'.
  3689. See also *note Search Path::.
  3690. 'DEPENDENCIES_OUTPUT'
  3691. If this variable is set, its value specifies how to output
  3692. dependencies for Make based on the non-system header files
  3693. processed by the compiler. System header files are ignored in the
  3694. dependency output.
  3695. The value of 'DEPENDENCIES_OUTPUT' can be just a file name, in
  3696. which case the Make rules are written to that file, guessing the
  3697. target name from the source file name. Or the value can have the
  3698. form 'FILE TARGET', in which case the rules are written to file
  3699. FILE using TARGET as the target name.
  3700. In other words, this environment variable is equivalent to
  3701. combining the options '-MM' and '-MF' (*note Invocation::), with an
  3702. optional '-MT' switch too.
  3703. 'SUNPRO_DEPENDENCIES'
  3704. This variable is the same as 'DEPENDENCIES_OUTPUT' (see above),
  3705. except that system header files are not ignored, so it implies '-M'
  3706. rather than '-MM'. However, the dependence on the main input file
  3707. is omitted. *Note Invocation::.
  3708. 'SOURCE_DATE_EPOCH'
  3709. If this variable is set, its value specifies a UNIX timestamp to be
  3710. used in replacement of the current date and time in the '__DATE__'
  3711. and '__TIME__' macros, so that the embedded timestamps become
  3712. reproducible.
  3713. The value of 'SOURCE_DATE_EPOCH' must be a UNIX timestamp, defined
  3714. as the number of seconds (excluding leap seconds) since 01 Jan 1970
  3715. 00:00:00 represented in ASCII; identical to the output of ''date
  3716. +%s'' on GNU/Linux and other systems that support the '%s'
  3717. extension in the 'date' command.
  3718. The value should be a known timestamp such as the last modification
  3719. time of the source or package and it should be set by the build
  3720. process.
  3721. 
  3722. File: cpp.info, Node: GNU Free Documentation License, Next: Index of Directives, Prev: Environment Variables, Up: Top
  3723. GNU Free Documentation License
  3724. ******************************
  3725. Version 1.3, 3 November 2008
  3726. Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
  3727. <http://fsf.org/>
  3728. Everyone is permitted to copy and distribute verbatim copies
  3729. of this license document, but changing it is not allowed.
  3730. 0. PREAMBLE
  3731. The purpose of this License is to make a manual, textbook, or other
  3732. functional and useful document "free" in the sense of freedom: to
  3733. assure everyone the effective freedom to copy and redistribute it,
  3734. with or without modifying it, either commercially or
  3735. noncommercially. Secondarily, this License preserves for the
  3736. author and publisher a way to get credit for their work, while not
  3737. being considered responsible for modifications made by others.
  3738. This License is a kind of "copyleft", which means that derivative
  3739. works of the document must themselves be free in the same sense.
  3740. It complements the GNU General Public License, which is a copyleft
  3741. license designed for free software.
  3742. We have designed this License in order to use it for manuals for
  3743. free software, because free software needs free documentation: a
  3744. free program should come with manuals providing the same freedoms
  3745. that the software does. But this License is not limited to
  3746. software manuals; it can be used for any textual work, regardless
  3747. of subject matter or whether it is published as a printed book. We
  3748. recommend this License principally for works whose purpose is
  3749. instruction or reference.
  3750. 1. APPLICABILITY AND DEFINITIONS
  3751. This License applies to any manual or other work, in any medium,
  3752. that contains a notice placed by the copyright holder saying it can
  3753. be distributed under the terms of this License. Such a notice
  3754. grants a world-wide, royalty-free license, unlimited in duration,
  3755. to use that work under the conditions stated herein. The
  3756. "Document", below, refers to any such manual or work. Any member
  3757. of the public is a licensee, and is addressed as "you". You accept
  3758. the license if you copy, modify or distribute the work in a way
  3759. requiring permission under copyright law.
  3760. A "Modified Version" of the Document means any work containing the
  3761. Document or a portion of it, either copied verbatim, or with
  3762. modifications and/or translated into another language.
  3763. A "Secondary Section" is a named appendix or a front-matter section
  3764. of the Document that deals exclusively with the relationship of the
  3765. publishers or authors of the Document to the Document's overall
  3766. subject (or to related matters) and contains nothing that could
  3767. fall directly within that overall subject. (Thus, if the Document
  3768. is in part a textbook of mathematics, a Secondary Section may not
  3769. explain any mathematics.) The relationship could be a matter of
  3770. historical connection with the subject or with related matters, or
  3771. of legal, commercial, philosophical, ethical or political position
  3772. regarding them.
  3773. The "Invariant Sections" are certain Secondary Sections whose
  3774. titles are designated, as being those of Invariant Sections, in the
  3775. notice that says that the Document is released under this License.
  3776. If a section does not fit the above definition of Secondary then it
  3777. is not allowed to be designated as Invariant. The Document may
  3778. contain zero Invariant Sections. If the Document does not identify
  3779. any Invariant Sections then there are none.
  3780. The "Cover Texts" are certain short passages of text that are
  3781. listed, as Front-Cover Texts or Back-Cover Texts, in the notice
  3782. that says that the Document is released under this License. A
  3783. Front-Cover Text may be at most 5 words, and a Back-Cover Text may
  3784. be at most 25 words.
  3785. A "Transparent" copy of the Document means a machine-readable copy,
  3786. represented in a format whose specification is available to the
  3787. general public, that is suitable for revising the document
  3788. straightforwardly with generic text editors or (for images composed
  3789. of pixels) generic paint programs or (for drawings) some widely
  3790. available drawing editor, and that is suitable for input to text
  3791. formatters or for automatic translation to a variety of formats
  3792. suitable for input to text formatters. A copy made in an otherwise
  3793. Transparent file format whose markup, or absence of markup, has
  3794. been arranged to thwart or discourage subsequent modification by
  3795. readers is not Transparent. An image format is not Transparent if
  3796. used for any substantial amount of text. A copy that is not
  3797. "Transparent" is called "Opaque".
  3798. Examples of suitable formats for Transparent copies include plain
  3799. ASCII without markup, Texinfo input format, LaTeX input format,
  3800. SGML or XML using a publicly available DTD, and standard-conforming
  3801. simple HTML, PostScript or PDF designed for human modification.
  3802. Examples of transparent image formats include PNG, XCF and JPG.
  3803. Opaque formats include proprietary formats that can be read and
  3804. edited only by proprietary word processors, SGML or XML for which
  3805. the DTD and/or processing tools are not generally available, and
  3806. the machine-generated HTML, PostScript or PDF produced by some word
  3807. processors for output purposes only.
  3808. The "Title Page" means, for a printed book, the title page itself,
  3809. plus such following pages as are needed to hold, legibly, the
  3810. material this License requires to appear in the title page. For
  3811. works in formats which do not have any title page as such, "Title
  3812. Page" means the text near the most prominent appearance of the
  3813. work's title, preceding the beginning of the body of the text.
  3814. The "publisher" means any person or entity that distributes copies
  3815. of the Document to the public.
  3816. A section "Entitled XYZ" means a named subunit of the Document
  3817. whose title either is precisely XYZ or contains XYZ in parentheses
  3818. following text that translates XYZ in another language. (Here XYZ
  3819. stands for a specific section name mentioned below, such as
  3820. "Acknowledgements", "Dedications", "Endorsements", or "History".)
  3821. To "Preserve the Title" of such a section when you modify the
  3822. Document means that it remains a section "Entitled XYZ" according
  3823. to this definition.
  3824. The Document may include Warranty Disclaimers next to the notice
  3825. which states that this License applies to the Document. These
  3826. Warranty Disclaimers are considered to be included by reference in
  3827. this License, but only as regards disclaiming warranties: any other
  3828. implication that these Warranty Disclaimers may have is void and
  3829. has no effect on the meaning of this License.
  3830. 2. VERBATIM COPYING
  3831. You may copy and distribute the Document in any medium, either
  3832. commercially or noncommercially, provided that this License, the
  3833. copyright notices, and the license notice saying this License
  3834. applies to the Document are reproduced in all copies, and that you
  3835. add no other conditions whatsoever to those of this License. You
  3836. may not use technical measures to obstruct or control the reading
  3837. or further copying of the copies you make or distribute. However,
  3838. you may accept compensation in exchange for copies. If you
  3839. distribute a large enough number of copies you must also follow the
  3840. conditions in section 3.
  3841. You may also lend copies, under the same conditions stated above,
  3842. and you may publicly display copies.
  3843. 3. COPYING IN QUANTITY
  3844. If you publish printed copies (or copies in media that commonly
  3845. have printed covers) of the Document, numbering more than 100, and
  3846. the Document's license notice requires Cover Texts, you must
  3847. enclose the copies in covers that carry, clearly and legibly, all
  3848. these Cover Texts: Front-Cover Texts on the front cover, and
  3849. Back-Cover Texts on the back cover. Both covers must also clearly
  3850. and legibly identify you as the publisher of these copies. The
  3851. front cover must present the full title with all words of the title
  3852. equally prominent and visible. You may add other material on the
  3853. covers in addition. Copying with changes limited to the covers, as
  3854. long as they preserve the title of the Document and satisfy these
  3855. conditions, can be treated as verbatim copying in other respects.
  3856. If the required texts for either cover are too voluminous to fit
  3857. legibly, you should put the first ones listed (as many as fit
  3858. reasonably) on the actual cover, and continue the rest onto
  3859. adjacent pages.
  3860. If you publish or distribute Opaque copies of the Document
  3861. numbering more than 100, you must either include a machine-readable
  3862. Transparent copy along with each Opaque copy, or state in or with
  3863. each Opaque copy a computer-network location from which the general
  3864. network-using public has access to download using public-standard
  3865. network protocols a complete Transparent copy of the Document, free
  3866. of added material. If you use the latter option, you must take
  3867. reasonably prudent steps, when you begin distribution of Opaque
  3868. copies in quantity, to ensure that this Transparent copy will
  3869. remain thus accessible at the stated location until at least one
  3870. year after the last time you distribute an Opaque copy (directly or
  3871. through your agents or retailers) of that edition to the public.
  3872. It is requested, but not required, that you contact the authors of
  3873. the Document well before redistributing any large number of copies,
  3874. to give them a chance to provide you with an updated version of the
  3875. Document.
  3876. 4. MODIFICATIONS
  3877. You may copy and distribute a Modified Version of the Document
  3878. under the conditions of sections 2 and 3 above, provided that you
  3879. release the Modified Version under precisely this License, with the
  3880. Modified Version filling the role of the Document, thus licensing
  3881. distribution and modification of the Modified Version to whoever
  3882. possesses a copy of it. In addition, you must do these things in
  3883. the Modified Version:
  3884. A. Use in the Title Page (and on the covers, if any) a title
  3885. distinct from that of the Document, and from those of previous
  3886. versions (which should, if there were any, be listed in the
  3887. History section of the Document). You may use the same title
  3888. as a previous version if the original publisher of that
  3889. version gives permission.
  3890. B. List on the Title Page, as authors, one or more persons or
  3891. entities responsible for authorship of the modifications in
  3892. the Modified Version, together with at least five of the
  3893. principal authors of the Document (all of its principal
  3894. authors, if it has fewer than five), unless they release you
  3895. from this requirement.
  3896. C. State on the Title page the name of the publisher of the
  3897. Modified Version, as the publisher.
  3898. D. Preserve all the copyright notices of the Document.
  3899. E. Add an appropriate copyright notice for your modifications
  3900. adjacent to the other copyright notices.
  3901. F. Include, immediately after the copyright notices, a license
  3902. notice giving the public permission to use the Modified
  3903. Version under the terms of this License, in the form shown in
  3904. the Addendum below.
  3905. G. Preserve in that license notice the full lists of Invariant
  3906. Sections and required Cover Texts given in the Document's
  3907. license notice.
  3908. H. Include an unaltered copy of this License.
  3909. I. Preserve the section Entitled "History", Preserve its Title,
  3910. and add to it an item stating at least the title, year, new
  3911. authors, and publisher of the Modified Version as given on the
  3912. Title Page. If there is no section Entitled "History" in the
  3913. Document, create one stating the title, year, authors, and
  3914. publisher of the Document as given on its Title Page, then add
  3915. an item describing the Modified Version as stated in the
  3916. previous sentence.
  3917. J. Preserve the network location, if any, given in the Document
  3918. for public access to a Transparent copy of the Document, and
  3919. likewise the network locations given in the Document for
  3920. previous versions it was based on. These may be placed in the
  3921. "History" section. You may omit a network location for a work
  3922. that was published at least four years before the Document
  3923. itself, or if the original publisher of the version it refers
  3924. to gives permission.
  3925. K. For any section Entitled "Acknowledgements" or "Dedications",
  3926. Preserve the Title of the section, and preserve in the section
  3927. all the substance and tone of each of the contributor
  3928. acknowledgements and/or dedications given therein.
  3929. L. Preserve all the Invariant Sections of the Document, unaltered
  3930. in their text and in their titles. Section numbers or the
  3931. equivalent are not considered part of the section titles.
  3932. M. Delete any section Entitled "Endorsements". Such a section
  3933. may not be included in the Modified Version.
  3934. N. Do not retitle any existing section to be Entitled
  3935. "Endorsements" or to conflict in title with any Invariant
  3936. Section.
  3937. O. Preserve any Warranty Disclaimers.
  3938. If the Modified Version includes new front-matter sections or
  3939. appendices that qualify as Secondary Sections and contain no
  3940. material copied from the Document, you may at your option designate
  3941. some or all of these sections as invariant. To do this, add their
  3942. titles to the list of Invariant Sections in the Modified Version's
  3943. license notice. These titles must be distinct from any other
  3944. section titles.
  3945. You may add a section Entitled "Endorsements", provided it contains
  3946. nothing but endorsements of your Modified Version by various
  3947. parties--for example, statements of peer review or that the text
  3948. has been approved by an organization as the authoritative
  3949. definition of a standard.
  3950. You may add a passage of up to five words as a Front-Cover Text,
  3951. and a passage of up to 25 words as a Back-Cover Text, to the end of
  3952. the list of Cover Texts in the Modified Version. Only one passage
  3953. of Front-Cover Text and one of Back-Cover Text may be added by (or
  3954. through arrangements made by) any one entity. If the Document
  3955. already includes a cover text for the same cover, previously added
  3956. by you or by arrangement made by the same entity you are acting on
  3957. behalf of, you may not add another; but you may replace the old
  3958. one, on explicit permission from the previous publisher that added
  3959. the old one.
  3960. The author(s) and publisher(s) of the Document do not by this
  3961. License give permission to use their names for publicity for or to
  3962. assert or imply endorsement of any Modified Version.
  3963. 5. COMBINING DOCUMENTS
  3964. You may combine the Document with other documents released under
  3965. this License, under the terms defined in section 4 above for
  3966. modified versions, provided that you include in the combination all
  3967. of the Invariant Sections of all of the original documents,
  3968. unmodified, and list them all as Invariant Sections of your
  3969. combined work in its license notice, and that you preserve all
  3970. their Warranty Disclaimers.
  3971. The combined work need only contain one copy of this License, and
  3972. multiple identical Invariant Sections may be replaced with a single
  3973. copy. If there are multiple Invariant Sections with the same name
  3974. but different contents, make the title of each such section unique
  3975. by adding at the end of it, in parentheses, the name of the
  3976. original author or publisher of that section if known, or else a
  3977. unique number. Make the same adjustment to the section titles in
  3978. the list of Invariant Sections in the license notice of the
  3979. combined work.
  3980. In the combination, you must combine any sections Entitled
  3981. "History" in the various original documents, forming one section
  3982. Entitled "History"; likewise combine any sections Entitled
  3983. "Acknowledgements", and any sections Entitled "Dedications". You
  3984. must delete all sections Entitled "Endorsements."
  3985. 6. COLLECTIONS OF DOCUMENTS
  3986. You may make a collection consisting of the Document and other
  3987. documents released under this License, and replace the individual
  3988. copies of this License in the various documents with a single copy
  3989. that is included in the collection, provided that you follow the
  3990. rules of this License for verbatim copying of each of the documents
  3991. in all other respects.
  3992. You may extract a single document from such a collection, and
  3993. distribute it individually under this License, provided you insert
  3994. a copy of this License into the extracted document, and follow this
  3995. License in all other respects regarding verbatim copying of that
  3996. document.
  3997. 7. AGGREGATION WITH INDEPENDENT WORKS
  3998. A compilation of the Document or its derivatives with other
  3999. separate and independent documents or works, in or on a volume of a
  4000. storage or distribution medium, is called an "aggregate" if the
  4001. copyright resulting from the compilation is not used to limit the
  4002. legal rights of the compilation's users beyond what the individual
  4003. works permit. When the Document is included in an aggregate, this
  4004. License does not apply to the other works in the aggregate which
  4005. are not themselves derivative works of the Document.
  4006. If the Cover Text requirement of section 3 is applicable to these
  4007. copies of the Document, then if the Document is less than one half
  4008. of the entire aggregate, the Document's Cover Texts may be placed
  4009. on covers that bracket the Document within the aggregate, or the
  4010. electronic equivalent of covers if the Document is in electronic
  4011. form. Otherwise they must appear on printed covers that bracket
  4012. the whole aggregate.
  4013. 8. TRANSLATION
  4014. Translation is considered a kind of modification, so you may
  4015. distribute translations of the Document under the terms of section
  4016. 4. Replacing Invariant Sections with translations requires special
  4017. permission from their copyright holders, but you may include
  4018. translations of some or all Invariant Sections in addition to the
  4019. original versions of these Invariant Sections. You may include a
  4020. translation of this License, and all the license notices in the
  4021. Document, and any Warranty Disclaimers, provided that you also
  4022. include the original English version of this License and the
  4023. original versions of those notices and disclaimers. In case of a
  4024. disagreement between the translation and the original version of
  4025. this License or a notice or disclaimer, the original version will
  4026. prevail.
  4027. If a section in the Document is Entitled "Acknowledgements",
  4028. "Dedications", or "History", the requirement (section 4) to
  4029. Preserve its Title (section 1) will typically require changing the
  4030. actual title.
  4031. 9. TERMINATION
  4032. You may not copy, modify, sublicense, or distribute the Document
  4033. except as expressly provided under this License. Any attempt
  4034. otherwise to copy, modify, sublicense, or distribute it is void,
  4035. and will automatically terminate your rights under this License.
  4036. However, if you cease all violation of this License, then your
  4037. license from a particular copyright holder is reinstated (a)
  4038. provisionally, unless and until the copyright holder explicitly and
  4039. finally terminates your license, and (b) permanently, if the
  4040. copyright holder fails to notify you of the violation by some
  4041. reasonable means prior to 60 days after the cessation.
  4042. Moreover, your license from a particular copyright holder is
  4043. reinstated permanently if the copyright holder notifies you of the
  4044. violation by some reasonable means, this is the first time you have
  4045. received notice of violation of this License (for any work) from
  4046. that copyright holder, and you cure the violation prior to 30 days
  4047. after your receipt of the notice.
  4048. Termination of your rights under this section does not terminate
  4049. the licenses of parties who have received copies or rights from you
  4050. under this License. If your rights have been terminated and not
  4051. permanently reinstated, receipt of a copy of some or all of the
  4052. same material does not give you any rights to use it.
  4053. 10. FUTURE REVISIONS OF THIS LICENSE
  4054. The Free Software Foundation may publish new, revised versions of
  4055. the GNU Free Documentation License from time to time. Such new
  4056. versions will be similar in spirit to the present version, but may
  4057. differ in detail to address new problems or concerns. See
  4058. <http://www.gnu.org/copyleft/>.
  4059. Each version of the License is given a distinguishing version
  4060. number. If the Document specifies that a particular numbered
  4061. version of this License "or any later version" applies to it, you
  4062. have the option of following the terms and conditions either of
  4063. that specified version or of any later version that has been
  4064. published (not as a draft) by the Free Software Foundation. If the
  4065. Document does not specify a version number of this License, you may
  4066. choose any version ever published (not as a draft) by the Free
  4067. Software Foundation. If the Document specifies that a proxy can
  4068. decide which future versions of this License can be used, that
  4069. proxy's public statement of acceptance of a version permanently
  4070. authorizes you to choose that version for the Document.
  4071. 11. RELICENSING
  4072. "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
  4073. World Wide Web server that publishes copyrightable works and also
  4074. provides prominent facilities for anybody to edit those works. A
  4075. public wiki that anybody can edit is an example of such a server.
  4076. A "Massive Multiauthor Collaboration" (or "MMC") contained in the
  4077. site means any set of copyrightable works thus published on the MMC
  4078. site.
  4079. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
  4080. license published by Creative Commons Corporation, a not-for-profit
  4081. corporation with a principal place of business in San Francisco,
  4082. California, as well as future copyleft versions of that license
  4083. published by that same organization.
  4084. "Incorporate" means to publish or republish a Document, in whole or
  4085. in part, as part of another Document.
  4086. An MMC is "eligible for relicensing" if it is licensed under this
  4087. License, and if all works that were first published under this
  4088. License somewhere other than this MMC, and subsequently
  4089. incorporated in whole or in part into the MMC, (1) had no cover
  4090. texts or invariant sections, and (2) were thus incorporated prior
  4091. to November 1, 2008.
  4092. The operator of an MMC Site may republish an MMC contained in the
  4093. site under CC-BY-SA on the same site at any time before August 1,
  4094. 2009, provided the MMC is eligible for relicensing.
  4095. ADDENDUM: How to use this License for your documents
  4096. ====================================================
  4097. To use this License in a document you have written, include a copy of
  4098. the License in the document and put the following copyright and license
  4099. notices just after the title page:
  4100. Copyright (C) YEAR YOUR NAME.
  4101. Permission is granted to copy, distribute and/or modify this document
  4102. under the terms of the GNU Free Documentation License, Version 1.3
  4103. or any later version published by the Free Software Foundation;
  4104. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
  4105. Texts. A copy of the license is included in the section entitled ``GNU
  4106. Free Documentation License''.
  4107. If you have Invariant Sections, Front-Cover Texts and Back-Cover
  4108. Texts, replace the "with...Texts." line with this:
  4109. with the Invariant Sections being LIST THEIR TITLES, with
  4110. the Front-Cover Texts being LIST, and with the Back-Cover Texts
  4111. being LIST.
  4112. If you have Invariant Sections without Cover Texts, or some other
  4113. combination of the three, merge those two alternatives to suit the
  4114. situation.
  4115. If your document contains nontrivial examples of program code, we
  4116. recommend releasing these examples in parallel under your choice of free
  4117. software license, such as the GNU General Public License, to permit
  4118. their use in free software.
  4119. 
  4120. File: cpp.info, Node: Index of Directives, Next: Option Index, Prev: GNU Free Documentation License, Up: Top
  4121. Index of Directives
  4122. *******************
  4123. �[index�]
  4124. * Menu:
  4125. * #assert: Obsolete Features. (line 48)
  4126. * #define: Object-like Macros. (line 11)
  4127. * #elif: Elif. (line 6)
  4128. * #else: Else. (line 6)
  4129. * #endif: Ifdef. (line 6)
  4130. * #error: Diagnostics. (line 6)
  4131. * #ident: Other Directives. (line 6)
  4132. * #if: Conditional Syntax. (line 6)
  4133. * #ifdef: Ifdef. (line 6)
  4134. * #ifndef: Ifdef. (line 40)
  4135. * #import: Alternatives to Wrapper #ifndef.
  4136. (line 11)
  4137. * #include: Include Syntax. (line 6)
  4138. * #include_next: Wrapper Headers. (line 6)
  4139. * #line: Line Control. (line 20)
  4140. * #pragma GCC dependency: Pragmas. (line 43)
  4141. * #pragma GCC error: Pragmas. (line 88)
  4142. * #pragma GCC poison: Pragmas. (line 55)
  4143. * #pragma GCC system_header: System Headers. (line 25)
  4144. * #pragma GCC system_header <1>: Pragmas. (line 82)
  4145. * #pragma GCC warning: Pragmas. (line 87)
  4146. * #pragma once: Pragmas. (line 96)
  4147. * #sccs: Other Directives. (line 6)
  4148. * #unassert: Obsolete Features. (line 59)
  4149. * #undef: Undefining and Redefining Macros.
  4150. (line 6)
  4151. * #warning: Diagnostics. (line 27)
  4152. 
  4153. File: cpp.info, Node: Option Index, Next: Concept Index, Prev: Index of Directives, Up: Top
  4154. Option Index
  4155. ************
  4156. CPP's command-line options and environment variables are indexed here
  4157. without any initial '-' or '--'.
  4158. �[index�]
  4159. * Menu:
  4160. * A: Invocation. (line 333)
  4161. * C: Invocation. (line 342)
  4162. * CC: Invocation. (line 354)
  4163. * CPATH: Environment Variables.
  4164. (line 15)
  4165. * CPLUS_INCLUDE_PATH: Environment Variables.
  4166. (line 17)
  4167. * C_INCLUDE_PATH: Environment Variables.
  4168. (line 16)
  4169. * D: Invocation. (line 44)
  4170. * d: Invocation. (line 403)
  4171. * dD: Invocation. (line 422)
  4172. * DEPENDENCIES_OUTPUT: Environment Variables.
  4173. (line 45)
  4174. * dI: Invocation. (line 432)
  4175. * dM: Invocation. (line 411)
  4176. * dN: Invocation. (line 428)
  4177. * dU: Invocation. (line 436)
  4178. * fdebug-cpp: Invocation. (line 443)
  4179. * fdirectives-only: Invocation. (line 228)
  4180. * fdollars-in-identifiers: Invocation. (line 249)
  4181. * fexec-charset: Invocation. (line 296)
  4182. * fextended-identifiers: Invocation. (line 252)
  4183. * finput-charset: Invocation. (line 309)
  4184. * fmacro-prefix-map: Invocation. (line 287)
  4185. * fmax-include-depth: Invocation. (line 261)
  4186. * fno-canonical-system-headers: Invocation. (line 257)
  4187. * fno-working-directory: Invocation. (line 319)
  4188. * fpreprocessed: Invocation. (line 215)
  4189. * ftabstop: Invocation. (line 264)
  4190. * ftrack-macro-expansion: Invocation. (line 270)
  4191. * fwide-exec-charset: Invocation. (line 301)
  4192. * fworking-directory: Invocation. (line 319)
  4193. * H: Invocation. (line 396)
  4194. * I: Invocation. (line 454)
  4195. * I-: Invocation. (line 508)
  4196. * idirafter: Invocation. (line 454)
  4197. * imacros: Invocation. (line 82)
  4198. * imultilib: Invocation. (line 542)
  4199. * include: Invocation. (line 71)
  4200. * iprefix: Invocation. (line 524)
  4201. * iquote: Invocation. (line 454)
  4202. * isysroot: Invocation. (line 536)
  4203. * isystem: Invocation. (line 454)
  4204. * iwithprefix: Invocation. (line 530)
  4205. * iwithprefixbefore: Invocation. (line 530)
  4206. * M: Invocation. (line 103)
  4207. * MD: Invocation. (line 195)
  4208. * MF: Invocation. (line 137)
  4209. * MG: Invocation. (line 148)
  4210. * MM: Invocation. (line 128)
  4211. * MMD: Invocation. (line 211)
  4212. * MP: Invocation. (line 158)
  4213. * MQ: Invocation. (line 185)
  4214. * MT: Invocation. (line 170)
  4215. * nostdinc: Invocation. (line 546)
  4216. * nostdinc++: Invocation. (line 552)
  4217. * OBJC_INCLUDE_PATH: Environment Variables.
  4218. (line 18)
  4219. * P: Invocation. (line 366)
  4220. * pthread: Invocation. (line 96)
  4221. * remap: Invocation. (line 392)
  4222. * SOURCE_DATE_EPOCH: Environment Variables.
  4223. (line 67)
  4224. * SUNPRO_DEPENDENCIES: Environment Variables.
  4225. (line 61)
  4226. * traditional: Invocation. (line 374)
  4227. * traditional-cpp: Invocation. (line 374)
  4228. * trigraphs: Invocation. (line 383)
  4229. * U: Invocation. (line 67)
  4230. * undef: Invocation. (line 91)
  4231. * Wcomment: Invocation. (line 558)
  4232. * Wcomments: Invocation. (line 558)
  4233. * Wendif-labels: Invocation. (line 602)
  4234. * Wexpansion-to-defined: Invocation. (line 577)
  4235. * Wno-endif-labels: Invocation. (line 602)
  4236. * Wno-undef: Invocation. (line 573)
  4237. * Wtrigraphs: Invocation. (line 563)
  4238. * Wundef: Invocation. (line 573)
  4239. * Wunused-macros: Invocation. (line 583)
  4240. 
  4241. File: cpp.info, Node: Concept Index, Prev: Option Index, Up: Top
  4242. Concept Index
  4243. *************
  4244. �[index�]
  4245. * Menu:
  4246. * # operator: Stringizing. (line 6)
  4247. * ## operator: Concatenation. (line 6)
  4248. * _Pragma: Pragmas. (line 13)
  4249. * __has_attribute: __has_attribute. (line 6)
  4250. * __has_builtin: __has_builtin. (line 6)
  4251. * __has_cpp_attribute: __has_cpp_attribute. (line 6)
  4252. * __has_include: __has_include. (line 6)
  4253. * alternative tokens: Tokenization. (line 100)
  4254. * arguments: Macro Arguments. (line 6)
  4255. * arguments in macro definitions: Macro Arguments. (line 6)
  4256. * assertions: Obsolete Features. (line 13)
  4257. * assertions, canceling: Obsolete Features. (line 59)
  4258. * backslash-newline: Initial processing. (line 61)
  4259. * block comments: Initial processing. (line 77)
  4260. * C language, traditional: Invocation. (line 372)
  4261. * C++ named operators: C++ Named Operators. (line 6)
  4262. * character constants: Tokenization. (line 81)
  4263. * character set, execution: Invocation. (line 296)
  4264. * character set, input: Invocation. (line 309)
  4265. * character set, wide execution: Invocation. (line 301)
  4266. * command line: Invocation. (line 6)
  4267. * commenting out code: Deleted Code. (line 6)
  4268. * comments: Initial processing. (line 77)
  4269. * common predefined macros: Common Predefined Macros.
  4270. (line 6)
  4271. * computed includes: Computed Includes. (line 6)
  4272. * concatenation: Concatenation. (line 6)
  4273. * conditional group: Ifdef. (line 14)
  4274. * conditionals: Conditionals. (line 6)
  4275. * continued lines: Initial processing. (line 61)
  4276. * controlling macro: Once-Only Headers. (line 35)
  4277. * defined: Defined. (line 6)
  4278. * dependencies for make as output: Environment Variables.
  4279. (line 46)
  4280. * dependencies for make as output <1>: Environment Variables.
  4281. (line 62)
  4282. * dependencies, make: Invocation. (line 103)
  4283. * diagnostic: Diagnostics. (line 6)
  4284. * digraphs: Tokenization. (line 100)
  4285. * directive line: The preprocessing language.
  4286. (line 6)
  4287. * directive name: The preprocessing language.
  4288. (line 6)
  4289. * directives: The preprocessing language.
  4290. (line 6)
  4291. * empty macro arguments: Macro Arguments. (line 66)
  4292. * environment variables: Environment Variables.
  4293. (line 6)
  4294. * expansion of arguments: Argument Prescan. (line 6)
  4295. * FDL, GNU Free Documentation License: GNU Free Documentation License.
  4296. (line 6)
  4297. * function-like macros: Function-like Macros.
  4298. (line 6)
  4299. * grouping options: Invocation. (line 38)
  4300. * guard macro: Once-Only Headers. (line 35)
  4301. * header file: Header Files. (line 6)
  4302. * header file names: Tokenization. (line 81)
  4303. * identifiers: Tokenization. (line 33)
  4304. * implementation limits: Implementation limits.
  4305. (line 6)
  4306. * implementation-defined behavior: Implementation-defined behavior.
  4307. (line 6)
  4308. * including just once: Once-Only Headers. (line 6)
  4309. * invocation: Invocation. (line 6)
  4310. * iso646.h: C++ Named Operators. (line 6)
  4311. * line comments: Initial processing. (line 77)
  4312. * line control: Line Control. (line 6)
  4313. * line endings: Initial processing. (line 14)
  4314. * linemarkers: Preprocessor Output. (line 27)
  4315. * macro argument expansion: Argument Prescan. (line 6)
  4316. * macro arguments and directives: Directives Within Macro Arguments.
  4317. (line 6)
  4318. * macros in include: Computed Includes. (line 6)
  4319. * macros with arguments: Macro Arguments. (line 6)
  4320. * macros with variable arguments: Variadic Macros. (line 6)
  4321. * make: Invocation. (line 103)
  4322. * manifest constants: Object-like Macros. (line 6)
  4323. * named operators: C++ Named Operators. (line 6)
  4324. * newlines in macro arguments: Newlines in Arguments.
  4325. (line 6)
  4326. * null directive: Other Directives. (line 15)
  4327. * numbers: Tokenization. (line 58)
  4328. * object-like macro: Object-like Macros. (line 6)
  4329. * options: Invocation. (line 43)
  4330. * options, grouping: Invocation. (line 38)
  4331. * other tokens: Tokenization. (line 114)
  4332. * output format: Preprocessor Output. (line 12)
  4333. * overriding a header file: Wrapper Headers. (line 6)
  4334. * parentheses in macro bodies: Operator Precedence Problems.
  4335. (line 6)
  4336. * pitfalls of macros: Macro Pitfalls. (line 6)
  4337. * pragma directive: Pragmas. (line 6)
  4338. * predefined macros: Predefined Macros. (line 6)
  4339. * predefined macros, system-specific: System-specific Predefined Macros.
  4340. (line 6)
  4341. * predicates: Obsolete Features. (line 26)
  4342. * preprocessing directives: The preprocessing language.
  4343. (line 6)
  4344. * preprocessing numbers: Tokenization. (line 58)
  4345. * preprocessing tokens: Tokenization. (line 6)
  4346. * prescan of macro arguments: Argument Prescan. (line 6)
  4347. * problems with macros: Macro Pitfalls. (line 6)
  4348. * punctuators: Tokenization. (line 100)
  4349. * redefining macros: Undefining and Redefining Macros.
  4350. (line 6)
  4351. * repeated inclusion: Once-Only Headers. (line 6)
  4352. * reporting errors: Diagnostics. (line 6)
  4353. * reporting warnings: Diagnostics. (line 6)
  4354. * reserved namespace: System-specific Predefined Macros.
  4355. (line 6)
  4356. * self-reference: Self-Referential Macros.
  4357. (line 6)
  4358. * semicolons (after macro calls): Swallowing the Semicolon.
  4359. (line 6)
  4360. * side effects (in macro arguments): Duplication of Side Effects.
  4361. (line 6)
  4362. * standard predefined macros.: Standard Predefined Macros.
  4363. (line 6)
  4364. * string constants: Tokenization. (line 81)
  4365. * string literals: Tokenization. (line 81)
  4366. * stringizing: Stringizing. (line 6)
  4367. * symbolic constants: Object-like Macros. (line 6)
  4368. * system header files: Header Files. (line 13)
  4369. * system header files <1>: System Headers. (line 6)
  4370. * system-specific predefined macros: System-specific Predefined Macros.
  4371. (line 6)
  4372. * testing predicates: Obsolete Features. (line 37)
  4373. * token concatenation: Concatenation. (line 6)
  4374. * token pasting: Concatenation. (line 6)
  4375. * tokens: Tokenization. (line 6)
  4376. * traditional C language: Invocation. (line 372)
  4377. * trigraphs: Initial processing. (line 32)
  4378. * undefining macros: Undefining and Redefining Macros.
  4379. (line 6)
  4380. * unsafe macros: Duplication of Side Effects.
  4381. (line 6)
  4382. * variable number of arguments: Variadic Macros. (line 6)
  4383. * variadic macros: Variadic Macros. (line 6)
  4384. * wrapper #ifndef: Once-Only Headers. (line 6)
  4385. * wrapper headers: Wrapper Headers. (line 6)
  4386. 
  4387. Tag Table:
  4388. Node: Top945
  4389. Node: Overview3506
  4390. Node: Character sets6344
  4391. Ref: Character sets-Footnote-18516
  4392. Node: Initial processing8697
  4393. Ref: trigraphs10256
  4394. Node: Tokenization14456
  4395. Ref: Tokenization-Footnote-121286
  4396. Node: The preprocessing language21397
  4397. Node: Header Files24276
  4398. Node: Include Syntax26192
  4399. Node: Include Operation27829
  4400. Node: Search Path29677
  4401. Node: Once-Only Headers31899
  4402. Node: Alternatives to Wrapper #ifndef33558
  4403. Node: Computed Includes35207
  4404. Node: Wrapper Headers38365
  4405. Node: System Headers40788
  4406. Node: Macros42389
  4407. Node: Object-like Macros43526
  4408. Node: Function-like Macros47116
  4409. Node: Macro Arguments48732
  4410. Node: Stringizing52871
  4411. Node: Concatenation56032
  4412. Node: Variadic Macros59129
  4413. Node: Predefined Macros64081
  4414. Node: Standard Predefined Macros64669
  4415. Node: Common Predefined Macros71001
  4416. Node: System-specific Predefined Macros92104
  4417. Node: C++ Named Operators94127
  4418. Node: Undefining and Redefining Macros95091
  4419. Node: Directives Within Macro Arguments97189
  4420. Node: Macro Pitfalls98130
  4421. Node: Misnesting98663
  4422. Node: Operator Precedence Problems99775
  4423. Node: Swallowing the Semicolon101641
  4424. Node: Duplication of Side Effects103664
  4425. Node: Self-Referential Macros105847
  4426. Node: Argument Prescan108256
  4427. Node: Newlines in Arguments112007
  4428. Node: Conditionals112958
  4429. Node: Conditional Uses114654
  4430. Node: Conditional Syntax116012
  4431. Node: Ifdef116412
  4432. Node: If119569
  4433. Node: Defined121873
  4434. Node: Else123266
  4435. Node: Elif123836
  4436. Node: __has_attribute125149
  4437. Node: __has_cpp_attribute126683
  4438. Node: __has_builtin127569
  4439. Node: __has_include128704
  4440. Node: Deleted Code130291
  4441. Node: Diagnostics131538
  4442. Node: Line Control133087
  4443. Node: Pragmas135365
  4444. Node: Other Directives139762
  4445. Node: Preprocessor Output140812
  4446. Node: Traditional Mode143965
  4447. Node: Traditional lexical analysis145102
  4448. Node: Traditional macros147605
  4449. Node: Traditional miscellany151402
  4450. Node: Traditional warnings152398
  4451. Node: Implementation Details154595
  4452. Node: Implementation-defined behavior155158
  4453. Ref: Identifier characters155908
  4454. Node: Implementation limits158956
  4455. Node: Obsolete Features161629
  4456. Node: Invocation164473
  4457. Ref: dashMF170508
  4458. Ref: fdollars-in-identifiers175087
  4459. Ref: Wtrigraphs189213
  4460. Node: Environment Variables191268
  4461. Node: GNU Free Documentation License194961
  4462. Node: Index of Directives220106
  4463. Node: Option Index222259
  4464. Node: Concept Index228288
  4465. 
  4466. End Tag Table