{"id":228,"date":"2023-11-16T09:07:51","date_gmt":"2023-11-16T09:07:51","guid":{"rendered":"https:\/\/blog.kyuucloud.com\/?p=228"},"modified":"2023-11-16T09:07:51","modified_gmt":"2023-11-16T09:07:51","slug":"quick-and-dirty-qac-easy-project-setup-tips-and-fixes","status":"publish","type":"post","link":"https:\/\/blog.kyuucloud.com\/?p=228","title":{"rendered":"Quick and dirty: QAC easy project setup tips and fixes"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This small guide is written as a reminder for self to save time the next time I have to use it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As the current version used is ancient and still runs under &#8220;PRQA Framework&#8221;, this guide might be outdated soon.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Project creation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I will list what goes into each entries:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Project location:\n<ul class=\"wp-block-list\">\n<li>&lt;git_repository_root>\/QAC\/&lt;project_name><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Project name:\n<ul class=\"wp-block-list\">\n<li>Automatically filled in<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Language Family:\n<ul class=\"wp-block-list\">\n<li>C\/C++<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Project properties:\n<ul class=\"wp-block-list\">\n<li>Analysis Configuration File:\n<ul class=\"wp-block-list\">\n<li>&lt;something>.acf\n<ul class=\"wp-block-list\">\n<li>This file is telling QAC which components and versions to use (e.g., qac, qacpp, rcma, namecheck)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Rule Configuration File:\n<ul class=\"wp-block-list\">\n<li>&lt;something>.rcf\n<ul class=\"wp-block-list\">\n<li>This file contains which rules to include for each components and how the rules are packaged into groups.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Unified Project:\n<ul class=\"wp-block-list\">\n<li><em>As much as I would like to know, never had a QAC server to set up.<\/em><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Filtered CTTs:\n<ul class=\"wp-block-list\">\n<li>Lists all the supported compiler versions, select the appropriate one\n<ul class=\"wp-block-list\">\n<li>These files are used to &#8220;spoof&#8221; the compiler functionality and tell QAC what various compiler flags mean that can come up in the source code.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Candidate CTT Details:\n<ul class=\"wp-block-list\">\n<li>If a CTT from the filtered list is highlighted this window gives more information. Confirm the CTT by selecting &#8220;Use this CTT&#8221;.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Filter Options:\n<ul class=\"wp-block-list\">\n<li>Bunch of filters to help navigate the dozens of CTT versions for various compilers.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Once done click create.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Project initial settings<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Normally project settings automatically open after creation. The usual steps I take for setting up the project.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Project<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Editing the macro for SOURCE_ROOT to point to the &lt;git_repository_root>. To do this if the project files have been created as mentioned above:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>${PROJECT_ROOT}\\..\\..<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Sync Settings<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Leave it default. The include folders and defines will be sorted out in a separate more efficient way.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Baseline<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For creating new project it is best left default. I might explain how to use it later. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Analysis<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">There are a couple of steps to do here.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If a custom rule file has been used, it is very likely the messages database needs to change as well. Re-browse the correct message file in &#8220;User Messages File&#8221;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Component settings (in this case qac and namecheck):<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For QAC edit the following entries:<br>-via as text:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>${PROJECT_ROOT}\/settings.via<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is where all the include- and preprocessor definition flags will be added later.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For Namechek edit the following entries:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">-namerulefile: Browse the .ncf file that contains the regex rules.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Rule configuration, Compiler selection, Version Control Configuration<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">These can be left alone.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Converting project includes and definitions into &#8220;settings.via&#8221;<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>TIP: Make use of the replace feature of text editors to preserve your sanity.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Navigate to QAC project root. Create a new text file &#8220;settings.via&#8221;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In my latest case I used IAR, this is how a line of include definition was taken from the project settings:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$PROJ_DIR$\/..\/User\/inc\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">IAR projects directories are usually located at:<br>&lt;git_repository_root>\/&lt;Project Name>\/EWARM\/<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We need to make this entry to point from QAC project root.<br>As a reminder the root is at:<br>&lt;git_repository_root>\/QAC\/&lt;qac_project_name><br><br>The resulting entry should look like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>First converting IAR include to point from &lt;git_root>\n&lt;IAR Project Name>\/<strong>EWARM\/..<\/strong>\/User\/Inc\n\nWe can simplify it:\n&lt;IAR Project Name>\/User\/Inc\n\nThen we add the bit to point from QAC project root:\n..\/..\/&lt;IAR Project Name>\/User\/Inc\n\nFinally since this is supposed to look like a compiler flag so we add -I in front. It is a good practice to add quotation marks around the file path:\n-I\"..\/..\/&lt;IAR Project Name>\/User\/Inc\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><br>Now for the preprocessor define macros:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>IAR version:\nUSE_FULL_LL_DRIVER\nRANDOMFLAG=1\n\nQAC version:\n-D\"USE_FULL_LL_DRIVER\"\n-D\"RANDOMFLAG=1\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Save and the project should be set up.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Adding Source files<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In the left &#8220;Files&#8221; tab, right click QAC and select &#8220;Add File(s)&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Select all folders and files QAC should be analysing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">These are all the settings that&#8217;s necessary for a basic QAC project setup.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Minor Fix for IAR<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">QAC really hates IAR&#8217;s __attribute__(&lt;anything>) macros.<br>Instead of #pragma packed IAR uses __attribute__(__packed__).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Luckily this is an easy fix:<br>In Project Settings\/Analysis\/QAC for -d create a new entry<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>__attribute__=_ignore_paren<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Apparently this is QACs way of ignoring __attribute__ entries with their bracket contents.<\/p>\n<div class=\"remoji_bar\"><div class=\"remoji_add_container\" data-remoji-id=\"228\" data-remoji-type=\"post\"><div class=\"remoji_add_icon\"><\/div><\/div><div class=\"remoji_error_bar\" data-remoji-id=\"228\" data-remoji-type=\"post\" style=\"display: none;\">Error happened.<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>This small guide is written as a reminder for self to save time the next time I have to use it. As the current version used is ancient and still runs under &#8220;PRQA Framework&#8221;, this guide might be outdated soon. Project creation I will list what goes into each entries: Once done click create. Project [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[45,44,46],"class_list":["post-228","post","type-post","status-publish","format-standard","hentry","category-tutorial","tag-programming","tag-qac","tag-static-analysis"],"_links":{"self":[{"href":"https:\/\/blog.kyuucloud.com\/index.php?rest_route=\/wp\/v2\/posts\/228","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.kyuucloud.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.kyuucloud.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.kyuucloud.com\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.kyuucloud.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=228"}],"version-history":[{"count":1,"href":"https:\/\/blog.kyuucloud.com\/index.php?rest_route=\/wp\/v2\/posts\/228\/revisions"}],"predecessor-version":[{"id":229,"href":"https:\/\/blog.kyuucloud.com\/index.php?rest_route=\/wp\/v2\/posts\/228\/revisions\/229"}],"wp:attachment":[{"href":"https:\/\/blog.kyuucloud.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kyuucloud.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=228"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kyuucloud.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}