The #pragmawarningdisable 0168 directive disables the warning with code 0168, which is generated by the compiler when a variable is declared but not used.
Warning 359 is disabled, then after the source code which triggers the warning, the state of the messaging system is retrieved by using the warning pop pragma.
{"2_gov0":{"state":{"logo":{"href":"//yandex.com.tr","isForeign":true},"form":{"action":"/search/","searchLabel":"Bul","hiddenInputs":[{"name":"lr","value":21206}]},"actions":{"advancedSearch":{"checked":false,"ariaLabel":"Gelişmiş arama"},"moreButtonProps":{"ariaLabel":"Daha fazla"},"cbir":{"name":"cbir","label":"Поиск по картинке","infoUrl":"//yandex.ru/promo/photosearch/index?source=landingdesk","isMacOS":false}},"userSection":{"loggedIn":false,"loginProps":{"loginUrl":"https://passport.yandex.com.tr/auth?retpath=%2F&origin=serp_desktop_auth_new","loginText":"Giriş yap","burgerAriaLabel":"Menü"}},"navigation":{"tabs":[{"id":"www","label":"Arama","url":"//yandex.com.tr","params":{"source":"tabbar"},"target":""},{"id":"images","label":"Görsel","url":"//yandex.com.tr/gorsel/search","params":{"text":"[$query]","noreask":"[$noreask]","nomisspell":"[$nomisspell]","parent-reqid":"[$reqid]","from":"tabbar"}},{"id":"video","label":"Video","url":"//yandex.com.tr/video/search","params":{"text":"[$query]","noreask":"[$noreask]","parent-reqid":"[$reqid]","from":"tabbar"}},{"id":"maps","label":"Haritalar","url":"//yandex.com.tr/harita","params":{"text":"[$query]","source":"serp_navig"}},{"id":"translate","label":"Çeviri","url":"//ceviri.yandex.com.tr","params":{"text":"[$query]","from":"tabbar"}}],"selectedTabId":"www"},"context":{"query":"pragma warning disable","reqid":"1722046871751340-7600111627979686959-balancer-l7leveler-kubr-yp-sas-113-BAL","noreask":"1","lr":"21206","counters":{"type":"b","data":{"$header":"0_iavxz000","logo":"0_iavxz001","login":"0_iavxz003","usermenu":"0_iavxz004","market-cart":"0_iavxz006","more-button":"0_iavxz007","cbir":"0_iavxz008","$navigation":"0_iavxz009","item":"0_iavxz00i","tab-www":"0_iavxz00b","tab-images":"0_iavxz00d","tab-video":"0_iavxz00f","tab-maps":"0_iavxz00h","tab-translate":"0_iavxz00j"}}},"loggedIn":false,"baobab":{"parentNode":{"context":{"genInfo":{"prefix":"0_iavxw01-0-1"},"ui":"desktop","service":"web","reqid":"1722046871751340-7600111627979686959-balancer-l7leveler-kubr-yp-sas-113-BAL","fast":{"name":"header-desktop"}}}}},"type":"header-desktop"},"2_iavx0":{"state":{"answersUrl":"https://stackoverflow.com/questions/132667/how-can-i-disable-pragma-warnings#answers","type":"fact","tabsOptions":[{"id":"question","text":"Soru"},{"id":"bestAnswer","text":"En iyi yanıt"},{"id":"moreAnswers","text":"4 yanıt daha","shortText":"Daha fazla"}],"tabContents":{"question":{"construct":[{"type":"paragraph","content":[{"type":"text","content":"While developing a C++ application, I had to use a third-party library which produced a huge amount of warnings related with a harmless #pragma directive being used."}]},{"type":"code","content":[{"type":"text","content":[{"type":"text","content":"../File.hpp:"},{"type":"text","color":"name","content":"1"},{"type":"text","content":": warning: ignoring #pragma ident"}]},{"type":"text","content":[{"type":"text","content":"In file included from ../File2.hpp:"},{"type":"text","color":"name","content":"47"},{"type":"text","content":","}]},{"type":"text","content":[{"type":"text","content":" from ../File3.hpp:"},{"type":"text","color":"name","content":"57"},{"type":"text","content":","}]},{"type":"text","content":[{"type":"text","content":" from File4.h:"},{"type":"text","color":"name","content":"49"},{"type":"text","content":","}]}]},{"type":"paragraph","content":[{"type":"text","content":"Is it possible to disable this kind of warnings, when using the GNU C++ compiler?"}]}],"footerProps":{"date":1636852358,"numLiked":54,"numCommented":0}},"bestAnswer":{"construct":[{"type":"paragraph","content":[{"type":"text","content":"I believe you can compile with "}]},{"type":"code","content":[{"type":"text","content":[{"type":"text","content":"-Wno-unknown-pragmas"}]}]},{"type":"paragraph","content":[{"type":"text","content":"to suppress these."}]}],"footerProps":{"date":1365069523,"numLiked":107,"numCommented":2}},"moreAnswers":[{"construct":[{"type":"paragraph","content":[{"type":"text","content":"In GCC, compile with -Wno-unknown-pragmas"}]},{"type":"paragraph","content":[{"type":"text","content":"In MS Visual Studio 2005 (this question isn't tagged with gcc, so I'm adding this for reference), you can disable globally in Project Settings->C/C++->Advanced. Enter 4068 in \"Disable Specific Warnings\""}]},{"type":"paragraph","content":[{"type":"text","content":"or you can add this to any file to disable warnings locally"}]},{"type":"code","content":[{"type":"text","content":[{"type":"text","color":"comment","content":"#pragma warning (disable : 4068 ) /* disable unknown pragma warnings */"}]}]}],"footerProps":{"date":1222336927,"numLiked":29,"numCommented":0}},{"construct":[{"type":"paragraph","content":[{"type":"text","content":"I know the question is about GCC, but for people wanting to do this as portably as possible:"}]},{"type":"paragraph","content":[{"type":"text","content":"Most compilers which can emit this warning have a way to disable the warning from either the command line (exception: PGI) or in code (exception: DMC):"}]},{"type":"list","content":[{"type":"text","content":[{"type":"text","content":"GCC: "},{"type":"code","content":[{"type":"text","content":"-Wno-unknown-pragmas"}],"isInline":true},{"type":"text","content":" / "},{"type":"code","content":[{"type":"text","content":"#pragma GCC diagnostic ignored \"-Wunknown-pragmas\""}],"isInline":true}]},{"type":"text","content":[{"type":"text","content":"Clang"},{"type":"text","content":": "},{"type":"code","content":[{"type":"text","content":"-Wno-unknown-pragmas"}],"isInline":true},{"type":"text","content":" / "},{"type":"code","content":[{"type":"text","content":"#pragma clang diagnostic ignored \"-Wunknown-pragmas\""}],"isInline":true}]},{"type":"text","content":[{"type":"text","content":"Intel C/C++ Compiler"},{"type":"text","content":": "},{"type":"code","content":[{"type":"text","content":"-diag-disable 161"}],"isInline":true},{"type":"text","content":" / "},{"type":"code","content":[{"type":"text","content":"#pragma warning(disable:161)"}],"isInline":true}]},{"type":"text","content":[{"type":"text","content":"PGI"},{"type":"text","content":": "},{"type":"code","content":[{"type":"text","content":"#pragma diag_suppress 1675"}],"isInline":true}]},{"type":"text","content":[{"type":"text","content":"MSVC"},{"type":"text","content":": "},{"type":"code","content":[{"type":"text","content":"-wd4068"}],"isInline":true},{"type":"text","content":" / "},{"type":"code","content":[{"type":"text","content":"#pragma warning(disable:4068)"}],"isInline":true}]},{"type":"text","content":[{"type":"text","content":"TI: "},{"type":"code","content":[{"type":"text","content":"--diag_suppress,-pds=163"}],"isInline":true},{"type":"text","content":" / "},{"type":"code","content":[{"type":"text","content":"#pragma diag_suppress 163"}],"isInline":true}]},{"type":"text","content":[{"type":"text","content":"IAR C/C++ Compiler"},{"type":"text","content":": "},{"type":"code","content":[{"type":"text","content":"--diag_suppress Pe161"}],"isInline":true},{"type":"text","content":" / "},{"type":"code","content":[{"type":"text","content":"#pragma diag_suppress=Pe161"}],"isInline":true}]},{"type":"text","content":[{"type":"text","content":"Digital Mars C/C++ Compiler"},{"type":"text","content":": "},{"type":"code","content":[{"type":"text","content":"-w17"}],"isInline":true}]},{"type":"text","content":[{"type":"text","content":"Cray: "},{"type":"code","content":[{"type":"text","content":"-h nomessage=1234"}],"isInline":true}]}]},{"type":"paragraph","content":[{"type":"text","content":"You can combine most of this into a single macro to use in your code, which is what I did for the "},{"type":"code","content":[{"type":"text","content":"HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS"}],"isInline":true},{"type":"text","content":" macro in "},{"type":"text","content":"Hedley"}]},{"type":"code","content":[{"type":"text","content":[{"type":"text","color":"comment","content":"#if HEDLEY_HAS_WARNING(\"-Wunknown-pragmas\")"}]},{"type":"text","content":[{"type":"text","color":"comment","content":"# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma(\"clang diagnostic ignored \\\"-Wunknown-pragmas\\\"\")"}]},{"type":"text","content":[{"type":"text","color":"comment","content":"#elif HEDLEY_INTEL_VERSION_CHECK(16,0,0)"}]},{"type":"text","content":[{"type":"text","color":"comment","content":"# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma(\"warning(disable:161)\")"}]},{"type":"text","content":[{"type":"text","color":"comment","content":"#elif HEDLEY_PGI_VERSION_CHECK(17,10,0)"}]},{"type":"text","content":[{"type":"text","color":"comment","content":"# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma(\"diag_suppress 1675\")"}]},{"type":"text","content":[{"type":"text","color":"comment","content":"#elif HEDLEY_GNUC_VERSION_CHECK(4,3,0)"}]},{"type":"text","content":[{"type":"text","color":"comment","content":"# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma(\"GCC diagnostic ignored \\\"-Wunknown-pragmas\\\"\")"}]},{"type":"text","content":[{"type":"text","color":"comment","content":"#elif HEDLEY_MSVC_VERSION_CHECK(15,0,0)"}]},{"type":"text","content":[{"type":"text","color":"comment","content":"# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068))"}]},{"type":"text","content":[{"type":"text","color":"comment","content":"#elif HEDLEY_TI_VERSION_CHECK(8,0,0)"}]},{"type":"text","content":[{"type":"text","color":"comment","content":"# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma(\"diag_suppress 163\")"}]},{"type":"text","content":[{"type":"text","color":"comment","content":"#elif HEDLEY_IAR_VERSION_CHECK(8,0,0)"}]},{"type":"text","content":[{"type":"text","color":"comment","content":"# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma(\"diag_suppress=Pe161\")"}]},{"type":"text","content":[{"type":"text","color":"comment","content":"#else"}]},{"type":"text","content":[{"type":"text","color":"comment","content":"# define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS"}]},{"type":"text","content":[{"type":"text","color":"comment","content":"#endif"}]}]},{"type":"paragraph","content":[{"type":"text","content":"Note that Hedley may have more complete information than this answer since I'll probably forget to update this answer, so if you don't want to just use Hedley (it's a single public domain C/C++ header you can easily drop into you project) you might want to use Hedley as a guide instead of the information above."}]},{"type":"paragraph","content":[{"type":"text","content":"The version checks are probably overly pessimistic, but sometimes it's hard to get good info about obsolete versions of proprietary compilers, and I'd rather be safe than sorry. Again, Hedley's information may be better."}]},{"type":"paragraph","content":[{"type":"text","content":"Many compilers can also push/pop warnings onto a stack, so you can push, then disable them before including code you don't control, then pop so "},{"type":"text","content":"your"},{"type":"text","content":" code will still trigger the warning in question (so you can clean it up). There are macros for that in Hedley, too: "},{"type":"code","content":[{"type":"text","content":"HEDLEY_DIAGNOSTIC_PUSH"}],"isInline":true},{"type":"text","content":" / "},{"type":"code","content":[{"type":"text","content":"HEDLEY_DIAGNOSTIC_POP"}],"isInline":true},{"type":"text","content":"."}]}],"footerProps":{"date":1636852974,"numLiked":20,"numCommented":0}}]},"organic":{"faviconProps":{"src":"https://favicon.yandex.net/favicon/v2/https://stackoverflow.com","size":"m","pageNumber":0,"index":0},"title":"How can I \u0007[disable\u0007] #\u0007[pragma\u0007] \u0007[warnings\u0007]?","pathProps":{"items":[{"url":"https://stackoverflow.com/questions/132667/how-can-i-disable-pragma-warnings","text":"stackoverflow.com"},{"url":"https://stackoverflow.com/questions/132667/how-can-i-disable-pragma-warnings","text":"how-can-i-disable-pragma-warnings"}]},"faviconPosition":0,"subtitlePosition":1,"linkProps":{"url":"https://stackoverflow.com/questions/132667/how-can-i-disable-pragma-warnings"},"hostTitle":"stackoverflow.com","description":""},"extralinksProps":{"hidden":true,"directions":["bottom-end"],"items":[{"variant":"reportFeedback","reportFeedback":{"feature":"Блок ответов для разработчиков","title":"Bu yanıtta yanlış olan nedir?","checkBoxLabels":[{"value":"Yanıt sorguya uygun değil"},{"value":"Yanıt hatalı"},{"value":"Yanıttaki bilgiler eksik"},{"value":"Diğer"}]}}]},"baobab":{"parentNode":{"context":{"genInfo":{"prefix":"2_iavxw0b-0-1"},"ui":"desktop","service":"web","reqid":"1722046871751340-7600111627979686959-balancer-l7leveler-kubr-yp-sas-113-BAL","fast":{"name":"article"}}}}},"type":"article"},"2_iavx1":{"state":{"linksGroups":[{"type":"geo","links":[{"label":"Columbus","title":"Columbus","url":"//yandex.com.tr/tune/geo","logNode":{"name":"region"},"target":"_self","a11yLabel":"Bölgeniz Columbus","needRetpath":true}]},{"type":"feedback","links":[{"label":"Hata bildir","logNode":{"name":"feedback","attrs":{"behaviour":{"type":"dynamic"}}}}]},{"type":"settings","links":[{"label":"Ayarlar","url":"//yandex.com.tr/tune/search","logNode":{"name":"settings"},"target":"_self","needRetpath":true}]},{"type":"company","links":[{"label":"Hakkımızda","url":"https://company.yandex.com.tr","logNode":{"name":"about"},"target":"_blank"},{"label":"Ticari teklifler","url":"/search/direct?text=pragma%20warning%20disable&filters_docs=direct_cm","logNode":{"name":"commercial"},"target":"_blank"},{"label":"Kariyer","url":"//yandex.com.tr/jobs/?utm_source=serp_turkie&utm_medium=footerlink&utm_content=career","logNode":{"name":"vacancy"},"target":"_blank"},{"label":"Kullanım lisansı","url":"//yandex.com.tr/legal/termsofuse/","logNode":{"name":"license"},"target":"_blank"},{"label":"Gizlilik Politikası","url":"//yandex.com.tr/legal/confidential/","logNode":{"name":"confidential"},"target":"_blank"}],"a11yHidden":true}],"reportFeedbackProps":{"feature":"Подвал","title":"Hata bildir","checkBoxLabels":[]},"isSearchApp":false,"hasExtralinks":true,"limitingSelector":".AliceFabButton","baobab":{"parentNode":{"context":{"genInfo":{"prefix":"2_iavxw0c-0-1"},"ui":"desktop","service":"web","reqid":"1722046871751340-7600111627979686959-balancer-l7leveler-kubr-yp-sas-113-BAL"}}}},"type":"serp-footer"},"2_iavx2":{"state":{"conditionLoadList":{"marketCart":false,"highchartsHighstock":false,"advProductGallery":false,"musicPlayer":false,"ecomRates":false,"photoViewer":false,"easterEggModal":false,"darkmodeChangeDrawer":true},"reportFeedbackBaseProps":{"initEmail":"","metaFields":{"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","userTestids":"186144,1070957,1047188,1062603,1005518,1000275,1054383,1053380,1071889,1064987,1066377,1069204,1059417,1048639,898758,1043105,1070375,1064763,1070378,30275,936724,1071373,1066413,1071376,1066587,1066183,1061209,1073684,1003071,1045125,985435,1071646,1070928,1060646,658770,364898,1069936,1021600,1066329,1056358,132361,1072294,1067152,1070867,461652,1071233,1065202,1064227,151171,126321,126352,287509,338390,787997,1065399,1048647,1066000,1073312,1046872,1051463,912286","yandexuid":"6357914511722046869","uid":"0","queryText":"pragma warning disable","reqid":"1722046871751340-7600111627979686959-balancer-l7leveler-kubr-yp-sas-113-BAL","searchSlices":["drawer_search_slice_english","drawer_search_slice_cs"],"userRegionName":"Columbus","userRegionId":"20815"}},"extralinksPopupProps":{"abuseLink":"https://twitter.yandex.com.tr/search/abuse?sign=bac32e4f864f07210fff0f94d1377f57&keyno=0"},"isLoggedIn":false,"userMenuDialogProps":{"flag":"skin,feedback","host":"yandex.com.tr","lang":"tr","project":"serp","queryParams":{"utm_source":"search"},"retpath":"https%3A%2F%2Ftwitter.yandex.com.tr%2Fsearch%2F%3Fes_context%3D0oYl8Q____________ARpLMTcxOTY2ODQ2OTg3NTY0My0xMjI1ODgwNjI2NzMyNjAzODc0Ni1iYWxhbmNlci1sN2xldmVsZXIta3Vici15cC1zYXMtODEtQkFMMgVhc3NvY-26GJ4%26lr%3D21206%26noreask%3D1%26rq%3D1%26serp-reload-from%3Drec_bottom%26text%3Dpragma%2Bwarning%2Bdisable%26ncrnd%3D41922","tld":"com.tr"},"baobab":{"parentNode":{"context":{"genInfo":{"prefix":"2_iavxw0d-0-1"},"ui":"desktop","service":"web","reqid":"1722046871751340-7600111627979686959-balancer-l7leveler-kubr-yp-sas-113-BAL","fast":{"name":"lazy-load"}}}}},"type":"lazy-load"}}