Search code examples
cinclude

floc and RETSIGTYPE in make source


Where do the keywords floc and RETSIGTYPE come from in the following extract of this C code?

struct commands
{
    floc fileinfo;              /* Where commands were defined.  */
    char *commands;             /* Commands text.  */
    char **command_lines;       /* Commands chopped up into lines.  */
    unsigned char *lines_flags; /* One set of flag bits for each line.  */
    unsigned short ncommand_lines;/* Number of command lines.  */
    char recipe_prefix;         /* Recipe prefix for this command set.  */
    unsigned int any_recurse:1; /* Nonzero if any 'lines_flags' elt has */
                                /* the COMMANDS_RECURSE bit set.  */
};

/* ... */

RETSIGTYPE fatal_error_signal (int sig);

This is one of the files in the make repository. I am wondering: since this .h file does not include any other header file, how can they be used here?


Solution

  • The symbols you are asking for are defined in the following way:

    #ifndef RETSIGTYPE
    # define RETSIGTYPE     void
    #endif
    
    /* Specify the location of elements read from makefiles.  */
    typedef struct
    {
        const char *filenm;
        unsigned long lineno;
        unsigned long offset;
    } floc;
    

    Both definitions are contained by file makeint.h.

    The reason why in commands.h these symbols are "visible" even if it doesn't include any header file is simply because every *.c file including it (for example commands.c) include makeint.h as well before it.


    How to find an answer in similar situations

    I'm not an expert of the project you linked. I just

    1. Cloned the project with git clone git://git.savannah.gnu.org/make.git
    2. Created a project with a good source code browser (I used SourceInsight)
    3. Searched for the symbols you were asking for and jumped to their definitions