| 1 |
------------------------------------------------------------------------------ |
| 2 |
-- -- |
| 3 |
-- GNAT COMPILER COMPONENTS -- |
| 4 |
-- -- |
| 5 |
-- D I A G N O S T I C S . D I A G N O S T I C S _ R E P O S I T O R Y -- |
| 6 |
-- -- |
| 7 |
-- B o d y -- |
| 8 |
-- -- |
| 9 |
-- Copyright (C) 1992-2025, Free Software Foundation, Inc. -- |
| 10 |
-- -- |
| 11 |
-- GNAT is free software; you can redistribute it and/or modify it under -- |
| 12 |
-- terms of the GNU General Public License as published by the Free Soft- -- |
| 13 |
-- ware Foundation; either version 3, or (at your option) any later ver- -- |
| 14 |
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- |
| 15 |
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- |
| 16 |
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- |
| 17 |
-- for more details. You should have received a copy of the GNU General -- |
| 18 |
-- Public License distributed with GNAT; see file COPYING3. If not, go to -- |
| 19 |
-- http://www.gnu.org/licenses for a complete copy of the license. -- |
| 20 |
-- -- |
| 21 |
-- GNAT was originally developed by the GNAT team at New York University. -- |
| 22 |
-- Extensive contributions were provided by Ada Core Technologies Inc. -- |
| 23 |
-- -- |
| 24 |
------------------------------------------------------------------------------ |
| 25 |
with Diagnostics.JSON_Utils; use Diagnostics.JSON_Utils; |
| 26 |
with Output; use Output; |
| 27 |
package body Diagnostics.Switch_Repository is |
| 28 |
|
| 29 |
Switches : constant array (Switch_Id) |
| 30 |
of Switch_Type := |
| 31 |
(No_Switch_Id => |
| 32 |
(others => <>), |
| 33 |
gnatwb => |
| 34 |
(Human_Id => new String'("Warn_On_Bad_Fixed_Value"), |
| 35 |
Status => Active, |
| 36 |
Short_Name => new String'("gnatwb"), |
| 37 |
Description => null, |
| 38 |
Documentation_Url => null), |
| 39 |
gnatwc => |
| 40 |
(Human_Id => new String'("Constant_Condition_Warnings"), |
| 41 |
Status => Active, |
| 42 |
Short_Name => new String'("gnatwc"), |
| 43 |
Description => null, |
| 44 |
Documentation_Url => null), |
| 45 |
gnatwd => |
| 46 |
-- TODO: is this a subcheck of general gnatwu? |
| 47 |
(Human_Id => new String'("Warn_On_Dereference"), |
| 48 |
Status => Active, |
| 49 |
Short_Name => new String'("gnatwd"), |
| 50 |
Description => null, |
| 51 |
Documentation_Url => null), |
| 52 |
gnatwf => |
| 53 |
(Human_Id => new String'("Check_Unreferenced_Formals"), |
| 54 |
Status => Active, |
| 55 |
Short_Name => new String'("gnatwf"), |
| 56 |
Description => null, |
| 57 |
Documentation_Url => null), |
| 58 |
gnatwg => |
| 59 |
(Human_Id => new String'("Warn_On_Unrecognized_Pragma"), |
| 60 |
Status => Active, |
| 61 |
Short_Name => new String'("gnatwg"), |
| 62 |
Description => null, |
| 63 |
Documentation_Url => null), |
| 64 |
gnatwh => |
| 65 |
(Human_Id => new String'("Warn_On_Hiding"), |
| 66 |
Status => Active, |
| 67 |
Short_Name => new String'("gnatwh"), |
| 68 |
Description => null, |
| 69 |
Documentation_Url => null), |
| 70 |
gnatwi => |
| 71 |
(Human_Id => new String'("Implementation_Unit_Warnings"), |
| 72 |
Status => Active, |
| 73 |
Short_Name => new String'("gnatwi"), |
| 74 |
Description => null, |
| 75 |
Documentation_Url => null), |
| 76 |
gnatwj => |
| 77 |
(Human_Id => new String'("Warn_On_Obsolescent_Feature"), |
| 78 |
Status => Active, |
| 79 |
Short_Name => new String'("gnatwj"), |
| 80 |
Description => null, |
| 81 |
Documentation_Url => null), |
| 82 |
gnatwk => |
| 83 |
(Human_Id => new String'("Warn_On_Constant"), |
| 84 |
Status => Active, |
| 85 |
Short_Name => new String'("gnatwk"), |
| 86 |
Description => null, |
| 87 |
Documentation_Url => null), |
| 88 |
gnatwl => |
| 89 |
(Human_Id => new String'("Elab_Warnings"), |
| 90 |
Status => Active, |
| 91 |
Short_Name => new String'("gnatwl"), |
| 92 |
Description => null, |
| 93 |
Documentation_Url => null), |
| 94 |
gnatwm => |
| 95 |
(Human_Id => new String'("Warn_On_Modified_Unread"), |
| 96 |
Status => Active, |
| 97 |
Short_Name => new String'("gnatwm"), |
| 98 |
Description => null, |
| 99 |
Documentation_Url => null), |
| 100 |
gnatwo => |
| 101 |
(Human_Id => new String'("Address_Clause_Overlay_Warnings"), |
| 102 |
Status => Active, |
| 103 |
Short_Name => new String'("gnatwo"), |
| 104 |
Description => null, |
| 105 |
Documentation_Url => null), |
| 106 |
gnatwp => |
| 107 |
(Human_Id => new String'("Ineffective_Inline_Warnings"), |
| 108 |
Status => Active, |
| 109 |
Short_Name => new String'("gnatwp"), |
| 110 |
Description => null, |
| 111 |
Documentation_Url => null), |
| 112 |
gnatwq => |
| 113 |
(Human_Id => new String'("Warn_On_Questionable_Missing_Parens"), |
| 114 |
Status => Active, |
| 115 |
Short_Name => new String'("gnatwq"), |
| 116 |
Description => null, |
| 117 |
Documentation_Url => null), |
| 118 |
gnatwr => |
| 119 |
(Human_Id => new String'("Warn_On_Redundant_Constructs"), |
| 120 |
Status => Active, |
| 121 |
Short_Name => new String'("gnatwr"), |
| 122 |
Description => null, |
| 123 |
Documentation_Url => null), |
| 124 |
gnatwt => |
| 125 |
(Human_Id => new String'("Warn_On_Deleted_Code"), |
| 126 |
Status => Active, |
| 127 |
Short_Name => new String'("gnatwt"), |
| 128 |
Description => null, |
| 129 |
Documentation_Url => null), |
| 130 |
gnatwu => |
| 131 |
(Human_Id => new String'("Warn_On_Unused_Entities"), |
| 132 |
Status => Active, |
| 133 |
Short_Name => new String'("gnatwu"), |
| 134 |
Description => null, |
| 135 |
Documentation_Url => null), |
| 136 |
gnatwv => |
| 137 |
(Human_Id => new String'("Warn_On_No_Value_Assigned"), |
| 138 |
Status => Active, |
| 139 |
Short_Name => new String'("gnatwv"), |
| 140 |
Description => null, |
| 141 |
Documentation_Url => null), |
| 142 |
gnatww => |
| 143 |
(Human_Id => new String'("Warn_On_Assumed_Low_Bound"), |
| 144 |
Status => Active, |
| 145 |
Short_Name => new String'("gnatww"), |
| 146 |
Description => null, |
| 147 |
Documentation_Url => null), |
| 148 |
gnatwx => |
| 149 |
(Human_Id => new String'("Warn_On_Export_Import"), |
| 150 |
Status => Active, |
| 151 |
Short_Name => new String'("gnatwx"), |
| 152 |
Description => null, |
| 153 |
Documentation_Url => null), |
| 154 |
gnatwy => |
| 155 |
(Human_Id => new String'("Warn_On_Ada_Compatibility_Issues"), |
| 156 |
Status => Active, |
| 157 |
Short_Name => new String'("gnatwy"), |
| 158 |
Description => null, |
| 159 |
Documentation_Url => null), |
| 160 |
gnatwz => |
| 161 |
(Human_Id => new String'("Warn_On_Unchecked_Conversion"), |
| 162 |
Status => Active, |
| 163 |
Short_Name => new String'("gnatwz"), |
| 164 |
Description => null, |
| 165 |
Documentation_Url => null), |
| 166 |
gnatw_dot_a => |
| 167 |
(Human_Id => new String'("Warn_On_Assertion_Failure"), |
| 168 |
Status => Active, |
| 169 |
Short_Name => new String'("gnatw.a"), |
| 170 |
Description => null, |
| 171 |
Documentation_Url => null), |
| 172 |
gnatw_dot_b => |
| 173 |
(Human_Id => new String'("Warn_On_Biased_Representation"), |
| 174 |
Status => Active, |
| 175 |
Short_Name => new String'("gnatw.b"), |
| 176 |
Description => null, |
| 177 |
Documentation_Url => null), |
| 178 |
gnatw_dot_c => |
| 179 |
(Human_Id => new String'("Warn_On_Unrepped_Components"), |
| 180 |
Status => Active, |
| 181 |
Short_Name => new String'("gnatw.c"), |
| 182 |
Description => null, |
| 183 |
Documentation_Url => null), |
| 184 |
gnatw_dot_f => |
| 185 |
(Human_Id => new String'("Warn_On_Elab_Access"), |
| 186 |
Status => Active, |
| 187 |
Short_Name => new String'("gnatw.f"), |
| 188 |
Description => null, |
| 189 |
Documentation_Url => null), |
| 190 |
gnatw_dot_h => |
| 191 |
(Human_Id => new String'("Warn_On_Record_Holes"), |
| 192 |
Status => Active, |
| 193 |
Short_Name => new String'("gnatw.h"), |
| 194 |
Description => null, |
| 195 |
Documentation_Url => null), |
| 196 |
gnatw_dot_i => |
| 197 |
(Human_Id => new String'("Warn_On_Overlap"), |
| 198 |
Status => Active, |
| 199 |
Short_Name => new String'("gnatw.i"), |
| 200 |
Description => null, |
| 201 |
Documentation_Url => null), |
| 202 |
gnatw_dot_j => |
| 203 |
(Human_Id => new String'("Warn_On_Late_Primitives"), |
| 204 |
Status => Active, |
| 205 |
Short_Name => new String'("gnatw.j"), |
| 206 |
Description => null, |
| 207 |
Documentation_Url => null), |
| 208 |
gnatw_dot_k => |
| 209 |
(Human_Id => new String'("Warn_On_Standard_Redefinition"), |
| 210 |
Status => Active, |
| 211 |
Short_Name => new String'("gnatw.k"), |
| 212 |
Description => null, |
| 213 |
Documentation_Url => null), |
| 214 |
gnatw_dot_l => |
| 215 |
(Human_Id => new String'("List_Inherited_Aspects"), |
| 216 |
Status => Active, |
| 217 |
Short_Name => new String'("gnatw.l"), |
| 218 |
Description => null, |
| 219 |
Documentation_Url => null), |
| 220 |
gnatw_dot_m => |
| 221 |
(Human_Id => new String'("Warn_On_Suspicious_Modulus_Value"), |
| 222 |
Status => Active, |
| 223 |
Short_Name => new String'("gnatw.m"), |
| 224 |
Description => null, |
| 225 |
Documentation_Url => null), |
| 226 |
gnatw_dot_n => |
| 227 |
(Human_Id => new String'("Warn_On_Atomic_Synchronization"), |
| 228 |
Status => Active, |
| 229 |
Short_Name => new String'("gnatw.n"), |
| 230 |
Description => null, |
| 231 |
Documentation_Url => null), |
| 232 |
gnatw_dot_o => |
| 233 |
(Human_Id => new String'("Warn_On_All_Unread_Out_Parameters"), |
| 234 |
Status => Active, |
| 235 |
Short_Name => new String'("gnatw.o"), |
| 236 |
Description => null, |
| 237 |
Documentation_Url => null), |
| 238 |
gnatw_dot_p => |
| 239 |
(Human_Id => new String'("Warn_On_Parameter_Order"), |
| 240 |
Status => Active, |
| 241 |
Short_Name => new String'("gnatw.p"), |
| 242 |
Description => null, |
| 243 |
Documentation_Url => null), |
| 244 |
gnatw_dot_q => |
| 245 |
(Human_Id => new String'("Warn_On_Questionable_Layout"), |
| 246 |
Status => Active, |
| 247 |
Short_Name => new String'("gnatw.q"), |
| 248 |
Description => null, |
| 249 |
Documentation_Url => null), |
| 250 |
gnatw_dot_r => |
| 251 |
(Human_Id => new String'("Warn_On_Object_Renames_Function"), |
| 252 |
Status => Active, |
| 253 |
Short_Name => new String'("gnatw.r"), |
| 254 |
Description => null, |
| 255 |
Documentation_Url => null), |
| 256 |
gnatw_dot_s => |
| 257 |
(Human_Id => new String'("Warn_On_Overridden_Size"), |
| 258 |
Status => Active, |
| 259 |
Short_Name => new String'("gnatw.s"), |
| 260 |
Description => null, |
| 261 |
Documentation_Url => null), |
| 262 |
gnatw_dot_t => |
| 263 |
(Human_Id => new String'("Warn_On_Suspicious_Contract"), |
| 264 |
Status => Active, |
| 265 |
Short_Name => new String'("gnatw.t"), |
| 266 |
Description => null, |
| 267 |
Documentation_Url => null), |
| 268 |
gnatw_dot_u => |
| 269 |
(Human_Id => new String'("Warn_On_Unordered_Enumeration_Type"), |
| 270 |
Status => Active, |
| 271 |
Short_Name => new String'("gnatw.u"), |
| 272 |
Description => null, |
| 273 |
Documentation_Url => null), |
| 274 |
gnatw_dot_v => |
| 275 |
(Human_Id => new String'("Warn_On_Reverse_Bit_Order"), |
| 276 |
Status => Active, |
| 277 |
Short_Name => new String'("gnatw.v"), |
| 278 |
Description => null, |
| 279 |
Documentation_Url => null), |
| 280 |
gnatw_dot_w => |
| 281 |
(Human_Id => new String'("Warn_On_Warnings_Off"), |
| 282 |
Status => Active, |
| 283 |
Short_Name => new String'("gnatw.w"), |
| 284 |
Description => null, |
| 285 |
Documentation_Url => null), |
| 286 |
gnatw_dot_x => |
| 287 |
(Human_Id => |
| 288 |
new String'("Warn_No_Exception_Propagation_Active"), |
| 289 |
Status => Active, |
| 290 |
Short_Name => new String'("gnatw.x"), |
| 291 |
Description => null, |
| 292 |
Documentation_Url => null), |
| 293 |
gnatw_dot_y => |
| 294 |
(Human_Id => new String'("List_Body_Required_Info"), |
| 295 |
Status => Active, |
| 296 |
Short_Name => new String'("gnatw.y"), |
| 297 |
Description => null, |
| 298 |
Documentation_Url => null), |
| 299 |
gnatw_dot_z => |
| 300 |
(Human_Id => new String'("Warn_On_Size_Alignment"), |
| 301 |
Status => Active, |
| 302 |
Short_Name => new String'("gnatw.z"), |
| 303 |
Description => null, |
| 304 |
Documentation_Url => null), |
| 305 |
gnatw_underscore_a => |
| 306 |
(Human_Id => new String'("Warn_On_Anonymous_Allocators"), |
| 307 |
Status => Active, |
| 308 |
Short_Name => new String'("gnatw_a"), |
| 309 |
Description => null, |
| 310 |
Documentation_Url => null), |
| 311 |
gnatw_underscore_c => |
| 312 |
(Human_Id => new String'("Warn_On_Unknown_Compile_Time_Warning"), |
| 313 |
Status => Active, |
| 314 |
Short_Name => new String'("gnatw_c"), |
| 315 |
Description => null, |
| 316 |
Documentation_Url => null), |
| 317 |
gnatw_underscore_j => |
| 318 |
(Human_Id => new String'("Warn_On_Non_Dispatching_Primitives"), |
| 319 |
Status => Active, |
| 320 |
Short_Name => new String'("gnatw_j"), |
| 321 |
Description => null, |
| 322 |
Documentation_Url => null), |
| 323 |
gnatw_underscore_l => |
| 324 |
(Human_Id => new String'("Warn_On_Inherently_Limited_Types"), |
| 325 |
Status => Active, |
| 326 |
Short_Name => new String'("gnatw_l"), |
| 327 |
Description => null, |
| 328 |
Documentation_Url => null), |
| 329 |
gnatw_underscore_p => |
| 330 |
(Human_Id => new String'("Warn_On_Pedantic_Checks"), |
| 331 |
Status => Active, |
| 332 |
Short_Name => new String'("gnatw_p"), |
| 333 |
Description => null, |
| 334 |
Documentation_Url => null), |
| 335 |
gnatw_underscore_q => |
| 336 |
(Human_Id => new String'("Warn_On_Ignored_Equality"), |
| 337 |
Status => Active, |
| 338 |
Short_Name => new String'("gnatw_q"), |
| 339 |
Description => null, |
| 340 |
Documentation_Url => null), |
| 341 |
gnatw_underscore_r => |
| 342 |
(Human_Id => new String'("Warn_On_Component_Order"), |
| 343 |
Status => Active, |
| 344 |
Short_Name => new String'("gnatw_r"), |
| 345 |
Description => null, |
| 346 |
Documentation_Url => null), |
| 347 |
gnatw_underscore_s => |
| 348 |
(Human_Id => new String'("Warn_On_Ineffective_Predicate_Test"), |
| 349 |
Status => Active, |
| 350 |
Short_Name => new String'("gnatw_s"), |
| 351 |
Description => null, |
| 352 |
Documentation_Url => null), |
| 353 |
-- NOTE: this flag is usually followed by a number specfifying the |
| 354 |
-- indentation level. We encode all of these warnings as -gnaty0 |
| 355 |
-- irregardless of the actual numeric value. |
| 356 |
gnaty => |
| 357 |
(Human_Id => new String'("Style_Check_Indentation_Level"), |
| 358 |
Status => Active, |
| 359 |
Short_Name => new String'("gnaty0"), |
| 360 |
Description => null, |
| 361 |
Documentation_Url => null), |
| 362 |
gnatya => |
| 363 |
(Human_Id => new String'("Style_Check_Attribute_Casing"), |
| 364 |
Status => Active, |
| 365 |
Short_Name => new String'("gnatya"), |
| 366 |
Description => null, |
| 367 |
Documentation_Url => null), |
| 368 |
gnatyaa => |
| 369 |
(Human_Id => new String'("Address_Clause_Overlay_Warnings"), |
| 370 |
Status => Active, |
| 371 |
Short_Name => new String'("gnatyA"), |
| 372 |
Description => null, |
| 373 |
Documentation_Url => null), |
| 374 |
gnatyb => |
| 375 |
(Human_Id => new String'("Style_Check_Blanks_At_End"), |
| 376 |
Status => Active, |
| 377 |
Short_Name => new String'("gnatyb"), |
| 378 |
Description => null, |
| 379 |
Documentation_Url => null), |
| 380 |
gnatybb => |
| 381 |
-- NOTE: in live documentation it is called "Check Boolean operators" |
| 382 |
(Human_Id => new String'("Style_Check_Boolean_And_Or"), |
| 383 |
Status => Active, |
| 384 |
Short_Name => new String'("gnatyB"), |
| 385 |
Description => null, |
| 386 |
Documentation_Url => null), |
| 387 |
gnatyc => |
| 388 |
(Human_Id => new String'("Style_Check_Comments_Double_Space"), |
| 389 |
Status => Active, |
| 390 |
Short_Name => new String'("gnatyc"), |
| 391 |
Description => null, |
| 392 |
Documentation_Url => null), |
| 393 |
gnatycc => |
| 394 |
(Human_Id => new String'("Style_Check_Comments_Single_Space"), |
| 395 |
Status => Active, |
| 396 |
Short_Name => new String'("gnatyC"), |
| 397 |
Description => null, |
| 398 |
Documentation_Url => null), |
| 399 |
gnatyd => |
| 400 |
(Human_Id => new String'("Style_Check_DOS_Line_Terminator"), |
| 401 |
Status => Active, |
| 402 |
Short_Name => new String'("gnatyd"), |
| 403 |
Description => null, |
| 404 |
Documentation_Url => null), |
| 405 |
gnatydd => |
| 406 |
(Human_Id => new String'("Style_Check_Mixed_Case_Decls"), |
| 407 |
Status => Active, |
| 408 |
Short_Name => new String'("gnatyD"), |
| 409 |
Description => null, |
| 410 |
Documentation_Url => null), |
| 411 |
gnatye => |
| 412 |
(Human_Id => new String'("Style_Check_End_Labels"), |
| 413 |
Status => Active, |
| 414 |
Short_Name => new String'("gnatye"), |
| 415 |
Description => null, |
| 416 |
Documentation_Url => null), |
| 417 |
gnatyf => |
| 418 |
(Human_Id => new String'("Style_Check_Form_Feeds"), |
| 419 |
Status => Active, |
| 420 |
Short_Name => new String'("gnatyf"), |
| 421 |
Description => null, |
| 422 |
Documentation_Url => null), |
| 423 |
gnatyh => |
| 424 |
(Human_Id => new String'("Style_Check_Horizontal_Tabs"), |
| 425 |
Status => Active, |
| 426 |
Short_Name => new String'("gnatyh"), |
| 427 |
Description => null, |
| 428 |
Documentation_Url => null), |
| 429 |
gnatyi => |
| 430 |
(Human_Id => new String'("Style_Check_If_Then_Layout"), |
| 431 |
Status => Active, |
| 432 |
Short_Name => new String'("gnatyi"), |
| 433 |
Description => null, |
| 434 |
Documentation_Url => null), |
| 435 |
gnatyii => |
| 436 |
(Human_Id => new String'("Style_Check_Mode_In"), |
| 437 |
Status => Active, |
| 438 |
Short_Name => new String'("gnatyI"), |
| 439 |
Description => null, |
| 440 |
Documentation_Url => null), |
| 441 |
gnatyk => |
| 442 |
(Human_Id => new String'("Style_Check_Keyword_Casing"), |
| 443 |
Status => Active, |
| 444 |
Short_Name => new String'("gnatyk"), |
| 445 |
Description => null, |
| 446 |
Documentation_Url => null), |
| 447 |
gnatyl => |
| 448 |
(Human_Id => new String'("Style_Check_Layout"), |
| 449 |
Status => Active, |
| 450 |
Short_Name => new String'("gnatyl"), |
| 451 |
Description => null, |
| 452 |
Documentation_Url => null), |
| 453 |
gnatyll => |
| 454 |
(Human_Id => new String'("Style_Check_Max_Nesting_Level"), |
| 455 |
Status => Active, |
| 456 |
Short_Name => new String'("gnatyL"), |
| 457 |
Description => null, |
| 458 |
Documentation_Url => null), |
| 459 |
gnatym => |
| 460 |
(Human_Id => new String'("Style_Check_Max_Line_Length"), |
| 461 |
Status => Active, |
| 462 |
Short_Name => new String'("gnatym"), |
| 463 |
Description => null, |
| 464 |
Documentation_Url => null), |
| 465 |
gnatymm => |
| 466 |
-- TODO: May contain line length |
| 467 |
(Human_Id => new String'("Style_Check_Max_Line_Length"), |
| 468 |
Status => Active, |
| 469 |
Short_Name => new String'("gnatyM"), |
| 470 |
Description => null, |
| 471 |
Documentation_Url => null), |
| 472 |
gnatyn => |
| 473 |
(Human_Id => new String'("Style_Check_Standard"), |
| 474 |
Status => Active, |
| 475 |
Short_Name => new String'("gnatyn"), |
| 476 |
Description => null, |
| 477 |
Documentation_Url => null), |
| 478 |
gnatyo => |
| 479 |
(Human_Id => new String'("Style_Check_Order_Subprograms"), |
| 480 |
Status => Active, |
| 481 |
Short_Name => new String'("gnatyo"), |
| 482 |
Description => null, |
| 483 |
Documentation_Url => null), |
| 484 |
gnatyoo => |
| 485 |
(Human_Id => new String'("Style_Check_Missing_Overriding"), |
| 486 |
Status => Active, |
| 487 |
Short_Name => new String'("gnatyO"), |
| 488 |
Description => null, |
| 489 |
Documentation_Url => null), |
| 490 |
gnatyp => |
| 491 |
(Human_Id => new String'("Style_Check_Pragma_Casing"), |
| 492 |
Status => Active, |
| 493 |
Short_Name => new String'("gnatyp"), |
| 494 |
Description => null, |
| 495 |
Documentation_Url => null), |
| 496 |
gnatyr => |
| 497 |
(Human_Id => new String'("Style_Check_References"), |
| 498 |
Status => Active, |
| 499 |
Short_Name => new String'("gnatyr"), |
| 500 |
Description => null, |
| 501 |
Documentation_Url => null), |
| 502 |
gnatys => |
| 503 |
(Human_Id => new String'("Style_Check_Specs"), |
| 504 |
Status => Active, |
| 505 |
Short_Name => new String'("gnatys"), |
| 506 |
Description => null, |
| 507 |
Documentation_Url => null), |
| 508 |
gnatyss => |
| 509 |
(Human_Id => new String'("Style_Check_Separate_Stmt_Lines"), |
| 510 |
Status => Active, |
| 511 |
Short_Name => new String'("gnatyS"), |
| 512 |
Description => null, |
| 513 |
Documentation_Url => null), |
| 514 |
gnatytt => |
| 515 |
(Human_Id => new String'("Style_Check_Tokens"), |
| 516 |
Status => Active, |
| 517 |
Short_Name => new String'("gnatyt"), |
| 518 |
Description => null, |
| 519 |
Documentation_Url => null), |
| 520 |
gnatyu => |
| 521 |
(Human_Id => new String'("Style_Check_Blank_Lines"), |
| 522 |
Status => Active, |
| 523 |
Short_Name => new String'("gnatyu"), |
| 524 |
Description => null, |
| 525 |
Documentation_Url => null), |
| 526 |
gnatyx => |
| 527 |
(Human_Id => new String'("Style_Check_Xtra_Parens"), |
| 528 |
Status => Active, |
| 529 |
Short_Name => new String'("gnatyx"), |
| 530 |
Description => null, |
| 531 |
Documentation_Url => null), |
| 532 |
gnatyz => |
| 533 |
(Human_Id => new String'("Style_Check_Xtra_Parens_Precedence"), |
| 534 |
Status => Active, |
| 535 |
Short_Name => new String'("gnatyz"), |
| 536 |
Description => null, |
| 537 |
Documentation_Url => null), |
| 538 |
gnatel => |
| 539 |
(Human_Id => new String'("Display_Elaboration_Messages"), |
| 540 |
Status => Active, |
| 541 |
Short_Name => new String'("gnatel"), |
| 542 |
Description => null, |
| 543 |
Documentation_Url => null) |
| 544 |
); |
| 545 |
|
| 546 |
---------------- |
| 547 |
-- Get_Switch -- |
| 548 |
---------------- |
| 549 |
|
| 550 |
function Get_Switch (Id : Switch_Id) return Switch_Type is |
| 551 |
|
| 552 |
begin |
| 553 |
return Switches (Id); |
| 554 |
end Get_Switch; |
| 555 |
|
| 556 |
function Get_Switch (Diag : Diagnostic_Type) return Switch_Type is |
| 557 |
|
| 558 |
begin |
| 559 |
return Get_Switch (Diag.Switch); |
| 560 |
end Get_Switch; |
| 561 |
|
| 562 |
------------------- |
| 563 |
-- Get_Switch_Id -- |
| 564 |
------------------- |
| 565 |
|
| 566 |
function Get_Switch_Id (Name : String) return Switch_Id is |
| 567 |
Trimmed_Name : constant String := |
| 568 |
(if Name (Name'Last) = ' ' then Name (Name'First .. Name'Last - 1) |
| 569 |
else Name); |
| 570 |
begin |
| 571 |
for I in Active_Switch_Id loop |
| 572 |
if Switches (I).Short_Name.all = Trimmed_Name then |
| 573 |
return I; |
| 574 |
end if; |
| 575 |
end loop; |
| 576 |
|
| 577 |
return No_Switch_Id; |
| 578 |
end Get_Switch_Id; |
| 579 |
|
| 580 |
------------------- |
| 581 |
-- Get_Switch_Id -- |
| 582 |
------------------- |
| 583 |
|
| 584 |
function Get_Switch_Id (E : Error_Msg_Object) return Switch_Id is |
| 585 |
Switch_Name : constant String := |
| 586 |
(if E.Warn_Chr = "$ " then "gnatel" |
| 587 |
elsif E.Warn_Chr in "? " | " " then "" |
| 588 |
elsif E.Kind in Erroutc.Warning | Erroutc.Info |
| 589 |
then "gnatw" & E.Warn_Chr |
| 590 |
elsif E.Kind in Erroutc.Style then "gnatw" & E.Warn_Chr |
| 591 |
else ""); |
| 592 |
begin |
| 593 |
if Switch_Name /= "" then |
| 594 |
return Get_Switch_Id (Switch_Name); |
| 595 |
else |
| 596 |
return No_Switch_Id; |
| 597 |
end if; |
| 598 |
end Get_Switch_Id; |
| 599 |
|
| 600 |
----------------------------- |
| 601 |
-- Print_Switch_Repository -- |
| 602 |
----------------------------- |
| 603 |
|
| 604 |
procedure Print_Switch_Repository is |
| 605 |
First : Boolean := True; |
| 606 |
begin |
| 607 |
Write_Char ('{'); |
| 608 |
Begin_Block; |
| 609 |
NL_And_Indent; |
| 610 |
|
| 611 |
Write_Str ("""" & "Switches" & """" & ": " & "["); |
| 612 |
Begin_Block; |
| 613 |
|
| 614 |
-- Avoid printing the first switch, which is a placeholder |
| 615 |
|
| 616 |
for I in Active_Switch_Id loop |
| 617 |
|
| 618 |
if First then |
| 619 |
First := False; |
| 620 |
else |
| 621 |
Write_Char (','); |
| 622 |
end if; |
| 623 |
|
| 624 |
NL_And_Indent; |
| 625 |
|
| 626 |
Write_Char ('{'); |
| 627 |
Begin_Block; |
| 628 |
NL_And_Indent; |
| 629 |
|
| 630 |
if Switches (I).Human_Id /= null then |
| 631 |
Write_String_Attribute ("Human_Id", Switches (I).Human_Id.all); |
| 632 |
else |
| 633 |
Write_String_Attribute ("Human_Id", "null"); |
| 634 |
end if; |
| 635 |
|
| 636 |
Write_Char (','); |
| 637 |
NL_And_Indent; |
| 638 |
|
| 639 |
if Switches (I).Short_Name /= null then |
| 640 |
Write_String_Attribute ("Short_Name", Switches (I).Short_Name.all); |
| 641 |
else |
| 642 |
Write_String_Attribute ("Short_Name", "null"); |
| 643 |
end if; |
| 644 |
|
| 645 |
Write_Char (','); |
| 646 |
NL_And_Indent; |
| 647 |
|
| 648 |
if Switches (I).Status = Active then |
| 649 |
Write_String_Attribute ("Status", "Active"); |
| 650 |
else |
| 651 |
Write_String_Attribute ("Status", "Deprecated"); |
| 652 |
end if; |
| 653 |
|
| 654 |
Write_Char (','); |
| 655 |
NL_And_Indent; |
| 656 |
|
| 657 |
if Switches (I).Description /= null then |
| 658 |
Write_String_Attribute ("Description", |
| 659 |
Switches (I).Description.all); |
| 660 |
else |
| 661 |
Write_String_Attribute ("Description", "null"); |
| 662 |
end if; |
| 663 |
|
| 664 |
Write_Char (','); |
| 665 |
NL_And_Indent; |
| 666 |
|
| 667 |
if Switches (I).Description /= null then |
| 668 |
Write_String_Attribute ("Documentation_Url", |
| 669 |
Switches (I).Description.all); |
| 670 |
else |
| 671 |
Write_String_Attribute ("Documentation_Url", "null"); |
| 672 |
end if; |
| 673 |
|
| 674 |
End_Block; |
| 675 |
NL_And_Indent; |
| 676 |
Write_Char ('}'); |
| 677 |
end loop; |
| 678 |
|
| 679 |
End_Block; |
| 680 |
NL_And_Indent; |
| 681 |
Write_Char (']'); |
| 682 |
|
| 683 |
End_Block; |
| 684 |
NL_And_Indent; |
| 685 |
Write_Char ('}'); |
| 686 |
|
| 687 |
Write_Eol; |
| 688 |
end Print_Switch_Repository; |
| 689 |
|
| 690 |
end Diagnostics.Switch_Repository; |