CDT does not present unreachable in code completions. The issue you are facing is the definition of unreachable AFAICT.
In C, everything that is not static is "public" and can be called from anywhere else. No declaration is even necessary (although I would recommend -Wall -Werror
, but that is a separate discussion).
For example, consider file.c
with contents:
static void func_private1(void) {}
static void func_private2(void) {}
void func_public1(void) {}
void func_public2(void) {}
if you request completions for func_
in other.c
you get all the completions:
however, if you open another file and request completions for func_
you only get the public ones (non-static):
Now, in the other file, if you select func_public1
, then you can CDT automatically add in the header file for it. You can do this with "organizing imports" Shift-Ctrl-O (Source menu -> Organize Imports).
You can control the behaviour of Organize Imports in the preferences (C/C++ -> Code Style -> Organize Imports)