CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2010
    Posts
    11

    [RESOLVED] [newbie] Is this function compiled in kernel?

    Hello

    I have weak C skills, and need to check what this warning means when compiling a driver for the uClinux kernel:
    Code:
    #if defined(CONFIG_MYPLATFORM)
    ...
    static void driver_init(void)
    {
    	some_func("some string");
    }
    #else
    static void driver_init(void) {}
    #endif
    The message is: "warning: "driver_init" defined but not used".

    I have a couple of question:
    1. Does it mean that this function is compiled in the kernel, but just happens not to be called by another function within this file?
    2. If this is what it means, is there a better way than grep to find from which other C file this function might be called? The uClinux source code is pretty big, so it could take a long while
    3. If the function is compiled in, is there a way to know which one it is (ie. the one in the #if, or the one in the #else)?

    Thank you.

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: [newbie] Is this function compiled in kernel?

    Because the function is declared static, it is impossible for it to be called from any other file which does not #include the file this is in (or indirectly do so via another #include).

  3. #3
    Join Date
    May 2010
    Posts
    11

    Re: [newbie] Is this function compiled in kernel?

    Thanks for the tip. I'll grep for the include and see from which other file this function is called.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured