CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

How to get rid of warning when using _return_ feature?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

How to get rid of warning when using _return_ feature?
PostPosted: Thu Jan 13, 2005 1:53 pm     Reply with quote

I copied the find_parity() example from the Sept-2004 manual but can't get rid of the warning 'Function not void and does not return a value'.


I'm using PCWH v3.212 for the PIC18F458.

Code:
#include <18F458.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=16000000)

// This routine was copied from the CCS manual.
int find_parity(int data_char)
{
  int count;
#asm
  movlw 0x8
  movwf count
  movlw 0
loop:
  xorwf data_char,w
  rrncf data_char,f     // use 'rrf' for pic16
  decfsz count,f
  goto loop
  movwf _return_
#endasm
}

void main()
{
  int8 data;
  int8 parity;
 
  parity = find_parity(data);
  parity = find_parity(data);
}



The above code is working and I do like the use of _return_, but how to get rid of the warning?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jan 13, 2005 2:05 pm     Reply with quote

One way is to add this line to your program:

#ignore_warnings 208
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Thu Jan 13, 2005 10:26 pm     Reply with quote

It will cost you a couple of bytes but:
Code:

#include <18F458.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=16000000)

int8 wreg;
#locate wreg = 0xFE8

// This routine was copied from the CCS manual.
int find_parity(int data_char)
{
  int count;
#asm
  movlw 0x8
  movwf count
  movlw 0
loop:
  xorwf data_char,w
  rrncf data_char,f     // use 'rrf' for pic16
  decfsz count,f
  goto loop
//  movwf _return_
#endasm
  return wreg;
}

void main()
{
  int8 data;
  int8 parity;
 
  parity = find_parity(data);
  parity = find_parity(data);
}
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Jan 14, 2005 2:21 am     Reply with quote

Thanks PCMprogrammer and Mark, both your suggestions will remove the warning message.
I just don't like it that these are workarounds and have side effects. Use of the _return_ feature is documented in the manual so I feel like it shouldn't give a warning message.

For now I'll do with one of the workarounds AND post it to ccssupport.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group