Add configuration for G_UNLIKELY and G_LIKELY to avoid syntax errors when these macros are used as condition without enclosing brackets. Add test file to verify Gtk library configuration. Syntax check for the test file is only done when Gtk+2.0 or Gtk+3.0 is found and working. Tested on Cygwin and on Ubuntu 16.04.
23 lines
597 B
C
23 lines
597 B
C
|
|
// Test library configuration for gtk.cfg
|
|
//
|
|
// Usage:
|
|
// $ cppcheck --check-library --enable=information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr --library=gtk test/cfg/gtk.cpp
|
|
// =>
|
|
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
|
//
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
void validCode(int argInt)
|
|
{
|
|
// if G_UNLIKELY is not defined this results in a syntax error
|
|
if G_UNLIKELY(argInt == 1) {
|
|
} else if (G_UNLIKELY(argInt == 2)) {
|
|
}
|
|
|
|
if G_LIKELY(argInt == 0) {
|
|
} else if (G_LIKELY(argInt == -1)) {
|
|
}
|
|
}
|