tango-controls/cppTango

Prevent including the wrong include file by accident

Closed this issue · 0 comments

t-b commented

[...]

  1. If we try to force include /usr/local/include before any Tango directories, nothing happens. See: https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html#Directory-Options

    If a standard system include directory, or a directory specified with -isystem, is also specified with -I, the -I option is ignored.

    I observe the same behavior on Clang 8 on ubuntu bionic.
    Maybe this is different on FreeBSD.

  2. Still, event.h may appear in other (non-system) directories and if that's the case, we get compilation errors, like:

    In file included from /home/michal/Documents/cppTango/cppapi/server/eventsupplier.h:61:
    /home/michal/Documents/cppTango/cppapi/client/eventconsumer.h:316:2: error: unknown type name 'EventQueue'
            EventQueue                      *ev_queue;
            ^
    

Switching to including full paths will be painful as you said because we have different directory structure in source tree compared to what is installed.

We also cannot just change <event> to "event" because it is located in client/ directory but included from both client/ and server/ directories. In latter case, we will not find this file in current directory and we fall-back to usual lookup order.

If this is really a problem for FreeBSD i suggest to just rename this file to something more unique.

Originally posted by @mliszcz in #711 (comment)