OK, I will explain, but I didn't think these details are relevant.
You're wrong; they're very relevant. You want to do something that can't
be done. Until you tell us why you want to do this, no one can tell you
anything other than "it can't be done". With those reasons, alternatives
can be suggested.
The program has a LOG functionality. This may be enabled, then log_t will
be FILE* pointing to the LOG location. Or it may be unenabled when log_t
must be void typed.
It is never the case that "log_t MUST be void typed"; that's a choice
you made, and it doesn't work. You can't define a object with void type,
but even if you could, you wouldn't be able to perform any operations on
such an object. Therefore, in order for your program to work properly,
even if you could define an object with void type, your program would
still have to be written in such a way as to avoid doing anything with
it. That's being the case, what's the point of defining such an object
in the first place?
The key thing you really need is not the ability to create an object of
type void; what you need is a way of changing which code is executed,
based upon whether or not the LOG functionality is enabled.
Prior to 2011, C didn't provide any mechanism for choosing to execute
different code depending upon what type something was. In C2011, there's
a new feature, _Generic(), that does provide such a mechanism, but using
it for this purpose would be more complicated than necessary. More
appropriate mechanisms include:
1. Using the preprocessor
// Enable logging:
#define LOG_MESSAGE(arguments) log_message(arguments)
// Disable logging:
#define LOG_MESSAGE(arguments)
Or
// Enable logging
#define LOGGING_ENABLED
#ifdef LOGGING_ENABLED
log_message(arguments)
#endif
2. Using conditional statements:
FILE *log_file;
// Enable logging:
log_file = fopen(log_file_name, "w");
// Disable logging:
log_file = NULL;
if(log_file)
log_message(log_file, arguments)
OR
#include <stdbool>
bool logging_enabled;
// Enable logging:
logging_enabled = true;
// disable logging:
logging_enabled = false;
if(logging_enabled)
log_message(arguments);