"Fossies" - the Fresh Open Source Software Archive

Member "aspell-0.60.8/test/warning-settings.cpp" (8 Oct 2019, 1263 Bytes) of package /linux/misc/aspell-0.60.8.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #include <cstdio>
    2 
    3 #ifdef __GNUC__
    4 static const int GCC = __GNUC__, GCC_MINOR = __GNUC_MINOR__;
    5 #else
    6 static const int GCC = 0, GCC_MINOR = 0;
    7 #endif
    8 
    9 #ifdef __clang__
   10 #define has_gcc_warning(str) __has_warning(str)
   11 #else
   12 #define __has_warning(str) false
   13 #define has_gcc_warning(str) true
   14 #endif
   15 
   16 #define disable_clang_warning(str) if (__has_warning("-W" str)) printf("-Wno-%s ", str)
   17 #define disable_gcc_warning(str) if (has_gcc_warning("-W" str)) printf("-Wno-%s ", str)
   18 #define disable_gcc_error(str) if (has_gcc_warning("-W" str)) printf("-Wno-error=%s ", str)
   19 
   20 int main() {
   21   if (!GCC) return 0;
   22   fprintf(stderr, "gcc version = %d.%d\n", GCC, GCC_MINOR);
   23   printf("EXTRA_CXXFLAGS = -Wall -Wno-sign-compare -Wno-unused -Werror ");
   24   printf("-Wno-error=unused-result "); // FIXME: Remove this once the cause of the warning is fixed
   25   if ((GCC == 4 && GCC_MINOR >= 7) || GCC >= 5)
   26     disable_gcc_error("maybe-uninitialized");
   27   if (GCC >= 6)
   28     disable_gcc_warning("misleading-indentation");
   29   if (GCC == 7) // FIXME: I _think_ this is a false positive but need
   30                 // to double check
   31     printf("-Walloc-size-larger-than=-1 ");
   32   disable_clang_warning("return-type-c-linkage");
   33   disable_clang_warning("tautological-compare");
   34   printf("\n");
   35 }