From 9d0f9011a93771fa3bd0fdd289a3985480f23fe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20Th=C3=A9venoux?= Date: Tue, 26 Nov 2024 17:04:36 +0100 Subject: [PATCH 1/4] minor: Fix KP file name --- lkql_checker/share/lkql/kp/{KP-19477.lkql => KP-19447.lkql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lkql_checker/share/lkql/kp/{KP-19477.lkql => KP-19447.lkql} (100%) diff --git a/lkql_checker/share/lkql/kp/KP-19477.lkql b/lkql_checker/share/lkql/kp/KP-19447.lkql similarity index 100% rename from lkql_checker/share/lkql/kp/KP-19477.lkql rename to lkql_checker/share/lkql/kp/KP-19447.lkql From 1d456eb7e1bd2b593db9ecfd711ef01b79795620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20Th=C3=A9venoux?= Date: Tue, 14 Jan 2025 15:57:07 +0100 Subject: [PATCH 2/4] Add script to fetch impact-db impacts data --- Makefile | 4 +++ utils/impact-db_impacts_gen.py | 48 ++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100755 utils/impact-db_impacts_gen.py diff --git a/Makefile b/Makefile index 6bf1341b4..a1066222c 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ PYTHON=python MAVEN=mvn BUILD_DIR=/undefined LKQL_DIR=$(BUILD_DIR)/lkql +IMPACTDB_DIR=/undefined GPRBUILD=gprbuild -j$(PROCS) -p -XBUILD_MODE=$(BUILD_MODE) GPRINSTALL=gprinstall --prefix=$(PREFIX) -p -XBUILD_MODE=$(BUILD_MODE) BUILD_FOR_JIT=false @@ -36,6 +37,9 @@ doc: build_lkql_native_jit cd user_manual && make clean html cd lkql_checker/doc && make generate html-all +impacts: + PYTHONPATH=$(IMPACTDB_DIR) ./utils/impact-db_impacts_gen.py $(IMPACTDB_DIR) + format: $(MAVEN) -f lkql_jit spotless:apply diff --git a/utils/impact-db_impacts_gen.py b/utils/impact-db_impacts_gen.py new file mode 100755 index 000000000..914b768fa --- /dev/null +++ b/utils/impact-db_impacts_gen.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python3 + +# This script should be run at the top level of the langkit-query-language with +# PYTHONPATH set to the impact-db repository path. The impact-db repository path +# should also be passed as first argument: +# +# $ PYTHONPATH=/path/to/impact-db ./impact-db_impacts_gen.py /path/to/impact-db + +import glob +import json +import sys +from pathlib import Path +from impactdb import db + +impactdb_dir = sys.argv[1] +res = {} + + +def format_impacts(impacts: [str]) -> str: + gnat = list(db.config["gnat"].keys()) + return ",".join(list(map(lambda i: i + ".*" if i in gnat else i, impacts))) + + +def format_name(name: str) -> str: + return "kp_" + name.lower().replace("-", "_") + + +def list_impacts(issues: [str]) -> None: + entries = [e for e in db.load(impactdb_dir + "/entries") if e.type == "kp"] + for e in entries: + if e.name in issues: + res.update({format_name(e.name): format_impacts(e.impacts)}) + elif e.origin in issues: + res.update({format_name(e.origin): format_impacts(e.impacts)}) + + +kps = [kp for kp in glob.glob("./lkql_checker/share/lkql/kp/KP-*")] +ids = [Path(id).stem[3:] for id in kps] +list_impacts(ids) + +impacts = {"impacts": res} +impacts.update({"gnat": list(db.config["gnat"].keys())}) + +with open("./lkql_checker/share/lkql/kp/kp.json", "w", encoding="utf-8") as f: + json.dump(impacts, f, ensure_ascii=False, indent=4) + +with open("./lkql_checker/share/lkql/kp/kp.json", "a", encoding="utf-8") as f: + f.write("\n") From 80d920ac74039fc176240b1c2449be21a84f9691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20Th=C3=A9venoux?= Date: Tue, 26 Nov 2024 17:07:02 +0100 Subject: [PATCH 3/4] Get KPs' impacts from impact-db fetched data Data is formatted as JSON in kp.json in the KP rules directory. --- lkql_checker/share/lkql/kp/kp.json | 110 +++++++++++++++++++++++++++++ lkql_checker/src/rule_commands.adb | 32 ++++----- lkql_checker/src/rule_commands.ads | 7 +- lkql_checker/src/rules_factory.adb | 52 +++++++++++--- 4 files changed, 173 insertions(+), 28 deletions(-) create mode 100644 lkql_checker/share/lkql/kp/kp.json diff --git a/lkql_checker/share/lkql/kp/kp.json b/lkql_checker/share/lkql/kp/kp.json new file mode 100644 index 000000000..9e0609e68 --- /dev/null +++ b/lkql_checker/share/lkql/kp/kp.json @@ -0,0 +1,110 @@ +{ + "impacts": { + "kp_19423": "22.*,23.*,24.*", + "kp_19341": "24.*", + "kp_19237": "23.*,24.1", + "kp_19447": "24.*", + "kp_19501": "7.1.*,7.2.*,7.3.*,7.4.*,17.*,18.*,19.*,20.*,21.*,22.*,23.*,24.*", + "kp_19142": "24.*", + "kp_19312": "24.*", + "kp_19529": "24.*", + "kp_19134": "23.*,24.*", + "kp_19279": "23.*,24.*", + "kp_19038": "24.1", + "kp_19159": "23.*,24.*", + "kp_19198": "19.1,19.2,19.3,19.4,19.5,19.6,19.7,19.8,20.*,21.*,22.*,23.*,24.1", + "kp_va03_035": "22.*", + "kp_u923_018": "21.*", + "kp_v329_046": "22.1", + "kp_18701": "23.*", + "kp_ua12_036": "21.*,22.*", + "kp_vb20_002": "22.*", + "kp_18637": "23.*", + "kp_u727_033": "7.4.*,17.*,18.*,19.*,20.*,21.*", + "kp_u812_034": "21.*", + "kp_w330_020": "20.*,21.*,22.*,23.1", + "kp_v907_005": "22.*", + "kp_v924_001": "22.*", + "kp_va06_034": "22.*", + "kp_ub15_001": "18.*,19.*,20.*,21.*", + "kp_18718": "23.*", + "kp_ub22_022": "19.*,20.*,21.*", + "kp_18614": "20.*,21.*,22.*,23.*", + "kp_v216_031": "21.*", + "kp_v120_015": "7.4.1,7.4.2,7.4.3,7.4.4,7.4.5,7.4.6,7.4.7,17.*", + "kp_v127_049": "21.*,22.1", + "kp_v302_021": "21.*,22.1", + "kp_u630_012": "21.*", + "kp_v719_024": "22.*", + "kp_18636": "22.*,23.*", + "kp_18801": "23.*", + "kp_u629_002": "21.*", + "kp_v505_020": "22.*", + "kp_v114_047": "18.*,19.*,20.*,21.*,22.1", + "kp_vb24_008": "23.1", + "kp_v616_018": "22.*", + "kp_uc22_009": "22.1", + "kp_u928_018": "22.*,23.1", + "kp_v206_001": "22.1", + "kp_va18_003": "21.*,22.*", + "kp_v214_016": "21.*,22.*,23.1", + "kp_v407_011": "20.*,21.*,22.1", + "kp_v624_025": "22.*", + "kp_v720_003": "22.*", + "kp_v708_029": "22.*", + "kp_u702_038": "21.*", + "kp_18926": "23.*,24.1", + "kp_v404_040": "19.1,19.2,19.3,19.4,19.5,19.6,20.1,20.2,21.1,21.2,21.3,21.4,22.1", + "kp_v712_039": "22.*", + "kp_u803_030": "21.*", + "kp_u701_015": "21.*,22.*", + "kp_q309_014": "7.1.*,7.2.*,7.3.*,7.4.*,17.*", + "kp_r517_023": "7.1.*,7.2.*,7.3.*,7.4.*,17.*,18.1,18.2", + "kp_qc02_001": "7.1.*,7.2.*,7.3.*,7.4.*,17.*,18.1,18.2", + "kp_r511_017": "7.1.*,7.2.*,7.3.*,7.4.*,17.*,18.*", + "kp_r410_028": "7.1.*,7.2.*,7.3.*", + "kp_r316_001": "18.*,19.1,19.2,19.3,19.4,20.1,20.2", + "kp_q609_033": "7.1.*,7.2.*,7.3.*,7.4.*", + "kp_p226_024": "7.1.*,7.2.*,7.3.*,7.4.1,7.4.2,7.4.3", + "kp_ob03_009": "19.*", + "kp_ta30_032": "20.1,20.2", + "kp_s724_042": "19.*,20.1", + "kp_s521_014": "19.*", + "kp_tb09_038": "20.1,20.2", + "kp_s114_015": "18.*,19.*", + "kp_s814_034": "17.*,18.*,19.*", + "kp_ta10_002": "21.*,22.*,23.1", + "kp_u310_012": "22.*", + "kp_s722_023": "7.1.*,7.2.*,7.3.*,7.4.*,17.*,18.1,18.2,19.1,19.2,19.3", + "kp_u225_018": "20.1,20.2,21.1,21.2,21.3", + "kp_t708_064": "20.1,20.2", + "kp_tc01_050": "19.1,19.2,19.3,19.4,20.1,20.2,21.1", + "kp_ta15_022": "18.1,18.2,18.3,19.1,19.2,19.3,19.4,19.5,19.6,20.1,20.2", + "kp_t602_028": "20.*", + "kp_u126_006": "20.1,20.2,21.1", + "kp_t528_043": "18.*,19.1,19.2,19.3,19.4,19.5,20.1,20.2", + "kp_s124_035": "7.1.*,7.2.*,7.3.*,7.4.*,17.*,18.*,19.*", + "kp_t420_033": "18.*,19.*,20.1", + "kp_tb23_035": "20.1,20.2", + "kp_t805_037": "20.1,20.2", + "kp_tb25_028": "20.*", + "kp_s621_051": "19.*", + "kp_u316_028": "20.1,20.2,21.1" + }, + "gnat": [ + "7.1", + "7.2", + "7.3", + "7.4", + "17", + "18", + "19", + "20", + "21", + "22", + "23", + "24", + "25", + "26" + ] +} diff --git a/lkql_checker/src/rule_commands.adb b/lkql_checker/src/rule_commands.adb index 12422fcdf..ee49ca7ff 100644 --- a/lkql_checker/src/rule_commands.adb +++ b/lkql_checker/src/rule_commands.adb @@ -93,6 +93,7 @@ package body Rule_Commands is function Create_Rule_Command (Lkql_File_Path : String; Ctx : L.Analysis_Context; + Impacts : JSON_Value; Rc : out Rule_Command) return Boolean is Root : constant L.Lkql_Node := @@ -132,8 +133,6 @@ package body Rule_Commands is Remediation_Arg : constant L.Arg := Check_Annotation.P_Arg_With_Name (To_Unbounded_Text ("remediation")); - Impact_Arg : constant L.Arg := - Check_Annotation.P_Arg_With_Name (To_Unbounded_Text ("impact")); Target_Arg : constant L.Arg := Check_Annotation.P_Arg_With_Name (To_Unbounded_Text ("target")); Msg : Unbounded_Text_Type; @@ -218,24 +217,25 @@ package body Rule_Commands is Get_Text (Category_Arg, To_Unbounded_Text ("Misc"), Category); Get_Text (Subcategory_Arg, To_Unbounded_Text (""), Subcategory); - if not Impact_Arg.Is_Null then - Check_String (Impact_Arg); - + if Impacts /= JSON_Null then declare - Str : constant String := - To_String (Impact_Arg.P_Expr.As_String_Literal.Text); + Impact_Value : constant JSON_Value := + Impacts.Get (To_UTF8 (To_Lower (Name))); begin - Impact := - new Regexp'(Compile ("{" & - Str (Str'First + 1 .. Str'Last - 1) & - "}", - Glob => True, Case_Sensitive => False)); - + if Impact_Value /= JSON_Null then + Impact := + new Regexp' + (Compile + ("{" & Impact_Value.Get & "}", + Glob => True, + Case_Sensitive => False)); + end if; exception when others => - raise Rule_Error with - "invalid argument for @" & - To_String (Check_Annotation.F_Name.Text); + raise Rule_Error + with + "invalid impact entry for " + & To_String (Check_Annotation.F_Name.Text); end; end if; diff --git a/lkql_checker/src/rule_commands.ads b/lkql_checker/src/rule_commands.ads index 9c23be9bb..104742473 100644 --- a/lkql_checker/src/rule_commands.ads +++ b/lkql_checker/src/rule_commands.ads @@ -7,10 +7,12 @@ with Ada.Containers.Vectors; with GNAT.Regexp; -with Langkit_Support.Diagnostics; use Langkit_Support.Diagnostics; +with GNATCOLL.JSON; use GNATCOLL.JSON; + +with Langkit_Support.Diagnostics; use Langkit_Support.Diagnostics; with Langkit_Support.Generic_API.Analysis; use Langkit_Support.Generic_API.Analysis; -with Langkit_Support.Text; use Langkit_Support.Text; +with Langkit_Support.Text; use Langkit_Support.Text; with Libadalang.Analysis; @@ -122,6 +124,7 @@ package Rule_Commands is function Create_Rule_Command (Lkql_File_Path : String; Ctx : L.Analysis_Context; + Impacts : JSON_Value; Rc : out Rule_Command) return Boolean; -- Create a Rule_Command value with the given name and arguments and -- store it in ``Rc``. Return ``True`` if this succeeded, ie. the file diff --git a/lkql_checker/src/rules_factory.adb b/lkql_checker/src/rules_factory.adb index 926a3d838..b7da5b2ca 100644 --- a/lkql_checker/src/rules_factory.adb +++ b/lkql_checker/src/rules_factory.adb @@ -6,7 +6,9 @@ with Ada.Environment_Variables; with GNAT.OS_Lib; +with GNAT.Strings; +with GNATCOLL.JSON; use GNATCOLL.JSON; with GNATCOLL.Opt_Parse; use GNATCOLL.Opt_Parse; with GNATCOLL.Strings; use GNATCOLL.Strings; with GNATCOLL.Utils; @@ -20,17 +22,23 @@ package body Rules_Factory is (Dirs : Path_Array) return Virtual_File_Array; -- Return the absolute path of the directory containing the LKQL programs + function Get_Impacts (Rules_Dirs : Virtual_File_Array) return JSON_Value; + -- Return all KPs' impacts. Impacts are stored in a JSON file named + -- 'kp.json'. This file should be located in one of the directories from + -- "Rules_Dirs". + --------------- -- All_Rules -- --------------- function All_Rules - (Ctx : L.Analysis_Context; - Dirs : Path_Array := No_Paths) return Rule_Vector + (Ctx : L.Analysis_Context; Dirs : Path_Array := No_Paths) + return Rule_Vector is Rules_Dirs : constant Virtual_File_Array := Get_Rules_Directories (Dirs); Rules : Rule_Vector := Rule_Vectors.Empty_Vector; Seen : String_Sets.Set := String_Sets.Empty_Set; + Impacts : constant JSON_Value := Get_Impacts (Rules_Dirs); begin -- We search (non recursively) for all .lkql files in the Rules_Dir. @@ -45,13 +53,14 @@ package body Rules_Factory is begin for File of Dir.all loop if File.File_Extension = +".lkql" - and then not Seen.Contains (+File.Full_Name) + and then not Seen.Contains (+File.Full_Name) then declare Rc : Rule_Command; - Has_Rule : constant Boolean := Create_Rule_Command - (+File.Full_Name, Ctx, Rc); + Has_Rule : constant Boolean := + Create_Rule_Command + (+File.Full_Name, Ctx, Impacts, Rc); begin if Has_Rule then Rules.Append (Rc); @@ -73,8 +82,7 @@ package body Rules_Factory is -- Get_Rules_Directories -- --------------------------- - function Get_Rules_Directories - (Dirs : Path_Array) return Virtual_File_Array + function Get_Rules_Directories (Dirs : Path_Array) return Virtual_File_Array is function Add_Rules_Path (Path : String) return Boolean; @@ -94,10 +102,11 @@ package body Rules_Factory is end if; declare - Custom_Checkers_Dirs : Virtual_File_Array - (1 .. Integer (Dirs'Length) + Integer (Lkql_Rules_Paths.Length)); + Custom_Checkers_Dirs : + Virtual_File_Array + (1 .. Integer (Dirs'Length) + Integer (Lkql_Rules_Paths.Length)); - Index : Positive := 1; + Index : Positive := 1; begin for Dir of Dirs loop Custom_Checkers_Dirs (Index) := Create (+To_String (Dir)); @@ -113,4 +122,27 @@ package body Rules_Factory is end; end Get_Rules_Directories; + ----------------- + -- Get_Impacts -- + ----------------- + + function Get_Impacts (Rules_Dirs : Virtual_File_Array) return JSON_Value is + begin + for Rules_Dir of Rules_Dirs loop + declare + JSON_Filename : constant Virtual_File := Rules_Dir / "kp.json"; + File_Content : GNAT.Strings.String_Access; + Result : JSON_Value; + begin + if Is_Regular_File (JSON_Filename) then + File_Content := Read_File (JSON_Filename); + Result := Read (File_Content.all).Get ("impacts"); + GNAT.Strings.Free (File_Content); + return Result; + end if; + end; + end loop; + return JSON_Null; + end Get_Impacts; + end Rules_Factory; From 62200c7c9b83e90187f7099100de27da7c2a9718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20Th=C3=A9venoux?= Date: Tue, 26 Nov 2024 17:47:09 +0100 Subject: [PATCH 4/4] Remove the impact rule attribute Impacts data are now directly fetched from impact-db --- lkql_checker/share/lkql/kp/KP-18614.lkql | 2 +- lkql_checker/share/lkql/kp/KP-18636.lkql | 2 +- lkql_checker/share/lkql/kp/KP-18637.lkql | 2 +- lkql_checker/share/lkql/kp/KP-18701.lkql | 2 +- lkql_checker/share/lkql/kp/KP-18718.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-18801.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-18926.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-19038.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-19134.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-19142.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-19159.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-19198.lkql | 2 +- lkql_checker/share/lkql/kp/KP-19237.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-19279.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-19312.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-19341.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-19423.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-19447.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-19501.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-19529.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-OB03-009.lkql | 2 +- lkql_checker/share/lkql/kp/KP-P226-024.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-Q309-014.lkql | 2 +- lkql_checker/share/lkql/kp/KP-Q609-033.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-QC02-001.lkql | 1 - lkql_checker/share/lkql/kp/KP-R316-001.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-R410-028.lkql | 2 +- lkql_checker/share/lkql/kp/KP-R511-017.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-R517-023.lkql | 1 - lkql_checker/share/lkql/kp/KP-S114-015.lkql | 2 +- lkql_checker/share/lkql/kp/KP-S124-035.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-S521-014.lkql | 2 +- lkql_checker/share/lkql/kp/KP-S621-051.lkql | 2 +- lkql_checker/share/lkql/kp/KP-S722-023.lkql | 1 - lkql_checker/share/lkql/kp/KP-S724-042.lkql | 2 +- lkql_checker/share/lkql/kp/KP-S814-034.lkql | 2 +- lkql_checker/share/lkql/kp/KP-T420-033.lkql | 2 +- lkql_checker/share/lkql/kp/KP-T528-043.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-T602-028.lkql | 2 +- lkql_checker/share/lkql/kp/KP-T708-064.lkql | 2 +- lkql_checker/share/lkql/kp/KP-T805-037.lkql | 2 +- lkql_checker/share/lkql/kp/KP-TA10-002.lkql | 2 +- lkql_checker/share/lkql/kp/KP-TA15-022.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-TA30-032.lkql | 2 +- lkql_checker/share/lkql/kp/KP-TB09-038.lkql | 2 +- lkql_checker/share/lkql/kp/KP-TB23-035.lkql | 2 +- lkql_checker/share/lkql/kp/KP-TB25-028.lkql | 2 +- lkql_checker/share/lkql/kp/KP-TC01-050.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-U126-006.lkql | 2 +- lkql_checker/share/lkql/kp/KP-U225-018.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-U310-012.lkql | 2 +- lkql_checker/share/lkql/kp/KP-U316-028.lkql | 2 +- lkql_checker/share/lkql/kp/KP-U629-002.lkql | 2 +- lkql_checker/share/lkql/kp/KP-U630-012.lkql | 2 +- lkql_checker/share/lkql/kp/KP-U701-015.lkql | 2 +- lkql_checker/share/lkql/kp/KP-U702-038.lkql | 2 +- lkql_checker/share/lkql/kp/KP-U727-033.lkql | 1 - lkql_checker/share/lkql/kp/KP-U803-030.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-U812-034.lkql | 2 +- lkql_checker/share/lkql/kp/KP-U923-018.lkql | 2 +- lkql_checker/share/lkql/kp/KP-U928-018.lkql | 2 +- lkql_checker/share/lkql/kp/KP-UA12-036.lkql | 2 +- lkql_checker/share/lkql/kp/KP-UB15-001.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-UB22-022.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-UC22-009.lkql | 2 +- lkql_checker/share/lkql/kp/KP-V114-047.lkql | 2 +- lkql_checker/share/lkql/kp/KP-V120-015.lkql | 2 +- lkql_checker/share/lkql/kp/KP-V127-049.lkql | 2 +- lkql_checker/share/lkql/kp/KP-V206-001.lkql | 2 +- lkql_checker/share/lkql/kp/KP-V214-016.lkql | 2 +- lkql_checker/share/lkql/kp/KP-V216-031.lkql | 2 +- lkql_checker/share/lkql/kp/KP-V302-021.lkql | 2 +- lkql_checker/share/lkql/kp/KP-V329-046.lkql | 2 +- lkql_checker/share/lkql/kp/KP-V404-040.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-V407-011.lkql | 2 +- lkql_checker/share/lkql/kp/KP-V505-020.lkql | 2 +- lkql_checker/share/lkql/kp/KP-V616-018.lkql | 2 +- lkql_checker/share/lkql/kp/KP-V624-025.lkql | 2 +- lkql_checker/share/lkql/kp/KP-V708-029.lkql | 2 +- lkql_checker/share/lkql/kp/KP-V712-039.lkql | 2 +- lkql_checker/share/lkql/kp/KP-V719-024.lkql | 2 +- lkql_checker/share/lkql/kp/KP-V720-003.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-V907-005.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-V924-001.lkql | 2 +- lkql_checker/share/lkql/kp/KP-VA03-035.lkql | 2 +- lkql_checker/share/lkql/kp/KP-VA06-034.lkql | 2 +- lkql_checker/share/lkql/kp/KP-VA18-003.lkql | 3 +-- lkql_checker/share/lkql/kp/KP-VB20-002.lkql | 2 +- lkql_checker/share/lkql/kp/KP-VB24-008.lkql | 2 +- lkql_checker/share/lkql/kp/KP-W330-020.lkql | 2 +- .../com/adacore/lkql_jit/checker/BaseChecker.java | 5 ----- .../com/adacore/lkql_jit/checker/NodeChecker.java | 3 --- .../com/adacore/lkql_jit/checker/UnitChecker.java | 3 --- .../lkql_jit/nodes/declarations/CheckerExport.java | 12 +++++------- .../java/com/adacore/lkql_jit/utils/Constants.java | 3 +-- 95 files changed, 92 insertions(+), 141 deletions(-) diff --git a/lkql_checker/share/lkql/kp/KP-18614.lkql b/lkql_checker/share/lkql/kp/KP-18614.lkql index 174fa9669..72a2529b9 100644 --- a/lkql_checker/share/lkql/kp/KP-18614.lkql +++ b/lkql_checker/share/lkql/kp/KP-18614.lkql @@ -4,7 +4,7 @@ fun multiple_of(v, multiple) = v / multiple * multiple == v @check(help="possible occurrence of KP 18614", message="possible occurrence of KP 18614 if compiled with optimization", - impact="2[0-3].*", target="powerpc*,leon*,sparc*") + target="powerpc*,leon*,sparc*") fun kp_18614(node) = node is Aggregate(p_expression_type(): t@BaseTypeDecl(p_is_array_type(): true) diff --git a/lkql_checker/share/lkql/kp/KP-18636.lkql b/lkql_checker/share/lkql/kp/KP-18636.lkql index 7464fa8ff..c8ce3fe36 100644 --- a/lkql_checker/share/lkql/kp/KP-18636.lkql +++ b/lkql_checker/share/lkql/kp/KP-18636.lkql @@ -1,6 +1,6 @@ # Flag 'Image applied to objects of a class-wide interface type -@check(message="possible occurrence of KP 18636", impact="22.*,23.*") +@check(message="possible occurrence of KP 18636") fun kp_18636(node) = node is AttributeRef when node.f_attribute.p_name_is("Image") diff --git a/lkql_checker/share/lkql/kp/KP-18637.lkql b/lkql_checker/share/lkql/kp/KP-18637.lkql index 7596b9f3c..3185afa4d 100644 --- a/lkql_checker/share/lkql/kp/KP-18637.lkql +++ b/lkql_checker/share/lkql/kp/KP-18637.lkql @@ -3,7 +3,7 @@ import stdlib -@check(message="possible occurrence of KP 18637", impact="23.*") +@check(message="possible occurrence of KP 18637") fun kp_18637(node) = node is CallExpr( f_name: Name( diff --git a/lkql_checker/share/lkql/kp/KP-18701.lkql b/lkql_checker/share/lkql/kp/KP-18701.lkql index e493b19a6..0c6c18c60 100644 --- a/lkql_checker/share/lkql/kp/KP-18701.lkql +++ b/lkql_checker/share/lkql/kp/KP-18701.lkql @@ -3,7 +3,7 @@ import stdlib -@check(message="possible occurrence of KP 18701", impact="23.*") +@check(message="possible occurrence of KP 18701") fun kp_18701(node) = node is Aggregate when node.p_expression_type() is BaseTypeDecl( diff --git a/lkql_checker/share/lkql/kp/KP-18718.lkql b/lkql_checker/share/lkql/kp/KP-18718.lkql index 904dab349..983a5b5a0 100644 --- a/lkql_checker/share/lkql/kp/KP-18718.lkql +++ b/lkql_checker/share/lkql/kp/KP-18718.lkql @@ -4,8 +4,7 @@ # variant part @check(help="possible occurrence of KP 18718", - message="possible occurrence of KP 18718 if compiled with optimization", - impact="23.*") + message="possible occurrence of KP 18718 if compiled with optimization") fun kp_18718(node) = node is ObjectDecl( # An ObjectDecl with a default expression being a function call diff --git a/lkql_checker/share/lkql/kp/KP-18801.lkql b/lkql_checker/share/lkql/kp/KP-18801.lkql index f963cd071..127837d31 100644 --- a/lkql_checker/share/lkql/kp/KP-18801.lkql +++ b/lkql_checker/share/lkql/kp/KP-18801.lkql @@ -45,8 +45,7 @@ fun check_params(n) = { } @check(help="possible occurrence of KP 18801", - message="possible occurrence of KP 18801", - impact="23.*") + message="possible occurrence of KP 18801") fun kp_18801(node) = node is (BinOp(f_op: OpEq) | CallExpr(p_kind(): "call") when node.f_name.p_name_is("\"=\"")) diff --git a/lkql_checker/share/lkql/kp/KP-18926.lkql b/lkql_checker/share/lkql/kp/KP-18926.lkql index 0d483a6a1..1e006879b 100644 --- a/lkql_checker/share/lkql/kp/KP-18926.lkql +++ b/lkql_checker/share/lkql/kp/KP-18926.lkql @@ -20,8 +20,7 @@ fun is_flagged_aspect(aspect) = | * => false @check(help="possible occurrence of KP 18926", - message="possible occurrence of KP 18926", - impact="23.*,24.1") + message="possible occurrence of KP 18926") fun kp_18926(node) = node is BracketAggregate when is_flagged_aspect(node.p_expression_type().p_get_aspect("Aggregate")) diff --git a/lkql_checker/share/lkql/kp/KP-19038.lkql b/lkql_checker/share/lkql/kp/KP-19038.lkql index cfabf6865..2971da7df 100644 --- a/lkql_checker/share/lkql/kp/KP-19038.lkql +++ b/lkql_checker/share/lkql/kp/KP-19038.lkql @@ -1,6 +1,5 @@ @check(help="possible occurrence of KP 19038", - message="possible occurrence of KP 19038", - impact="24.1") + message="possible occurrence of KP 19038") fun kp_19038(node) = |" Detect all occurrences of aspect "Exclusive_Functions". node is AspectAssoc( diff --git a/lkql_checker/share/lkql/kp/KP-19134.lkql b/lkql_checker/share/lkql/kp/KP-19134.lkql index a9e91671a..950135085 100644 --- a/lkql_checker/share/lkql/kp/KP-19134.lkql +++ b/lkql_checker/share/lkql/kp/KP-19134.lkql @@ -26,8 +26,7 @@ fun is_unck_conv_to_array_of_int(call) = } @check(help="possible occurrence of KP 19134", - message="possible occurrence of KP 19134", - impact="23.*,24.*") + message="possible occurrence of KP 19134") fun kp_19134(node) = node is CallExpr(p_is_call(): true) when stdlib.any([is_unck_conv_to_array_of_int(p.actual) diff --git a/lkql_checker/share/lkql/kp/KP-19142.lkql b/lkql_checker/share/lkql/kp/KP-19142.lkql index 5fcd7ecda..4c4b93ef1 100644 --- a/lkql_checker/share/lkql/kp/KP-19142.lkql +++ b/lkql_checker/share/lkql/kp/KP-19142.lkql @@ -33,8 +33,7 @@ fun is_unconstrained_discriminated(type_decl) = | * => false @check(help="possible occurrence of KP 19142", - message="possible occurrence of KP 19142", - impact="24.*") + message="possible occurrence of KP 19142") fun kp_19142(node) = node is SubpBody # Check that the subprogram is overriding diff --git a/lkql_checker/share/lkql/kp/KP-19159.lkql b/lkql_checker/share/lkql/kp/KP-19159.lkql index dd7481826..907ccadd0 100644 --- a/lkql_checker/share/lkql/kp/KP-19159.lkql +++ b/lkql_checker/share/lkql/kp/KP-19159.lkql @@ -1,8 +1,7 @@ import stdlib @check(help="possible occurrence of KP 19159", - message="possible occurrence of KP 19159", - impact="23.*,24.*") + message="possible occurrence of KP 19159") fun kp_19159(node) = |" Look for a value conversion between array types directly |" passed as an actual parameter in a call to a subprogram. diff --git a/lkql_checker/share/lkql/kp/KP-19198.lkql b/lkql_checker/share/lkql/kp/KP-19198.lkql index 9d6c6957e..b9ea3c141 100644 --- a/lkql_checker/share/lkql/kp/KP-19198.lkql +++ b/lkql_checker/share/lkql/kp/KP-19198.lkql @@ -1,4 +1,4 @@ -@check(help="possible occurrence of KP 19198", message="possible occurrence of KP 19198", impact="24.*") +@check(help="possible occurrence of KP 19198", message="possible occurrence of KP 19198") fun kp_19198(node) = |" Flag object declaration which specify the "address" aspect and have a |" aggregate default value. diff --git a/lkql_checker/share/lkql/kp/KP-19237.lkql b/lkql_checker/share/lkql/kp/KP-19237.lkql index cf9753885..1b2d03d77 100644 --- a/lkql_checker/share/lkql/kp/KP-19237.lkql +++ b/lkql_checker/share/lkql/kp/KP-19237.lkql @@ -1,6 +1,5 @@ @check(help="possible occurrence of KP 19237", - message="possible occurrence of KP 19237", - impact="23.*,24.*") + message="possible occurrence of KP 19237") fun kp_19237(node) = |" Search for indirect calls to functions returning limited tagged objects. node is CallExpr( diff --git a/lkql_checker/share/lkql/kp/KP-19279.lkql b/lkql_checker/share/lkql/kp/KP-19279.lkql index 2952c1d30..b7694fe36 100644 --- a/lkql_checker/share/lkql/kp/KP-19279.lkql +++ b/lkql_checker/share/lkql/kp/KP-19279.lkql @@ -42,8 +42,7 @@ fun contains_dynamic_bounds(agg) = ) @check(help="possible occurrence of KP 19279", - message="possible occurrence of KP 19279", - impact="23.*,24.*") + message="possible occurrence of KP 19279") fun kp_19279(node) = |" Flag object intialization / assignment where the assigned expression is a |" multi-dimention array aggregate with one of the sub-aggregate having diff --git a/lkql_checker/share/lkql/kp/KP-19312.lkql b/lkql_checker/share/lkql/kp/KP-19312.lkql index c9fbeee72..715e746b6 100644 --- a/lkql_checker/share/lkql/kp/KP-19312.lkql +++ b/lkql_checker/share/lkql/kp/KP-19312.lkql @@ -1,6 +1,5 @@ @check(help="possible occurrence of KP 19312", - message="possible occurrence of KP 19312", - impact="24.*") + message="possible occurrence of KP 19312") fun kp_19312(node) = |" Flag "for" loop specs which define an iteration filter and which iterate |" over a type which defines the "iterable" aspect. diff --git a/lkql_checker/share/lkql/kp/KP-19341.lkql b/lkql_checker/share/lkql/kp/KP-19341.lkql index bfb79f6a6..2eab953e6 100644 --- a/lkql_checker/share/lkql/kp/KP-19341.lkql +++ b/lkql_checker/share/lkql/kp/KP-19341.lkql @@ -1,8 +1,7 @@ import stdlib @check(help="possible occurrence of KP 19341", - message="possible occurrence of KP 19341", - impact="24.*") + message="possible occurrence of KP 19341") fun kp_19341(node) = |" Flag all array type declarations that define the 'pack' or |" the 'component_size' aspect, and which have aliased composite diff --git a/lkql_checker/share/lkql/kp/KP-19423.lkql b/lkql_checker/share/lkql/kp/KP-19423.lkql index ca5f9890a..fa4daf089 100644 --- a/lkql_checker/share/lkql/kp/KP-19423.lkql +++ b/lkql_checker/share/lkql/kp/KP-19423.lkql @@ -1,6 +1,5 @@ @check(help="possible occurrence of KP 19423", - message="possible occurrence of KP 19423", - impact="22.*,23.*,24.*") + message="possible occurrence of KP 19423") fun kp_19423(node) = |" Flag all "for ... in" loops which iterate over expressions of the |" form "F'Range", where F is a function call. diff --git a/lkql_checker/share/lkql/kp/KP-19447.lkql b/lkql_checker/share/lkql/kp/KP-19447.lkql index f90004181..819d54e43 100644 --- a/lkql_checker/share/lkql/kp/KP-19447.lkql +++ b/lkql_checker/share/lkql/kp/KP-19447.lkql @@ -1,6 +1,5 @@ @check(help="possible occurrence of KP 19447", - message="possible occurrence of KP 19447", - impact="24.*") + message="possible occurrence of KP 19447") fun kp_19447(node) = |" To be safe, this KP detector flags all references to the Finalization_Size |" attribute. diff --git a/lkql_checker/share/lkql/kp/KP-19501.lkql b/lkql_checker/share/lkql/kp/KP-19501.lkql index 94bee90d5..93a4ed12e 100644 --- a/lkql_checker/share/lkql/kp/KP-19501.lkql +++ b/lkql_checker/share/lkql/kp/KP-19501.lkql @@ -33,8 +33,7 @@ fun array_index_has_kp(expr, array_decl, child_n) = | * => array_index_has_kp(expr, array_decl, child_n + 1) @check(help="possible occurrence of KP 19501", - message="possible occurrence of KP 19501", - impact="7.1.*,7.2.*,7.3.*,7.4.*,17.*,18.*,19.*,20.*,21.*,22.*,23.*,24.*") + message="possible occurrence of KP 19501") fun kp_19501(node) = |" Flag constructions involving an integer valued attribute reference known |" at compile time, when the attribute reference is: diff --git a/lkql_checker/share/lkql/kp/KP-19529.lkql b/lkql_checker/share/lkql/kp/KP-19529.lkql index 67570c48c..83259d312 100644 --- a/lkql_checker/share/lkql/kp/KP-19529.lkql +++ b/lkql_checker/share/lkql/kp/KP-19529.lkql @@ -21,8 +21,7 @@ fun is_composite_object(name) = } @check(help="possible occurrence of KP 19529", - message="possible occurrence of KP 19529", - impact="24.*") + message="possible occurrence of KP 19529") fun kp_19529(node) = |" Flag assign statement between two composite objects that are declared |" in a subprogram and assigned in a nested sub-program. diff --git a/lkql_checker/share/lkql/kp/KP-OB03-009.lkql b/lkql_checker/share/lkql/kp/KP-OB03-009.lkql index db60bba36..65f607ffc 100644 --- a/lkql_checker/share/lkql/kp/KP-OB03-009.lkql +++ b/lkql_checker/share/lkql/kp/KP-OB03-009.lkql @@ -1,7 +1,7 @@ # Flag record types with aspect Implicit_Dereference that have an # access-to-class-wide discriminant. -@check(message="possible occurrence of KP OB03-009", impact="19.*") +@check(message="possible occurrence of KP OB03-009") fun kp_ob03_009(node) = # Look for record types with discriminants and Implicit_Dereference aspect node is TypeDecl(f_discriminants: part@KnownDiscriminantPart, diff --git a/lkql_checker/share/lkql/kp/KP-P226-024.lkql b/lkql_checker/share/lkql/kp/KP-P226-024.lkql index 75c5ea3e9..8d29fcaf4 100644 --- a/lkql_checker/share/lkql/kp/KP-P226-024.lkql +++ b/lkql_checker/share/lkql/kp/KP-P226-024.lkql @@ -11,8 +11,7 @@ fun has_no_local_po_restriction(unit) = when n.p_name_is("No_Local_Protected_Objects")) @check(help="possible occurrence of KP P226-024 - global analysis required", - message="possible occurrence of KP P226-024", - impact="7.[123].*,7.4.[1-3].*") + message="possible occurrence of KP P226-024") fun kp_p226_024(node) = node is ObjectDecl when has_no_local_po_restriction(node.p_enclosing_compilation_unit()) diff --git a/lkql_checker/share/lkql/kp/KP-Q309-014.lkql b/lkql_checker/share/lkql/kp/KP-Q309-014.lkql index cbd5d47d2..1dfea9949 100644 --- a/lkql_checker/share/lkql/kp/KP-Q309-014.lkql +++ b/lkql_checker/share/lkql/kp/KP-Q309-014.lkql @@ -15,6 +15,6 @@ fun is_untagged_packed_discr(n) = .p_referenced_decl()) | * => false -@check(message="possible occurrence of KP Q309-014", impact="7.[1-4].*,17.*") +@check(message="possible occurrence of KP Q309-014") fun kp_q309_014(node) = node is DerivedTypeDef when is_untagged_packed_discr(node) diff --git a/lkql_checker/share/lkql/kp/KP-Q609-033.lkql b/lkql_checker/share/lkql/kp/KP-Q609-033.lkql index c772d3390..2def383c1 100644 --- a/lkql_checker/share/lkql/kp/KP-Q609-033.lkql +++ b/lkql_checker/share/lkql/kp/KP-Q609-033.lkql @@ -12,8 +12,7 @@ fun has_no_local_timing_events_restriction(unit) = when n.p_name_is("No_Local_Timing_Events")) @check(help="possible occurrence of KP Q609-033 - global analysis required", - message="possible occurrence of KP Q609-033", - impact="7.[123].*,7.4.[1-3].*") + message="possible occurrence of KP Q609-033") fun kp_q609_033(node) = node is ObjectDecl when has_no_local_timing_events_restriction(node.p_enclosing_compilation_unit()) diff --git a/lkql_checker/share/lkql/kp/KP-QC02-001.lkql b/lkql_checker/share/lkql/kp/KP-QC02-001.lkql index 0eea7a6c1..1270ccfca 100644 --- a/lkql_checker/share/lkql/kp/KP-QC02-001.lkql +++ b/lkql_checker/share/lkql/kp/KP-QC02-001.lkql @@ -11,7 +11,6 @@ fun array_with_align(type) = } @check(message="possible occurrence of KP QC02-001", - impact="7.[1-4].*,17.*,18.[12]", follow_generic_instantiations=true) fun kp_qc02_001(node) = node is AttributeRef(parent: not AttributeDefClause) diff --git a/lkql_checker/share/lkql/kp/KP-R316-001.lkql b/lkql_checker/share/lkql/kp/KP-R316-001.lkql index 334693eb2..fd5c47726 100644 --- a/lkql_checker/share/lkql/kp/KP-R316-001.lkql +++ b/lkql_checker/share/lkql/kp/KP-R316-001.lkql @@ -7,8 +7,7 @@ fun get_type_def(t) = | SubtypeDecl => get_type_def(t.f_subtype.f_name.p_referenced_decl()) | * => null -@check(message="possible occurrence of KP R316-001", - impact="18.*,19.[1-4],20.[12]") +@check(message="possible occurrence of KP R316-001") fun kp_r316_001(node) = node is (ClassicSubpDecl | BaseSubpBody(p_previous_part(): null) | diff --git a/lkql_checker/share/lkql/kp/KP-R410-028.lkql b/lkql_checker/share/lkql/kp/KP-R410-028.lkql index 761e093d1..e04fb8a29 100644 --- a/lkql_checker/share/lkql/kp/KP-R410-028.lkql +++ b/lkql_checker/share/lkql/kp/KP-R410-028.lkql @@ -17,7 +17,7 @@ fun check_subp(subp) = when check_type(stdlib.full_root_type(spec.f_subp_returns .p_designated_type_decl())) -@check(message="possible occurrence of KP R410-028", impact="7.[123].*") +@check(message="possible occurrence of KP R410-028") fun kp_r410_028(node) = node is BaseId( p_is_call(): true, diff --git a/lkql_checker/share/lkql/kp/KP-R511-017.lkql b/lkql_checker/share/lkql/kp/KP-R511-017.lkql index e75b06361..63328c18c 100644 --- a/lkql_checker/share/lkql/kp/KP-R511-017.lkql +++ b/lkql_checker/share/lkql/kp/KP-R511-017.lkql @@ -2,8 +2,7 @@ import stdlib -@check(message="possible occurrence of KP R511-017", - impact="7.[1-4].*,17.*,18.*") +@check(message="possible occurrence of KP R511-017") fun kp_r511_017(node) = node is SubtypeDecl( p_has_aspect("Object_Size"): true, diff --git a/lkql_checker/share/lkql/kp/KP-R517-023.lkql b/lkql_checker/share/lkql/kp/KP-R517-023.lkql index 35e0089bf..58a72d69f 100644 --- a/lkql_checker/share/lkql/kp/KP-R517-023.lkql +++ b/lkql_checker/share/lkql/kp/KP-R517-023.lkql @@ -23,7 +23,6 @@ fun get_type(type) = | * => type @check(message="possible occurrence of KP R517-023", - impact="7.[1-4].*,17.*,18.[12]", follow_generic_instantiations = true) fun kp_r517_023(node) = node is CallExpr(p_is_call(): true) diff --git a/lkql_checker/share/lkql/kp/KP-S114-015.lkql b/lkql_checker/share/lkql/kp/KP-S114-015.lkql index eba7171c8..bd205918f 100644 --- a/lkql_checker/share/lkql/kp/KP-S114-015.lkql +++ b/lkql_checker/share/lkql/kp/KP-S114-015.lkql @@ -7,7 +7,7 @@ fun primitives(decl) = | SubtypeDecl => decl.p_get_type().p_get_primitives() | * => null -@check(message="possible occurrence of KP S124-035", impact="18.*,19.*") +@check(message="possible occurrence of KP S124-035") fun kp_s114_015(node) = # Look for variant record types node is TypeDecl(f_discriminants: not null, diff --git a/lkql_checker/share/lkql/kp/KP-S124-035.lkql b/lkql_checker/share/lkql/kp/KP-S124-035.lkql index 657201306..3f7f718be 100644 --- a/lkql_checker/share/lkql/kp/KP-S124-035.lkql +++ b/lkql_checker/share/lkql/kp/KP-S124-035.lkql @@ -3,8 +3,7 @@ import stdlib -@check(message="possible occurrence of KP S124-035", - impact="7.[1-4].*,1[7-9].*") +@check(message="possible occurrence of KP S124-035") fun kp_s124_035(node) = node is CallExpr(p_is_call(): true) when node.f_name.p_referenced_decl() is i@GenericSubpInstantiation diff --git a/lkql_checker/share/lkql/kp/KP-S521-014.lkql b/lkql_checker/share/lkql/kp/KP-S521-014.lkql index 7dbd38627..c717ed018 100644 --- a/lkql_checker/share/lkql/kp/KP-S521-014.lkql +++ b/lkql_checker/share/lkql/kp/KP-S521-014.lkql @@ -2,7 +2,7 @@ import stdlib -@check(message="possible occurrence of KP S521-014", impact="19.*") +@check(message="possible occurrence of KP S521-014") fun kp_s521_014(node) = node is TypeDecl(p_is_tagged_type(): true, f_discriminants: not null, diff --git a/lkql_checker/share/lkql/kp/KP-S621-051.lkql b/lkql_checker/share/lkql/kp/KP-S621-051.lkql index 40c69f006..bb7face76 100644 --- a/lkql_checker/share/lkql/kp/KP-S621-051.lkql +++ b/lkql_checker/share/lkql/kp/KP-S621-051.lkql @@ -3,7 +3,7 @@ import stdlib -@check(message="possible occurrence of KP S621-051", impact="19.*") +@check(message="possible occurrence of KP S621-051") fun kp_s621_051(node) = node is ParamAssoc( parent: AssocList(parent: c@CallExpr( diff --git a/lkql_checker/share/lkql/kp/KP-S722-023.lkql b/lkql_checker/share/lkql/kp/KP-S722-023.lkql index 9dd929580..79ad4fc48 100644 --- a/lkql_checker/share/lkql/kp/KP-S722-023.lkql +++ b/lkql_checker/share/lkql/kp/KP-S722-023.lkql @@ -16,7 +16,6 @@ fun is_array_slice(expr) = | o => false @check(message="possible occurrence of KP S722-023", - impact="7.[1-4].*,17.*,18.[12],19.[123]", follow_generic_instantiations=true) fun kp_s722_023(node) = node is AttributeRef diff --git a/lkql_checker/share/lkql/kp/KP-S724-042.lkql b/lkql_checker/share/lkql/kp/KP-S724-042.lkql index 6b57427fc..946e3c8c2 100644 --- a/lkql_checker/share/lkql/kp/KP-S724-042.lkql +++ b/lkql_checker/share/lkql/kp/KP-S724-042.lkql @@ -1,7 +1,7 @@ # Flag extended return statements with a default expression of a type with # a Default_Initial_Condition aspect. -@check(message="possible occurrence of KP S724-042", impact="19.*,20.1") +@check(message="possible occurrence of KP S724-042") fun kp_s724_042(node) = node is ExtendedReturnStmt when node.f_decl.f_default_expr is Expr diff --git a/lkql_checker/share/lkql/kp/KP-S814-034.lkql b/lkql_checker/share/lkql/kp/KP-S814-034.lkql index 83be39900..0313556dc 100644 --- a/lkql_checker/share/lkql/kp/KP-S814-034.lkql +++ b/lkql_checker/share/lkql/kp/KP-S814-034.lkql @@ -1,6 +1,6 @@ import stdlib -@check(message="possible occurrence of KP S814-034", impact="17.*,18.*,19.*") +@check(message="possible occurrence of KP S814-034") fun kp_s814_034(node) = |" Flag array aggregates with an others choice if the array component type is a |" record type that has a string subcomponent. diff --git a/lkql_checker/share/lkql/kp/KP-T420-033.lkql b/lkql_checker/share/lkql/kp/KP-T420-033.lkql index 3398b710b..6004c2a53 100644 --- a/lkql_checker/share/lkql/kp/KP-T420-033.lkql +++ b/lkql_checker/share/lkql/kp/KP-T420-033.lkql @@ -2,7 +2,7 @@ import stdlib -@check(message="possible occurrence of KP T420-033", impact="18.*,19.*,20.1") +@check(message="possible occurrence of KP T420-033") fun kp_t420_033(node) = node is ComponentDecl when node.p_semantic_parent() is BaseTypeDecl(p_is_tagged_type(): true) diff --git a/lkql_checker/share/lkql/kp/KP-T528-043.lkql b/lkql_checker/share/lkql/kp/KP-T528-043.lkql index c18c09fee..bceccaaf2 100644 --- a/lkql_checker/share/lkql/kp/KP-T528-043.lkql +++ b/lkql_checker/share/lkql/kp/KP-T528-043.lkql @@ -3,8 +3,7 @@ import stdlib -@check(message="possible occurrence of KP T528-043", - impact="18.*,19.[1-5],20.[12]") +@check(message="possible occurrence of KP T528-043") fun kp_t528_043(node) = node is (ObjectDecl when node.p_has_aspect("Address") and diff --git a/lkql_checker/share/lkql/kp/KP-T602-028.lkql b/lkql_checker/share/lkql/kp/KP-T602-028.lkql index ba4c00ef5..8290b082b 100644 --- a/lkql_checker/share/lkql/kp/KP-T602-028.lkql +++ b/lkql_checker/share/lkql/kp/KP-T602-028.lkql @@ -8,7 +8,7 @@ fun is_access(attr) = attr.p_name_is("Unchecked_Access") or attr.p_name_is("Unrestricted_Access") -@check(message="possible occurrence of KP T602-028", impact="20.*") +@check(message="possible occurrence of KP T602-028") fun kp_t602_028(node) = # Look for '*Access node is AttributeRef diff --git a/lkql_checker/share/lkql/kp/KP-T708-064.lkql b/lkql_checker/share/lkql/kp/KP-T708-064.lkql index 5b027a340..f6c691233 100644 --- a/lkql_checker/share/lkql/kp/KP-T708-064.lkql +++ b/lkql_checker/share/lkql/kp/KP-T708-064.lkql @@ -25,7 +25,7 @@ fun has_variant_with_varsize(t) = p_is_discriminant_constraint(): true)) when has_varsize_comp(s.f_name.p_referenced_decl())] -@check(message="possible occurrence of KP T708-064", impact="20.[12]") +@check(message="possible occurrence of KP T708-064") fun kp_t708_064(node) = node is TypeDecl when node.f_type_def is RecordTypeDef diff --git a/lkql_checker/share/lkql/kp/KP-T805-037.lkql b/lkql_checker/share/lkql/kp/KP-T805-037.lkql index a64d962ee..05191dacd 100644 --- a/lkql_checker/share/lkql/kp/KP-T805-037.lkql +++ b/lkql_checker/share/lkql/kp/KP-T805-037.lkql @@ -2,7 +2,7 @@ # default initialization of a component whose type is of a record type with # discriminants. -@check(message="possible occurrence of KP T805-037", impact="20.[12]") +@check(message="possible occurrence of KP T805-037") fun kp_t805_037(node) = node is TypeDecl( f_discriminants: part@KnownDiscriminantPart, diff --git a/lkql_checker/share/lkql/kp/KP-TA10-002.lkql b/lkql_checker/share/lkql/kp/KP-TA10-002.lkql index 99d619d7f..84c9643c6 100644 --- a/lkql_checker/share/lkql/kp/KP-TA10-002.lkql +++ b/lkql_checker/share/lkql/kp/KP-TA10-002.lkql @@ -4,7 +4,7 @@ import stdlib -@check(message="possible occurrence of KP TA10-002", impact="21.*,22.*,23.1") +@check(message="possible occurrence of KP TA10-002") fun kp_ta10_002(node) = node is CondExpr(any parent: ReturnStmt | ExprFunction) when (from node select first c@BaseId(p_is_call(): true) diff --git a/lkql_checker/share/lkql/kp/KP-TA15-022.lkql b/lkql_checker/share/lkql/kp/KP-TA15-022.lkql index 6098c8d53..dd962e4ae 100644 --- a/lkql_checker/share/lkql/kp/KP-TA15-022.lkql +++ b/lkql_checker/share/lkql/kp/KP-TA15-022.lkql @@ -1,8 +1,7 @@ # Flag raise statements with a qualified name or a pragma assert with a # statically False condition guarded by a local exception handler. -@check(message="possible occurrence of KP TA15-022", - impact="18.[1-3],19.[1-6],20.[12]") +@check(message="possible occurrence of KP TA15-022") fun kp_ta15_022(node) = node is (RaiseStmt(f_exception_name: DottedName) | PragmaNode when node.f_id.p_name_is("Assert") and diff --git a/lkql_checker/share/lkql/kp/KP-TA30-032.lkql b/lkql_checker/share/lkql/kp/KP-TA30-032.lkql index 4e0c713f8..432eaa777 100644 --- a/lkql_checker/share/lkql/kp/KP-TA30-032.lkql +++ b/lkql_checker/share/lkql/kp/KP-TA30-032.lkql @@ -10,7 +10,7 @@ fun range_length(t) = ) | * => -1 -@check(message="possible occurrence of KP TA30-032", impact="20.[12]", +@check(message="possible occurrence of KP TA30-032", follow_generic_instantiations = true) fun kp_ta30_032(node) = node is ObjectDecl diff --git a/lkql_checker/share/lkql/kp/KP-TB09-038.lkql b/lkql_checker/share/lkql/kp/KP-TB09-038.lkql index a44761c4a..b372e27e1 100644 --- a/lkql_checker/share/lkql/kp/KP-TB09-038.lkql +++ b/lkql_checker/share/lkql/kp/KP-TB09-038.lkql @@ -6,7 +6,7 @@ fun pow2(n, result = 1) = if n == 0 then result else pow2(n - 1, result * 2) fun is_positive(n) = n.p_is_static_expr() and n.p_eval_as_int() >= 0 -@check(message="possible occurrence of KP TB09-038", impact="20.[12]") +@check(message="possible occurrence of KP TB09-038") fun kp_tb09_038(node) = # Look for an integer type declaration node is TypeDecl(p_is_int_type(): true, diff --git a/lkql_checker/share/lkql/kp/KP-TB23-035.lkql b/lkql_checker/share/lkql/kp/KP-TB23-035.lkql index 1c4d48da3..48cda520d 100644 --- a/lkql_checker/share/lkql/kp/KP-TB23-035.lkql +++ b/lkql_checker/share/lkql/kp/KP-TB23-035.lkql @@ -4,7 +4,7 @@ import stdlib -@check(message="possible occurrence of KP TB23-035", impact="20.[12]") +@check(message="possible occurrence of KP TB23-035") fun kp_tb23_035(node) = node is AssignStmt(f_dest: DottedName(p_referenced_decl(): c@ComponentDecl)) diff --git a/lkql_checker/share/lkql/kp/KP-TB25-028.lkql b/lkql_checker/share/lkql/kp/KP-TB25-028.lkql index f93370cd8..989824f95 100644 --- a/lkql_checker/share/lkql/kp/KP-TB25-028.lkql +++ b/lkql_checker/share/lkql/kp/KP-TB25-028.lkql @@ -2,7 +2,7 @@ @check(help="possible occurrence of KP TB25-028", message="possible occurrence of KP TB25-028 on powerpc targets", - impact="20.*", target="powerpc*") + target="powerpc*") fun kp_tB25_028(node) = node is AttributeRef when node.f_attribute.p_name_is("Valid_Scalars") diff --git a/lkql_checker/share/lkql/kp/KP-TC01-050.lkql b/lkql_checker/share/lkql/kp/KP-TC01-050.lkql index 92b27f7a3..c6cde0b71 100644 --- a/lkql_checker/share/lkql/kp/KP-TC01-050.lkql +++ b/lkql_checker/share/lkql/kp/KP-TC01-050.lkql @@ -3,8 +3,7 @@ import stdlib -@check(message="possible occurrence of KP TC01-050", - impact="19.[1-4],20.[12],21.1") +@check(message="possible occurrence of KP TC01-050") fun kp_tc01_050(node) = node is MembershipExpr( f_membership_exprs: l@ExprAlternativesList diff --git a/lkql_checker/share/lkql/kp/KP-U126-006.lkql b/lkql_checker/share/lkql/kp/KP-U126-006.lkql index cd83ce940..7883fe5d8 100644 --- a/lkql_checker/share/lkql/kp/KP-U126-006.lkql +++ b/lkql_checker/share/lkql/kp/KP-U126-006.lkql @@ -18,7 +18,7 @@ fun get_components(type) = fun check_components(ids, comps) = [id for id in ids if not [n for n in comps if id.p_name_matches(n)]] -@check(message="possible occurrence of KP U126-006", impact="20.[12],21.1") +@check(message="possible occurrence of KP U126-006") fun kp_u126_006(node) = # Look for record types with a representation clause node is TypeDecl diff --git a/lkql_checker/share/lkql/kp/KP-U225-018.lkql b/lkql_checker/share/lkql/kp/KP-U225-018.lkql index 820e7d7f7..14e02e679 100644 --- a/lkql_checker/share/lkql/kp/KP-U225-018.lkql +++ b/lkql_checker/share/lkql/kp/KP-U225-018.lkql @@ -4,8 +4,7 @@ import stdlib @check(help="possible occurrence of KP U225-018", - message="possible occurrence of KP U225-018 if -gnatVfm is enabled", - impact="20.[12],21.[1-3]") + message="possible occurrence of KP U225-018 if -gnatVfm is enabled") fun kp_u225_018(node) = node is CallExpr(parent: ParamAssoc(parent: l@AssocList( parent: CallExpr(p_is_call(): true)))) diff --git a/lkql_checker/share/lkql/kp/KP-U310-012.lkql b/lkql_checker/share/lkql/kp/KP-U310-012.lkql index 351aecc83..27261ae69 100644 --- a/lkql_checker/share/lkql/kp/KP-U310-012.lkql +++ b/lkql_checker/share/lkql/kp/KP-U310-012.lkql @@ -6,7 +6,7 @@ fun is_unconstrained(t) = ArrayTypeDef(f_indices: UnconstrainedArrayIndices) or t is ConcreteTypeDecl(f_discriminants: KnownDiscriminantPart) -@check(message="possible occurrence of KP U310-012", impact="22.*") +@check(message="possible occurrence of KP U310-012") fun kp_u310_012(node) = node is SubpSpec(f_subp_kind: SubpKindFunction) when node.p_return_type() is TypeDecl(p_full_view(): ret@TypeDecl) diff --git a/lkql_checker/share/lkql/kp/KP-U316-028.lkql b/lkql_checker/share/lkql/kp/KP-U316-028.lkql index ace4ba98c..76fa7e564 100644 --- a/lkql_checker/share/lkql/kp/KP-U316-028.lkql +++ b/lkql_checker/share/lkql/kp/KP-U316-028.lkql @@ -6,7 +6,7 @@ fun is_array_attr(attr) = attr.p_name_is("Length") or attr.p_name_is("Range") -@check(message="possible occurrence of KP U316-028", impact="20.[12],21.1") +@check(message="possible occurrence of KP U316-028") fun kp_u316_028(node) = node is AttributeRef when is_array_attr(node.f_attribute) diff --git a/lkql_checker/share/lkql/kp/KP-U629-002.lkql b/lkql_checker/share/lkql/kp/KP-U629-002.lkql index e897787c6..cd855d55d 100644 --- a/lkql_checker/share/lkql/kp/KP-U629-002.lkql +++ b/lkql_checker/share/lkql/kp/KP-U629-002.lkql @@ -5,7 +5,7 @@ import stdlib -@check(message="possible occurrence of KP U629-002", impact="21.*") +@check(message="possible occurrence of KP U629-002") fun kp_u629_002(node) = # Look for type(xxx.all) as part of a return or expression function body node is ExplicitDeref(parent: ParamAssoc(parent: AssocList( diff --git a/lkql_checker/share/lkql/kp/KP-U630-012.lkql b/lkql_checker/share/lkql/kp/KP-U630-012.lkql index 749e91c99..b3d91ff60 100644 --- a/lkql_checker/share/lkql/kp/KP-U630-012.lkql +++ b/lkql_checker/share/lkql/kp/KP-U630-012.lkql @@ -5,7 +5,7 @@ fun has_negative(params, last) = last > 0 and (params[last].actual.p_eval_as_int() < 0 or has_negative(params, last - 1)) -@check(message="possible occurrence of KP U630-012", impact="21.*") +@check(message="possible occurrence of KP U630-012") fun kp_u630_012(node) = node is AttributeRef when node.f_attribute.p_name_is("Enum_Rep") diff --git a/lkql_checker/share/lkql/kp/KP-U701-015.lkql b/lkql_checker/share/lkql/kp/KP-U701-015.lkql index 9d21f9015..49852e4c9 100644 --- a/lkql_checker/share/lkql/kp/KP-U701-015.lkql +++ b/lkql_checker/share/lkql/kp/KP-U701-015.lkql @@ -1,5 +1,5 @@ # Flag Predicate_Failure aspects -@check(message="possible occurrence of KP U701-015", impact="21.*,22.*") +@check(message="possible occurrence of KP U701-015") fun kp_u701_015(node) = node is AspectAssoc when node.f_id.p_name_is("Predicate_Failure") diff --git a/lkql_checker/share/lkql/kp/KP-U702-038.lkql b/lkql_checker/share/lkql/kp/KP-U702-038.lkql index d5ef8c47b..ea2dbdc9c 100644 --- a/lkql_checker/share/lkql/kp/KP-U702-038.lkql +++ b/lkql_checker/share/lkql/kp/KP-U702-038.lkql @@ -1,7 +1,7 @@ # Flag any object declaration of an anonymous access-to-class-wide types # initialized via an allocator. -@check(message="possible occurrence of KP U702-038", impact="21.*") +@check(message="possible occurrence of KP U702-038") fun kp_u702_038(node) = node is ObjectDecl( f_default_expr: Allocator, diff --git a/lkql_checker/share/lkql/kp/KP-U727-033.lkql b/lkql_checker/share/lkql/kp/KP-U727-033.lkql index 7a2b5648b..14f6ff303 100644 --- a/lkql_checker/share/lkql/kp/KP-U727-033.lkql +++ b/lkql_checker/share/lkql/kp/KP-U727-033.lkql @@ -2,7 +2,6 @@ @check(help="possible occurrence of KP U727-033", message="possible occurrence of KP U727-033 if float operation performed before first context switch on leon targets", - impact="7.4.*,1[7-9].*,2[01].*", target="leon*") fun kp_u727_033(node) = node is LibraryItem(f_item: b@BaseSubpBody) diff --git a/lkql_checker/share/lkql/kp/KP-U803-030.lkql b/lkql_checker/share/lkql/kp/KP-U803-030.lkql index 0e1273f71..56de7665e 100644 --- a/lkql_checker/share/lkql/kp/KP-U803-030.lkql +++ b/lkql_checker/share/lkql/kp/KP-U803-030.lkql @@ -12,8 +12,7 @@ fun outermost_package_decl(n) = } @check(help="possible occurrence of KP U803-030", - message="possible occurrence of KP U803-030 if -gnatE is used", - impact="21.*") + message="possible occurrence of KP U803-030 if -gnatE is used") fun kp_u803_030(node) = node is CallExpr( p_is_call(): true, diff --git a/lkql_checker/share/lkql/kp/KP-U812-034.lkql b/lkql_checker/share/lkql/kp/KP-U812-034.lkql index f4388a4f0..c83556c29 100644 --- a/lkql_checker/share/lkql/kp/KP-U812-034.lkql +++ b/lkql_checker/share/lkql/kp/KP-U812-034.lkql @@ -3,7 +3,7 @@ import stdlib -@check(message="possible occurrence of KP U812-034", impact="21.*") +@check(message="possible occurrence of KP U812-034") fun kp_u812_034(node) = node is AttributeRef when node.f_attribute.p_name_is("Access") diff --git a/lkql_checker/share/lkql/kp/KP-U923-018.lkql b/lkql_checker/share/lkql/kp/KP-U923-018.lkql index 8229df4a4..9bd4b4fab 100644 --- a/lkql_checker/share/lkql/kp/KP-U923-018.lkql +++ b/lkql_checker/share/lkql/kp/KP-U923-018.lkql @@ -4,7 +4,7 @@ import stdlib @check(help="possible occurrence of KP U923-018", message="possible occurrence of KP U923-018 on powerpc64 targets", - impact="21.*", target="powerpc64*") + target="powerpc64*") fun kp_u923_018(node) = node is (ClassicSubpDecl | BaseSubpBody(p_previous_part(): null) | diff --git a/lkql_checker/share/lkql/kp/KP-U928-018.lkql b/lkql_checker/share/lkql/kp/KP-U928-018.lkql index e631b32e9..fc003a8fa 100644 --- a/lkql_checker/share/lkql/kp/KP-U928-018.lkql +++ b/lkql_checker/share/lkql/kp/KP-U928-018.lkql @@ -1,7 +1,7 @@ # Flag for..of loops when the iteration expression is an indexing on a type # with a Constant_Indexing aspect. -@check(message="possible occurrence of KP U928-018", impact="22.*,23.1") +@check(message="possible occurrence of KP U928-018") fun kp_u928_018(node) = node is ForLoopStmt( f_spec: spec@ForLoopSpec(f_loop_type: IterTypeOf) diff --git a/lkql_checker/share/lkql/kp/KP-UA12-036.lkql b/lkql_checker/share/lkql/kp/KP-UA12-036.lkql index 37d312c3a..2aa29d2a4 100644 --- a/lkql_checker/share/lkql/kp/KP-UA12-036.lkql +++ b/lkql_checker/share/lkql/kp/KP-UA12-036.lkql @@ -35,7 +35,7 @@ fun message(n, alignment) = { stdlib.sloc_image(res), loc: n} } -@unit_check(help="possible occurrence of KP UA12-036", impact="21.*,22.*") +@unit_check(help="possible occurrence of KP UA12-036") fun kp_ua12_036(unit, alignment: int = 16) = [ message(n, alignment) for n in from unit.root select node@GenericSubpInstantiation diff --git a/lkql_checker/share/lkql/kp/KP-UB15-001.lkql b/lkql_checker/share/lkql/kp/KP-UB15-001.lkql index 0ed7040d7..6b596d0cd 100644 --- a/lkql_checker/share/lkql/kp/KP-UB15-001.lkql +++ b/lkql_checker/share/lkql/kp/KP-UB15-001.lkql @@ -1,7 +1,6 @@ # Flag all aspect associations for Small @check(help="possible occurrence of KP UB15-001", - message="possible occurrence of KP UB15-001: use of Small aspect", - impact="18.*,19.*,20.*,21.*") + message="possible occurrence of KP UB15-001: use of Small aspect") fun kp_ub15_001(node) = node is AspectAssoc(f_id: Identifier(p_name_is("Small"): true)) diff --git a/lkql_checker/share/lkql/kp/KP-UB22-022.lkql b/lkql_checker/share/lkql/kp/KP-UB22-022.lkql index bc8dd0ec4..c21bbb908 100644 --- a/lkql_checker/share/lkql/kp/KP-UB22-022.lkql +++ b/lkql_checker/share/lkql/kp/KP-UB22-022.lkql @@ -1,8 +1,7 @@ # Flag "for ... of Obj.Comp1.Comp2" loops where Comp2 is an array-valued # component and Comp1 is a discriminated component. -@check(message="possible occurrence of KP UB22-022", - impact="19.*,20.*,21.*") +@check(message="possible occurrence of KP UB22-022") fun kp_ub22_022(node) = node is ForLoopStmt(f_spec: ForLoopSpec( f_loop_type: IterTypeOf, diff --git a/lkql_checker/share/lkql/kp/KP-UC22-009.lkql b/lkql_checker/share/lkql/kp/KP-UC22-009.lkql index 62b789782..613bf03be 100644 --- a/lkql_checker/share/lkql/kp/KP-UC22-009.lkql +++ b/lkql_checker/share/lkql/kp/KP-UC22-009.lkql @@ -11,7 +11,7 @@ fun check_clause(params) = then params[2].f_r_expr.p_eval_as_int() != 1 else params[2].f_r_expr.p_eval_as_int() != 0) -@check(message="possible occurrence of KP UC22-009", impact="22.1") +@check(message="possible occurrence of KP UC22-009") fun kp_uc22_009(node) = node is EnumRepClause when node.f_type_name.p_referenced_decl() is t@TypeDecl diff --git a/lkql_checker/share/lkql/kp/KP-V114-047.lkql b/lkql_checker/share/lkql/kp/KP-V114-047.lkql index 517e9e144..6f3f35f50 100644 --- a/lkql_checker/share/lkql/kp/KP-V114-047.lkql +++ b/lkql_checker/share/lkql/kp/KP-V114-047.lkql @@ -2,7 +2,7 @@ @check(help="possible occurrence of KP V114-047", message="possible occurrence of KP V114-047 if runtime is ravenscar*zynq*", - target="arm-elf", impact="18.*,19.*,20.*,21.*,22.1") + target="arm-elf") fun kp_v114_047(node) = node is (ProtectedTypeDecl | SingleProtectedDecl when node.p_has_aspect("Interrupt_Priority")) diff --git a/lkql_checker/share/lkql/kp/KP-V120-015.lkql b/lkql_checker/share/lkql/kp/KP-V120-015.lkql index 3626f5454..8d5622290 100644 --- a/lkql_checker/share/lkql/kp/KP-V120-015.lkql +++ b/lkql_checker/share/lkql/kp/KP-V120-015.lkql @@ -21,7 +21,7 @@ fun check_type(t) = @check(help="possible occurrence of KP V120-015", message="possible occurrence of KP V120-015 on powerpc targets", - impact="7.4.[1-7],17.*", target="powerpc*") + target="powerpc*") fun kp_v120_015(node) = node is ComponentDecl when node.f_component_def.f_type_expr.p_designated_type_decl() is t@TypeDecl diff --git a/lkql_checker/share/lkql/kp/KP-V127-049.lkql b/lkql_checker/share/lkql/kp/KP-V127-049.lkql index 2c18d064b..4d019514b 100644 --- a/lkql_checker/share/lkql/kp/KP-V127-049.lkql +++ b/lkql_checker/share/lkql/kp/KP-V127-049.lkql @@ -14,7 +14,7 @@ fun has_two_integer_params(params) = fun is_operator(params, expr) = stdlib.get_parameter(params, expr).p_is_operator_name() -@check(message="possible occurrence of KP V127-049", impact="21.*,22.1") +@check(message="possible occurrence of KP V127-049") fun kp_v127_049(node) = # Look for parameter associations of generic instantiations node is ParamAssoc(parent: AssocList(parent: inst@GenericInstantiation), diff --git a/lkql_checker/share/lkql/kp/KP-V206-001.lkql b/lkql_checker/share/lkql/kp/KP-V206-001.lkql index b19967379..60c75bd38 100644 --- a/lkql_checker/share/lkql/kp/KP-V206-001.lkql +++ b/lkql_checker/share/lkql/kp/KP-V206-001.lkql @@ -3,7 +3,7 @@ import stdlib -@check(message="possible occurrence of KP V206-001", impact="22.1") +@check(message="possible occurrence of KP V206-001") fun kp_v206_001(node) = node is GenericPackageInstantiation when node.f_generic_pkg_name.p_referenced_decl() diff --git a/lkql_checker/share/lkql/kp/KP-V214-016.lkql b/lkql_checker/share/lkql/kp/KP-V214-016.lkql index 8244d2c9f..444c853b8 100644 --- a/lkql_checker/share/lkql/kp/KP-V214-016.lkql +++ b/lkql_checker/share/lkql/kp/KP-V214-016.lkql @@ -15,7 +15,7 @@ fun check_type(params) = ) ] -@check(message="possible occurrence of KP V214-016", impact="21.*,22.*,23.1") +@check(message="possible occurrence of KP V214-016") fun kp_v214_016(node) = node is GenericSubpInstantiation when stdlib.ultimate_designated_generic_subp(node) diff --git a/lkql_checker/share/lkql/kp/KP-V216-031.lkql b/lkql_checker/share/lkql/kp/KP-V216-031.lkql index 275b134cb..e8e447d3a 100644 --- a/lkql_checker/share/lkql/kp/KP-V216-031.lkql +++ b/lkql_checker/share/lkql/kp/KP-V216-031.lkql @@ -7,7 +7,7 @@ fun has_detect_blocking(unit) = unit.p_config_pragmas("Detect_Blocking").length > 0 @check(help="possible occurrence of KP V216-031 - global analysis required", - message="possible occurrence of KP V216-031", impact="21.*") + message="possible occurrence of KP V216-031") fun kp_v216_031(node) = node is ForLoopSpec(f_loop_type: IterTypeOf) when has_detect_blocking(node.p_enclosing_compilation_unit()) diff --git a/lkql_checker/share/lkql/kp/KP-V302-021.lkql b/lkql_checker/share/lkql/kp/KP-V302-021.lkql index e92fa549e..abd034a72 100644 --- a/lkql_checker/share/lkql/kp/KP-V302-021.lkql +++ b/lkql_checker/share/lkql/kp/KP-V302-021.lkql @@ -3,7 +3,7 @@ import stdlib -@check(message="possible occurrence of KP V302-021", impact="21.*,22.1") +@check(message="possible occurrence of KP V302-021") fun kp_v302_021(node) = node is BaseSubpSpec(p_return_type(): ret@TypeDecl, p_primitive_subp_tagged_type(): type@BaseTypeDecl, diff --git a/lkql_checker/share/lkql/kp/KP-V329-046.lkql b/lkql_checker/share/lkql/kp/KP-V329-046.lkql index aea436da8..59ea631e5 100644 --- a/lkql_checker/share/lkql/kp/KP-V329-046.lkql +++ b/lkql_checker/share/lkql/kp/KP-V329-046.lkql @@ -1,7 +1,7 @@ # Flag objects that have an aspect or pragma setting the convention to C, # where the objects are of an anonymous access-to-subprogram type. -@check(message="possible occurrence of KP V329-046", impact="22.1") +@check(message="possible occurrence of KP V329-046") fun kp_v329_046(node) = node is ObjectDecl(f_type_expr: AnonymousType( f_type_decl: AnonymousTypeDecl(f_type_def: acc@AccessToSubpDef))) diff --git a/lkql_checker/share/lkql/kp/KP-V404-040.lkql b/lkql_checker/share/lkql/kp/KP-V404-040.lkql index bc40a66a6..fb629c93f 100644 --- a/lkql_checker/share/lkql/kp/KP-V404-040.lkql +++ b/lkql_checker/share/lkql/kp/KP-V404-040.lkql @@ -3,8 +3,7 @@ import stdlib -@check(message="possible occurrence of KP V404-040", - impact="19.[1-6],20.[12],21.[1-4],22.1") +@check(message="possible occurrence of KP V404-040") fun kp_v404_040(node) = node is AttributeRef when node.f_attribute.p_name_is("Valid") diff --git a/lkql_checker/share/lkql/kp/KP-V407-011.lkql b/lkql_checker/share/lkql/kp/KP-V407-011.lkql index e00e64f9a..7b2df564e 100644 --- a/lkql_checker/share/lkql/kp/KP-V407-011.lkql +++ b/lkql_checker/share/lkql/kp/KP-V407-011.lkql @@ -15,7 +15,7 @@ fun check_prefix(param, n) = param.p_expression_type() is AnonymousTypeDecl(p_is_access_type(): true) and n.p_expression_type() is t@TypeDecl when stdlib.has_interfaces(t) -@check(message="possible occurrence of KP V407-011", impact="20.*,21.*,22.1") +@check(message="possible occurrence of KP V407-011") fun kp_v407_011(node) = # Look for 'Access as a parameter of a CallExpr node is AttributeRef(parent: ParamAssoc(parent: l@AssocList(parent: CallExpr))) diff --git a/lkql_checker/share/lkql/kp/KP-V505-020.lkql b/lkql_checker/share/lkql/kp/KP-V505-020.lkql index fce1ec31e..cbb7b5b1c 100644 --- a/lkql_checker/share/lkql/kp/KP-V505-020.lkql +++ b/lkql_checker/share/lkql/kp/KP-V505-020.lkql @@ -1,6 +1,6 @@ # Flag expression functions that are primitive operations of a tagged type. -@check(message="possible occurrence of KP V505-020", impact="22.*") +@check(message="possible occurrence of KP V505-020") fun kp_v505_020(node) = node is ExprFunction(p_decl_part(): null) when node.f_subp_spec.p_primitive_subp_tagged_type() is BaseTypeDecl diff --git a/lkql_checker/share/lkql/kp/KP-V616-018.lkql b/lkql_checker/share/lkql/kp/KP-V616-018.lkql index 0f5e0a8e3..be7ffa07d 100644 --- a/lkql_checker/share/lkql/kp/KP-V616-018.lkql +++ b/lkql_checker/share/lkql/kp/KP-V616-018.lkql @@ -7,7 +7,7 @@ fun access_to_unconstrained_array(t) = p_accessed_type(): TypeDecl( f_type_def: ArrayTypeDef(f_indices: UnconstrainedArrayIndices))) -@check(message="possible occurrence of KP V616-018", impact="22.*") +@check(message="possible occurrence of KP V616-018") fun kp_v616_018(node) = node is ComponentDecl( p_semantic_parent(): TypeDecl(f_type_def: DerivedTypeDef), diff --git a/lkql_checker/share/lkql/kp/KP-V624-025.lkql b/lkql_checker/share/lkql/kp/KP-V624-025.lkql index 5b62da487..be75ac43d 100644 --- a/lkql_checker/share/lkql/kp/KP-V624-025.lkql +++ b/lkql_checker/share/lkql/kp/KP-V624-025.lkql @@ -4,7 +4,7 @@ import stdlib -@check(message="possible occurrence of KP V624-025", impact="22.*") +@check(message="possible occurrence of KP V624-025") fun kp_v624_025(node) = node is AttributeRef when node.f_attribute.p_name_is("Valid_Scalars") diff --git a/lkql_checker/share/lkql/kp/KP-V708-029.lkql b/lkql_checker/share/lkql/kp/KP-V708-029.lkql index ed00afac5..3ea33d7ba 100644 --- a/lkql_checker/share/lkql/kp/KP-V708-029.lkql +++ b/lkql_checker/share/lkql/kp/KP-V708-029.lkql @@ -1,6 +1,6 @@ # Flag xxx'Image when the type of xxx is non discrete. -@check(help="possible occurrence of KP V708-029", impact="22.*", +@check(help="possible occurrence of KP V708-029", message="possible occurrence of KP V708-029 if type has array of character component") fun kp_v708_029(node) = node is AttributeRef diff --git a/lkql_checker/share/lkql/kp/KP-V712-039.lkql b/lkql_checker/share/lkql/kp/KP-V712-039.lkql index 899645793..d1d8a8bdf 100644 --- a/lkql_checker/share/lkql/kp/KP-V712-039.lkql +++ b/lkql_checker/share/lkql/kp/KP-V712-039.lkql @@ -3,7 +3,7 @@ import stdlib -@check(message="possible occurrence of KP V712-039", impact="22.*") +@check(message="possible occurrence of KP V712-039") fun kp_v712_039(node) = node is ForLoopStmt( f_spec: ForLoopSpec(f_iter_expr: Expr( diff --git a/lkql_checker/share/lkql/kp/KP-V719-024.lkql b/lkql_checker/share/lkql/kp/KP-V719-024.lkql index 0cc52ac5e..0c43317ac 100644 --- a/lkql_checker/share/lkql/kp/KP-V719-024.lkql +++ b/lkql_checker/share/lkql/kp/KP-V719-024.lkql @@ -1,7 +1,7 @@ # Flag discriminated record types with a variant part whose discrete choice # list contains an "others" choice, and a Dynamic_Predicate predicate. -@check(message="possible occurrence of KP V719-024", impact="22.*") +@check(message="possible occurrence of KP V719-024") fun kp_v719_024(node) = # Look for record types with discriminants and a Dynamic_Predicate aspect node is TypeDecl(f_discriminants: not null, diff --git a/lkql_checker/share/lkql/kp/KP-V720-003.lkql b/lkql_checker/share/lkql/kp/KP-V720-003.lkql index 66dbb2497..8f3cd8c4c 100644 --- a/lkql_checker/share/lkql/kp/KP-V720-003.lkql +++ b/lkql_checker/share/lkql/kp/KP-V720-003.lkql @@ -6,8 +6,7 @@ fun has_initialize_scalars(unit) = unit.p_config_pragmas("Initialize_Scalars").length > 0 @check(help="possible occurrence of KP V720-003 - global analysis required", - message="possible occurrence of KP V720-003 if -gnatVo and -gnateA are used", - impact="22.*") + message="possible occurrence of KP V720-003 if -gnatVo and -gnateA are used") fun kp_v720_003(node) = node is AssocList(parent: call@CallExpr(p_is_call(): true)) when has_initialize_scalars(node.p_enclosing_compilation_unit()) and diff --git a/lkql_checker/share/lkql/kp/KP-V907-005.lkql b/lkql_checker/share/lkql/kp/KP-V907-005.lkql index bd610dbd8..d0b996882 100644 --- a/lkql_checker/share/lkql/kp/KP-V907-005.lkql +++ b/lkql_checker/share/lkql/kp/KP-V907-005.lkql @@ -2,8 +2,7 @@ # indexing when the index is not static, nor a for loop variable. @check(help="possible occurrence of KP V907-005", - message="possible occurrence of KP V907-005 with -O3, consider using -fno-loop-unroll-and-jam or -O2", - impact="22.*") + message="possible occurrence of KP V907-005 with -O3, consider using -fno-loop-unroll-and-jam or -O2") fun kp_v907_005(node) = node is BaseLoopStmt( any parent: BaseLoopStmt, diff --git a/lkql_checker/share/lkql/kp/KP-V924-001.lkql b/lkql_checker/share/lkql/kp/KP-V924-001.lkql index f8ab5a524..03f831615 100644 --- a/lkql_checker/share/lkql/kp/KP-V924-001.lkql +++ b/lkql_checker/share/lkql/kp/KP-V924-001.lkql @@ -1,6 +1,6 @@ # Flag protected units with aspect Lock_Free -@check(help="possible occurrence of KP V924-001", impact="22.*", +@check(help="possible occurrence of KP V924-001", message="possible occurrence of KP V924-001 if -gnatVo is used") fun kp_v924_001(node) = node is (ProtectedTypeDecl | SingleProtectedDecl) diff --git a/lkql_checker/share/lkql/kp/KP-VA03-035.lkql b/lkql_checker/share/lkql/kp/KP-VA03-035.lkql index 408666c45..41df0ba5c 100644 --- a/lkql_checker/share/lkql/kp/KP-VA03-035.lkql +++ b/lkql_checker/share/lkql/kp/KP-VA03-035.lkql @@ -1,7 +1,7 @@ # Flag protected subprogram bodies whose protected type has aspect Lock_Free # when a variable is referenced via an expanded name in this body. -@check(message="possible occurrence of KP VA03-035", impact="22.*") +@check(message="possible occurrence of KP VA03-035") fun kp_va03_035(node) = node is SubpBody when node.p_decl_part() is BasicDecl(p_semantic_parent(): diff --git a/lkql_checker/share/lkql/kp/KP-VA06-034.lkql b/lkql_checker/share/lkql/kp/KP-VA06-034.lkql index a0e6c9048..71ab5fd22 100644 --- a/lkql_checker/share/lkql/kp/KP-VA06-034.lkql +++ b/lkql_checker/share/lkql/kp/KP-VA06-034.lkql @@ -1,7 +1,7 @@ # Flag Type'Image (Expr) when Type has a Put_Image aspect and Expr # is known at compile time. -@check(message="possible occurrence of KP VA06-034", impact="22.*") +@check(message="possible occurrence of KP VA06-034") fun kp_va06_034(node) = node is AttributeRef(parent: c@CallExpr) when node.f_attribute.p_name_is("Image") diff --git a/lkql_checker/share/lkql/kp/KP-VA18-003.lkql b/lkql_checker/share/lkql/kp/KP-VA18-003.lkql index 459d0bf62..34527b05c 100644 --- a/lkql_checker/share/lkql/kp/KP-VA18-003.lkql +++ b/lkql_checker/share/lkql/kp/KP-VA18-003.lkql @@ -2,8 +2,7 @@ # Is_Descendant_At_Same_Level when any parameter of type Tag is not xxx'Tag. @check(help="possible occurrence of KP VA18-003", - message="possible occurrence of KP VA18-003 if No_Tag is passed", - impact="21.*,22.*") + message="possible occurrence of KP VA18-003 if No_Tag is passed") fun kp_va18_003(node) = node is CallExpr(f_suffix: l@AssocList, p_referenced_decl(): decl@SubpDecl) diff --git a/lkql_checker/share/lkql/kp/KP-VB20-002.lkql b/lkql_checker/share/lkql/kp/KP-VB20-002.lkql index 54e988529..9cfb7ca89 100644 --- a/lkql_checker/share/lkql/kp/KP-VB20-002.lkql +++ b/lkql_checker/share/lkql/kp/KP-VB20-002.lkql @@ -7,7 +7,7 @@ fun sso_array_type(typ) = typ is BaseTypeDecl(p_is_array_type(): true) and stdlib.has_non_default_sso(typ) -@check(help="possible occurrence of KP VB20-002", impact="22.*", +@check(help="possible occurrence of KP VB20-002", message="possible occurrence of KP VB20-002 if using -O2 or above") fun kp_vb20_002(node) = node is CallExpr diff --git a/lkql_checker/share/lkql/kp/KP-VB24-008.lkql b/lkql_checker/share/lkql/kp/KP-VB24-008.lkql index f81a69633..e50164745 100644 --- a/lkql_checker/share/lkql/kp/KP-VB24-008.lkql +++ b/lkql_checker/share/lkql/kp/KP-VB24-008.lkql @@ -1,7 +1,7 @@ # Flag "Post" aspects that contain a 'Old reference and a comparison (= or /=) # with the "null" literal. -@check(message="possible occurrence of KP VB24-008", impact="23.*") +@check(message="possible occurrence of KP VB24-008") fun kp_vb24_008(node) = node is AspectAssoc(f_id: Name(p_name_is("Post"): true)) when (from node.f_expr select first diff --git a/lkql_checker/share/lkql/kp/KP-W330-020.lkql b/lkql_checker/share/lkql/kp/KP-W330-020.lkql index 09807b07e..f8e20f615 100644 --- a/lkql_checker/share/lkql/kp/KP-W330-020.lkql +++ b/lkql_checker/share/lkql/kp/KP-W330-020.lkql @@ -1,6 +1,6 @@ # Flag 'Address reference on an object with a size aspect -@check(message="possible occurrence of KP W330-020", impact="20.*,21.*,22.*,23.1") +@check(message="possible occurrence of KP W330-020") fun kp_w330_020(node) = node is AttributeRef( f_attribute: Identifier(p_name_is("Address"): true), diff --git a/lkql_jit/language/src/main/java/com/adacore/lkql_jit/checker/BaseChecker.java b/lkql_jit/language/src/main/java/com/adacore/lkql_jit/checker/BaseChecker.java index 535c7b185..fb66588b5 100644 --- a/lkql_jit/language/src/main/java/com/adacore/lkql_jit/checker/BaseChecker.java +++ b/lkql_jit/language/src/main/java/com/adacore/lkql_jit/checker/BaseChecker.java @@ -51,9 +51,6 @@ public abstract class BaseChecker { /** If the checker has a parametric exemption. */ protected final boolean parametricExemption; - /** Version impacted by the checker. */ - protected final String impact; - /** Target of the checker. */ protected final String target; @@ -72,7 +69,6 @@ public BaseChecker( final Remediation remediation, final long executionCost, final boolean parametricExemption, - final String impact, final String target) { this.name = name; this.function = function; @@ -85,7 +81,6 @@ public BaseChecker( this.remediation = remediation; this.executionCost = executionCost; this.parametricExemption = parametricExemption; - this.impact = impact; this.target = target; } diff --git a/lkql_jit/language/src/main/java/com/adacore/lkql_jit/checker/NodeChecker.java b/lkql_jit/language/src/main/java/com/adacore/lkql_jit/checker/NodeChecker.java index 48f252d65..44e12feb9 100644 --- a/lkql_jit/language/src/main/java/com/adacore/lkql_jit/checker/NodeChecker.java +++ b/lkql_jit/language/src/main/java/com/adacore/lkql_jit/checker/NodeChecker.java @@ -25,7 +25,6 @@ public NodeChecker( final Remediation remediation, final long executionCost, final boolean parametricExemption, - final String impact, final String target) { super( name, @@ -39,7 +38,6 @@ public NodeChecker( remediation, executionCost, parametricExemption, - impact, target); } @@ -59,7 +57,6 @@ public BaseChecker copy() { this.remediation, this.executionCost, this.parametricExemption, - this.impact, this.target); } } diff --git a/lkql_jit/language/src/main/java/com/adacore/lkql_jit/checker/UnitChecker.java b/lkql_jit/language/src/main/java/com/adacore/lkql_jit/checker/UnitChecker.java index 4c26d3d71..d5e67f9de 100644 --- a/lkql_jit/language/src/main/java/com/adacore/lkql_jit/checker/UnitChecker.java +++ b/lkql_jit/language/src/main/java/com/adacore/lkql_jit/checker/UnitChecker.java @@ -24,7 +24,6 @@ public UnitChecker( final Remediation remediation, final long executionCost, final boolean parametricExemption, - final String impact, final String target) { super( name, @@ -38,7 +37,6 @@ public UnitChecker( remediation, executionCost, parametricExemption, - impact, target); } @@ -57,7 +55,6 @@ public BaseChecker copy() { this.remediation, this.executionCost, this.parametricExemption, - this.impact, this.target); } } diff --git a/lkql_jit/language/src/main/java/com/adacore/lkql_jit/nodes/declarations/CheckerExport.java b/lkql_jit/language/src/main/java/com/adacore/lkql_jit/nodes/declarations/CheckerExport.java index dae8868f8..b21588c34 100644 --- a/lkql_jit/language/src/main/java/com/adacore/lkql_jit/nodes/declarations/CheckerExport.java +++ b/lkql_jit/language/src/main/java/com/adacore/lkql_jit/nodes/declarations/CheckerExport.java @@ -93,14 +93,14 @@ private void exportChecker(VirtualFrame frame, LKQLFunction functionValue) { }; // Get the auto fix function - final var autoFixObject = checkerArguments[11]; + final var autoFixObject = checkerArguments[10]; final var autoFixArg = this.annotation.getArguments().getArgWithName("auto_fix"); // If there is an auto fix, the checker must be a node checker if (autoFixObject != null && this.mode == CheckerMode.UNIT) { throw LKQLRuntimeException.fromMessage( "Auto fixes not available for unit checks", - autoFixArg.orElseGet(() -> this.annotation.getArguments().getArgs()[11])); + autoFixArg.orElseGet(() -> this.annotation.getArguments().getArgs()[10])); } // Check that the auto fix object is a function @@ -109,7 +109,7 @@ private void exportChecker(VirtualFrame frame, LKQLFunction functionValue) { LKQLTypesHelper.LKQL_FUNCTION, LKQLTypesHelper.fromJava(autoFixObject), OptionalUtils.map(autoFixArg, a -> (LKQLNode) a.getArgExpr()) - .orElseGet(() -> this.annotation.getArguments().getArgs()[11])); + .orElseGet(() -> this.annotation.getArguments().getArgs()[10])); } final var autoFix = autoFixObject == null ? null : LKQLTypeSystemGen.asLKQLFunction(autoFixObject); @@ -129,8 +129,7 @@ private void exportChecker(VirtualFrame frame, LKQLFunction functionValue) { remediation, (long) checkerArguments[6], (boolean) checkerArguments[7], - (String) checkerArguments[8], - (String) checkerArguments[9]) + (String) checkerArguments[8]) : new UnitChecker( functionValue.name, functionValue, @@ -142,8 +141,7 @@ private void exportChecker(VirtualFrame frame, LKQLFunction functionValue) { remediation, (long) checkerArguments[6], (boolean) checkerArguments[7], - (String) checkerArguments[8], - (String) checkerArguments[9]); + (String) checkerArguments[8]); // Put the object in the context LKQLLanguage.getContext(this) diff --git a/lkql_jit/language/src/main/java/com/adacore/lkql_jit/utils/Constants.java b/lkql_jit/language/src/main/java/com/adacore/lkql_jit/utils/Constants.java index 67b1cbc8f..6c04f6a7f 100644 --- a/lkql_jit/language/src/main/java/com/adacore/lkql_jit/utils/Constants.java +++ b/lkql_jit/language/src/main/java/com/adacore/lkql_jit/utils/Constants.java @@ -86,7 +86,6 @@ public class Constants { "remediation", "execution_cost", "parametric_exemption", - "impact", "target", "rule_name", "auto_fix" @@ -95,6 +94,6 @@ public class Constants { /** The default values for annotation parameters. */ public static final Object[] CHECKER_PARAMETER_DEFAULT_VALUES = new Object[] { - null, null, false, "Misc", "Misc", "MEDIUM", 0L, false, "", "amd64", null, null + null, null, false, "Misc", "Misc", "MEDIUM", 0L, false, "amd64", null, null }; }