<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Add DISABLEWARNING support to C51?</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/14335/add-disablewarning-support-to-c51</link><description> The new BL51 option to disable specific warning messages is very nice! I would also like to have this capability in the C51 compiler (finer-grained control than WARNINGLEVEL). Specifically, there are times when I want to disable warning C280 (unreferenced</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Add DISABLEWARNING support to C51?</title><link>https://community.arm.com/thread/53840?ContentTypeID=1</link><pubDate>Thu, 20 Sep 2001 05:12:51 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:5bf7bd62-bf08-404f-9834-45b76c6cdd2e</guid><dc:creator>Eric VAN OLDEN</dc:creator><description>&lt;p&gt;When you don&amp;#39;t use a parameter, I confirm that instruction &amp;quot;p1=p1;&amp;quot; don&amp;#39;t gererate any code if parameter p1 is a register. But if a parameter p1 is in memory, you must use instruction &amp;quot;if(p1);&amp;quot; for do not generate any code and suppress warning.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Add DISABLEWARNING support to C51?</title><link>https://community.arm.com/thread/53839?ContentTypeID=1</link><pubDate>Thu, 20 Sep 2001 05:11:40 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:873ab069-e5a7-4949-b35f-cab3b03097c5</guid><dc:creator>Eric VAN OLDEN</dc:creator><description>&lt;p&gt;When you don&amp;#39;t use a parameter, I confirm that instruction &amp;quot;p1=p1;&amp;quot; don&amp;#39;t gererate any code if parameter p1 is a register. But if a parameter p1 is in memory, you must use instruction &amp;quot;if(p1);&amp;quot; for do not generate any code and suppress warning.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Add DISABLEWARNING support to C51?</title><link>https://community.arm.com/thread/37788?ContentTypeID=1</link><pubDate>Sun, 19 Aug 2001 17:36:12 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:4edb85e0-9118-40b4-b48b-4ac78661149d</guid><dc:creator>Andrew Neil</dc:creator><description>&lt;p&gt;I second that!&lt;br /&gt;
&lt;br /&gt;
Or maybe something like&lt;pre&gt;#pragma unused p1&lt;/pre&gt;
This is a particularly common problem when writing state machines using function pointers, as &lt;b&gt;all&lt;/b&gt; the functions &lt;b&gt;must&lt;/b&gt; have the same set of parameters - whether they need them or not.&lt;br /&gt;
I have yet to come across a compiler which handles this well. :-(&lt;br /&gt;
&lt;br /&gt;
Keil makes the problem worse as it gives the same message, &amp;quot;unreferenced local variable,&amp;quot; for both parameters and real local variables!  :-(&lt;br /&gt;
&lt;br /&gt;
You could try something like:&lt;pre&gt;void funct1( char p1, char p2 )
{
   p1 = p1; // dummy - does nothing, stops warning.
   do something with p2...
}&lt;/pre&gt;I think C51 &lt;i&gt;is&lt;/i&gt; smart enough to avoid generating any code for the &lt;b&gt;p1=p1&lt;/b&gt;, but it might depend on the optimisation level? (note that some compilers will give a warning such as &amp;quot;code with possibly no effect&amp;quot; in this case).&lt;br /&gt;
&lt;br /&gt;
BTW: Note the use of &lt;b&gt;&amp;amp;ltpre&amp;amp;gt&lt;/b&gt; and &lt;b&gt;&amp;amp;lt/pre&amp;amp;gt&lt;/b&gt; tags for code extracts - see the &lt;i&gt;Tips for Posting Messages&lt;/i&gt; in the sidebar to the left.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>