Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Cant find a way to disable #pragma warnings in VS2017 (Read 3190 times)
FrankP
Full Member
***
Offline


Posts: 240
Joined: Oct 19th, 2011
Cant find a way to disable #pragma warnings in VS2017
Dec 12th, 2018 at 1:03am
Print Post  
I have VM/VS2017 on an old Windows 7 box, and also on a new Win 10 box.  On my Win7 box, I can use #pragma region and #pragma endregion without generating any compiler warnings.  However, the same code on my Win10 box does generate "warning: ignoring #pragma endregion Low [-Wunknown-pragmas]" warnings.  Here's an example of usage in a project 
Code
Select All

#pragma region LOW_POWER
	//------------------- LOW POWER OPERATION ------------------------------
	//12/03/18 added for low-power wakeup from digital pins
	/********************************************************/
	digital.pinMode(21, INPUT_PULLUP, RISING);//pin, mode, type
	digital.pinMode(22, INPUT_PULLUP, RISING);//pin, mode, type
	/********************************************************/

	/********************************************************
	 Set Low Power Timer wake up in milliseconds.
	 ********************************************************/
	timer.setTimer(5000);// milliseconds
	//------------------- LOW POWER OPERATION ------------------------------
#pragma endregion Low Power Operation Setup

 




I vaguely remember changing a compiler setting on my Win 7 box to suppress #pragma warnings, but for the life of me I cannot find where I did that.  

Anyone here have a clue where that setting is in VS2017 (community edition)?

TIA,

Frank
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Cant find a way to disable #pragma warnings in VS2017
Reply #1 - Dec 12th, 2018 at 12:05pm
Print Post  
I think you are using different toolchains on each machine.
  
Back to top
WWW  
IP Logged
 
FrankP
Full Member
***
Offline


Posts: 240
Joined: Oct 19th, 2011
Re: Cant find a way to disable #pragma warnings in VS2017
Reply #2 - Dec 12th, 2018 at 3:19pm
Print Post  
Can you be a little more specific?  I have no idea how or why a 'different toolchain' would affect whether or not I'm getting pragma warnings.  I've searched around quite a bit, and it seems there is a compiler option that will suppress pragma warnings, but I can't remember how I implemented that on my old machine - grrrr.

Regards,

Frank
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Cant find a way to disable #pragma warnings in VS2017
Reply #3 - Dec 12th, 2018 at 10:40pm
Print Post  
The error is produced by the toolchain during compile. Visual Micro runs the toolchain to compile. Visual Studio plays no part in the compile.

You should also make sure you have the same warnings setting on the vMicro menu between both machines.
« Last Edit: Dec 12th, 2018 at 10:57pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
FrankP
Full Member
***
Offline


Posts: 240
Joined: Oct 19th, 2011
Re: Cant find a way to disable #pragma warnings in VS2017
Reply #4 - Dec 13th, 2018 at 2:25am
Print Post  
Tim@Visual Micro wrote on Dec 12th, 2018 at 10:40pm:
You should also make sure you have the same warnings setting on the vMicro menu between both machines.


OK, that jogged my memory Wink

Apparently I had 'Warnings for Project' UNchecked on my Win7 box, and checked on my Win10 box.  UNchecking 'Warnings for Project' suppressed the pragma (and all other) warnings.

So, I got a bit smarter (I hope) and added the '-Wno-unknown-pragmas' flag to the "extra cpp flags" line in the vMicro/Compiler/Advanced/ dialog.  This suppresses the unknown pragma warning while (hopefully) keeping other warnings enabled.

Apparently "extra cpp flags" this is a project-level setting. Any way to do this globally so all my Arduino projects have it?

TIA,

Frank
 


  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Cant find a way to disable #pragma warnings in VS2017
Reply #5 - Dec 14th, 2018 at 2:02pm
Print Post  
Great. You could edit the platform.txt for the platform that you are using and change the ccp recipe/pattern to include the flag. You would need to repeat this in the future after installing updated toolchains.
« Last Edit: Dec 14th, 2018 at 2:02pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint