• AVR Freaks

AnsweredHot!Pre-processor Message Repeated Twice

Author
MichaelPDI
New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2019/08/14 06:52:30
  • Location: 0
  • Status: offline
2019/08/21 05:52:14 (permalink)
0

Pre-processor Message Repeated Twice

Hi,
 
I am using the xc8 v2.10 to compile my code for the PIC18F46K42 (and mplabx v5.25).
 
At the beginning of one of my source files I have pre-processor message to remind me/another developer to edit a macro value. The message is defined using "#pragma message("My message"), however when I compile the code, the message is repeated twice in the ouput:
 
---- BEGIN OUTPUT FROM THE COMPILER ----
SRC/HAL/PIC18F46K42/clock.c:18:9: warning: Verify that the SYSTEM_PERIPH_CLK_MHZ macro matches the clock settings [-W#pragma-messages]
#pragma message("Verify that the SYSTEM_PERIPH_CLK_MHZ macro matches the clock settings")
^
1 warning generated.
SRC/HAL/PIC18F46K42/clock.c:18:9: warning: Verify that the SYSTEM_PERIPH_CLK_MHZ macro matches the clock settings [-W#pragma-messages]
#pragma message("Verify that the SYSTEM_PERIPH_CLK_MHZ macro matches the clock settings")
^
1 warning generated.
---- END OUTPUT FROM THE COMPILER ----
 
Any suggestions why this occurs?
 
Thank you,
Michael
#1
du00000001
Just Some Member
  • Total Posts : 2998
  • Reward points : 0
  • Joined: 2016/05/03 13:52:42
  • Location: Germany
  • Status: offline
Re: Pre-processor Message Repeated Twice 2019/08/21 11:51:12 (permalink)
0
Might be the warning would be issued already without the [-W...] (maybe just without the "warning"), and is re-triggered by the [-W...].
What happens without the -W... ?
 

PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
#2
ric
Super Member
  • Total Posts : 23544
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: Pre-processor Message Repeated Twice 2019/08/21 13:16:34 (permalink)
0 (2)
You haven't accidentally #included that .C file into another one by accident, instead of the matching .H file?
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#3
1and0
Access is Denied
  • Total Posts : 9607
  • Reward points : 0
  • Joined: 2007/05/06 12:03:20
  • Location: Harry's Gray Matter
  • Status: offline
Re: Pre-processor Message Repeated Twice 2019/08/21 14:44:57 (permalink)
+1 (1)
Is "#pragma message" a valid XC8 directive?  Try
#warning This is a test warning message

 
 
<edit> I just tried this #warning in one and only one .c file and the warning shows up TWICE.
 
../test.c:7:2: warning: This is a test warning message [-W#warnings]
#warning This is a test warning message
^
1 warning generated.
../test.c:7:2: warning: This is a test warning message [-W#warnings]
#warning This is a test warning message
^
 
<edit2> Again one and only one .c file:
 
../test.c:2:9: warning: This is a test warning message [-W#pragma-messages]
#pragma message ("This is a test warning message")
^
1 warning generated.
../test.c:2:9: warning: This is a test warning message [-W#pragma-messages]
#pragma message ("This is a test warning message")
^
1 warning generated.
 
post edited by 1and0 - 2019/08/21 15:14:47
#4
1and0
Access is Denied
  • Total Posts : 9607
  • Reward points : 0
  • Joined: 2007/05/06 12:03:20
  • Location: Harry's Gray Matter
  • Status: offline
Re: Pre-processor Message Repeated Twice 2019/08/21 15:21:24 (permalink) ☼ Best Answerby MichaelPDI 2019/08/24 23:35:17
+6 (6)
Uncheck "Generate the ASM listing file" in the compiler properties makes the second warning disappear. ;)
 
#5
Jump to:
© 2019 APG vNext Commercial Version 4.5