C Function redeclaration in Code no Error GCC/XC8

58 Views Asked by At

I have written some code to be used on an embedded system but with a Windows demo version. In it, I accidently redeclared a function and would like to determine the effect of this and how to catch it in the future.

I have written the below (simplified version)

#include "external_file.h"

void vClear( void ){
   void vReset( void );  //This should have been vReset();
 }
  • vReset, is already prototyped in external_file.h and defined in external_file.c
  • Running on PIC (XC8 2.40 w-9) and Windows (GCC 12.2.0 C99 -Wextra -Wall)
  • XC8 provides a warning: (520) function "_vReset" is never called
  • GCC provides no warning/error
  • This redeclaration seems to mask the correct function

Is it valid to declare a function within function body? Is there a way to make GCC flag this as XC8 does?

0

There are 0 best solutions below