This repository has been archived by the owner on Jan 28, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pollthread: Fix multiline macro definitions (tango-controls#451)
GCC 8.1.0 outputs /home/firma/devel/cppTango/cppapi/server/pollthread.cpp:1269:11: warning: macro expands to multiple statements [-Wmultistatement-macros] T_ADD(ite_next->wake_up_date,min_delta - diff); ^~~~~~~~ /home/firma/devel/cppTango/cppapi/server/pollthread.h:196:2: note: in definition of macro ‘T_ADD’ A.tv_usec = A.tv_usec + B; \ ^ /home/firma/devel/cppTango/cppapi/server/pollthread.cpp:1268:4: note: some parts of macro expansion are not guarded by this ‘if’ clause if (diff < min_delta) ^~ which is correct as T_ADD is a multiline macro and thus should be enclosed in do { } while(0) as described in https://gcc.gnu.org/onlinedocs/cpp/Swallowing-the-Semicolon.html#Swallowing-the-Semicolon.
- Loading branch information