• AVR Freaks

Hot!Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call mad

Author
rikotech
New Member
  • Total Posts : 25
  • Reward points : 0
  • Joined: 2012/07/10 09:56:05
  • Location: 0
  • Status: offline
2018/10/15 03:12:16 (permalink)
0

Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call mad

The warning is: main.c:95:: [<font]warning: (1518) direct function call made with an incomplete prototype (receiver_init)
main.c
#include "modules/receiver/receiver.h"
void main_init(void){
receiver_init();
}
 
receiver.h
extern void receiver_init(void); // If remove void from parenthesis - same sh*t
 
receiver.c
#include "receiver.h"
void receiver_init(){ 
self.cb.head = 0;
self.cb.tail = 0; 
}
 
Some help please?
#1

18 Replies Related Threads

    btbass
    Super Member
    • Total Posts : 358
    • Reward points : 0
    • Joined: 2004/12/10 13:50:32
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/15 03:54:30 (permalink)
    0
    You don't need the 'extern'
    #2
    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/15 04:03:01 (permalink)
    +1 (1)
    rikotech
     
    receiver.c
    #include "receiver.h"
    void receiver_init(){ 
    self.cb.head = 0;
    self.cb.tail = 0; 
    }

    void receiver_init(){ 

    should be
    void receiver_init(void){ 


    Nearly there...
    #3
    rpg7
    Super Member
    • Total Posts : 1380
    • Reward points : 0
    • Joined: 2003/11/07 12:47:35
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/15 04:06:03 (permalink)
    +1 (1)
    should be
    void receiver_init(void) {
    you need the void in the actual function, not just the header
    #4
    rikotech
    New Member
    • Total Posts : 25
    • Reward points : 0
    • Joined: 2012/07/10 09:56:05
    • Location: 0
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/15 07:07:12 (permalink)
    0
    Sorry guys. None of the above make sense to me but here is what I found.
    The MPLAB X IDE v5.05 seems to have a bug! Does not remake source files when some of the included header files is changed. Clean and Build is workaround. 
    #5
    1and0
    Access is Denied
    • Total Posts : 9297
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/15 08:01:59 (permalink)
    +2 (2)
    This declaration
    void receiver_init()

    can accept any arguments. As others said, the correct declaration is
    void receiver_init(void)

    which is a function without arguments.
    #6
    rikotech
    New Member
    • Total Posts : 25
    • Reward points : 0
    • Joined: 2012/07/10 09:56:05
    • Location: 0
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/15 08:28:10 (permalink)
    -1 (1)
    Apologize you guys @1and0 @rpg7 @qhb
    You are right! I think the compiler could imply void argument list from the empty parenthesis.
     
    #7
    1and0
    Access is Denied
    • Total Posts : 9297
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/15 08:40:39 (permalink)
    +1 (1)
    rikotech
    I think the compiler could imply void argument list from the empty parenthesis.

    With an empty () it is telling the compiler not to do any checks on the parameters list.  That is, this
      receiver_init();

    and this
      receiver_init(foo,bar,baz);

    will work.
     
    #8
    du00000001
    Just Some Member
    • Total Posts : 2781
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/15 09:31:11 (permalink)
    +1 (1)
    @ rikotech
     
    Compilers do not "imply" anything. They follow the written characters and some "fancy" rules about type promotion. That's it.

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #9
    Jim Nickerson
    User 452
    • Total Posts : 6022
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/15 10:35:32 (permalink)
    +1 (1)
    I do trust the compiler does not "imply" anything, but follows strict rules.
    #10
    mlp
    boots too small
    • Total Posts : 763
    • Reward points : 0
    • Joined: 2012/09/10 15:12:07
    • Location: previously Microchip XC8 team
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/16 07:46:10 (permalink)
    +2 (2)
    rikotech
    I think the compiler could imply void argument list

    As others have said, the compiler does not "imply".
     
    It also does not "infer", which is the word you actually meant to use for "deduce or conclude (information) from evidence and reasoning rather than from explicit statements".
     
    To "imply" is to "strongly suggest the truth or existence of (something not expressly stated)".

    Mark (this opinion available for hire)
    #11
    du00000001
    Just Some Member
    • Total Posts : 2781
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/16 12:58:25 (permalink)
    +1 (1)
    Compilers do not even "try some educated guess" if your code is not absolutely clear and free from errors. Instead they simply throw warnings and errors.

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #12
    NKurzman
    A Guy on the Net
    • Total Posts : 17499
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/16 18:40:00 (permalink)
    0
    du00000001
    Compilers do not even "try some educated guess" if your code is not absolutely clear and free from errors. Instead they simply throw warnings and errors.


    Except for GCC Compilers They do Try some educated Guesses and Do Not warn you.
    #13
    du00000001
    Just Some Member
    • Total Posts : 2781
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/16 18:46:18 (permalink)
    0
    Not exactly my experience.
    Once MPLAB/XC8 threw a mysterios error. Now I tend to sometimes have doxygen (resp. Clang) check my code as well: gives useful additional insights.

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #14
    crosland
    Super Member
    • Total Posts : 1582
    • Reward points : 0
    • Joined: 2005/05/10 10:55:05
    • Location: Bucks, UK
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2018/10/17 01:55:22 (permalink)
    0
    btbass
    You don't need the 'extern'


    Well, it's nearly panto season "Oh yes you do!"
     
    #15
    Alexmouse
    New Member
    • Total Posts : 21
    • Reward points : 0
    • Joined: 2009/07/06 03:13:29
    • Location: UK
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2019/07/05 08:32:20 (permalink)
    0
    I just got this error in MPLABX5.20, XC8 2.05
     
    In the MCC-generated code (ADCC.C/H), the function 
    bool ADCC_IsConversionDone()
    is defined.
     
    Making this
    bool ADCC_IsConversionDone(void)
    fixes the error.
     
    Buggy tools? Now there's a novelty.
    #16
    du00000001
    Just Some Member
    • Total Posts : 2781
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2019/07/05 08:37:56 (permalink)
    +2 (2)
    @ Alexmouse
     
    For conquering some thread I'll call the cat !

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #17
    InvalidApple
    Super Member
    • Total Posts : 295
    • Reward points : 0
    • Joined: 2011/05/17 23:36:35
    • Location: Melbourne, Australia
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2019/07/06 03:51:41 (permalink)
    0
    Section 6.11.6 of the C99 standards says that it is a "future language direction", but for now...

    6.7.5.3 Function declarators (including prototypes)
    4 - After adjustment, the parameters in a parameter type list in a function declarator that is
    part of a definition of that function shall not have incomplete type.

    Edit/

    Also
    C99 Annex J.2 Undefined behavior

    For a call to a function without a function prototype in scope, the number of arguments does not equal the number of parameters (6.5.2.2).
    For call to a function without a function prototype in scope where the function is defined with a function prototype, either the prototype ends with an ellipsis or the types of the arguments after promotion are not compatible with the types of the parameters (6.5.2.2).
    For a call to a function without a function prototype in scope where the function is not defined with a function prototype, the types of the arguments after promotion are not compatible with those of the parameters after promotion (with certain exceptions) (6.5.2.2).
    post edited by InvalidApple - 2019/07/06 04:01:57
    #18
    ric
    Super Member
    • Total Posts : 22707
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: Get warning I don't know how to fix : main.c:95:: warning: (1518) direct function call 2019/07/06 04:56:04 (permalink)
    +1 (1)
    Bottom line, a lazy MCC programmer omitted the "void" parameter from
    bool ADCC_IsConversionDone()
     

    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!
    #19
    Jump to:
    © 2019 APG vNext Commercial Version 4.5