Uploaded image for project: 'ZABBIX FEATURE REQUESTS'
  1. ZABBIX FEATURE REQUESTS
  2. ZBXNEXT-803

compile cleanly with as many compilation warnings as possible

    XMLWordPrintable

    Details

      Description

      The general idea of this issue is that Zabbix should compile without warnings, even when many of available -W... options are specified to the compiler (for the purposes of this discussion, the targeted compiler will be GCC).

      The first thing to decide upon is the version of C standard we support. Currently, we do not have any official convention, but de facto we write code according to C99. For instance, we use type uint32_t (which, as far as I remember, was not available in C90) and we use string literals with length over 509 (as reported by -Woverlength-strings, see below).

      The second thing is to compile cleanly with the following and maybe other warning options enabled (see http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html for the full list): -Wcast-align, -Wcast-qual, -Wconversion, -Wdeclaration-after-statement (this is in our development conventions), -Wempty-body, -Wfloat-equal, -Wignored-qualifiers, -Wmissing-field-initializers, -Wmissing-include-dirs, -Woverlength-strings, -Wpointer-arith (currently, we seem to avoid pointer arithmetic for Windows, but are OK with it on Unix), -Wpointer-sign, -Wsign-compare, -Wtraditional with -Wno-long-long (currently, we require preprocessor directives to start in the first column, which is checked by -Wtraditional), -Wtype-limits, -Wvla, -Wwrite-strings.

      Also, GCC has one nice feature: if it notices that arguments to printf() or scanf() are incorrect, it issues a warning. By including attributes and compiling with -Wformat and -Wmissing-format-attribute, we could get the same checks for zabbix_log() and other functions.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            asaveljevs Aleksandrs Saveljevs
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: