Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop DCC from complaining about it's own additions with -Wextra enabled #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Dylan-Brotherston
Copy link
Contributor

@Dylan-Brotherston Dylan-Brotherston commented Oct 14, 2020

This is a fix for issue #65

This PR will stop DCC from emitting the following errors about its own additions with -Wextra enabled

<stdin>:869:59: error: unused parameter 'envp' [-Werror,-Wunused-parameter]
static void launch_valgrind(int argc, char *argv[], char *envp[]) {
                                                          ^
<stdin>:1025:30: error: unused parameter 'a' [-Werror,-Wunused-parameter]
void _Unwind_Backtrace(void *a, ...) {
                             ^
<stdin>:1068:20: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
        for (int i = 0; i < sizeof buffer/sizeof buffer[0]; i++)
                        ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<stdin>:1435:20: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
        for (int i = 0; i < size; i++) {
                        ~ ^ ~~~~
<stdin>:1436:63: error: comparison of integers of different signs: 'unsigned long' and 'int' [-Werror,-Wsign-compare]
                if (max_stdout_bytes && n_actual_line + n_actual_bytes_seen > max_stdout_bytes) {
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
<stdin>:1595:20: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
        for (int i = 0; i < sizeof buffer/sizeof buffer[0]; i++)
                        ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<stdin>:1601:20: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
        for (int i = 0; i < sizeof line_buffer/sizeof line_buffer[0]; i++)
                        ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

DCC will still produce the following errors about it's own additions with -Weverything enabled

<stdin>:35:9: error: macro name is a reserved identifier [-Werror,-Wreserved-id-macro]
#define _GNU_SOURCE
        ^
<stdin>:258:8: error: padding size of 'struct cookie' with 4 bytes to alignment boundary [-Werror,-Wpadded]
struct cookie {
       ^
<stdin>:580:24: error: implicit conversion changes signedness: 'ssize_t' (aka 'long') to 'size_t' (aka 'unsigned long') [-Werror,-Wsign-conversion]
        size_t n_bytes_read = read(cookie->fd, buf, size);
               ~~~~~~~~~~~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<stdin>:602:9: error: implicit conversion changes signedness: 'size_t' (aka 'unsigned long') to 'ssize_t' (aka 'long') [-Werror,-Wsign-conversion]
        return n_bytes_read;
        ~~~~~~ ^~~~~~~~~~~~
<stdin>:614:27: error: implicit conversion changes signedness: 'ssize_t' (aka 'long') to 'size_t' (aka 'unsigned long') [-Werror,-Wsign-conversion]
        size_t n_bytes_written = write(cookie->fd, buf, size);
               ~~~~~~~~~~~~~~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
<stdin>:623:9: error: implicit conversion changes signedness: 'size_t' (aka 'unsigned long') to 'ssize_t' (aka 'long') [-Werror,-Wsign-conversion]
        return n_bytes_written;
        ~~~~~~ ^~~~~~~~~~~~~~~
<stdin>:645:9: error: implicit conversion loses integer precision: 'off_t' (aka 'long') to 'int' [-Werror,-Wshorten-64-to-32]
        return result;
        ~~~~~~ ^~~~~~
<stdin>:895:21: error: variable length array used [-Werror,-Wvla]
        char *valgrind_argv[valgrind_command_len + argc + 1];
                           ^
<stdin>:940:33: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
static void disable_check_output();
                                ^
                                 void
<stdin>:941:29: error: function '__dcc_error_exit' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
void __dcc_error_exit(void) {
                            ^
<stdin>:964:21: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
void __asan_on_error() NO_SANITIZE;
                    ^
                     void
<stdin>:971:44: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
        extern char *__asan_get_report_description();
                                                  ^
                                                   void
<stdin>:972:34: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
        extern int __asan_report_present();
                                        ^
                                         void
<stdin>:966:6: error: no previous prototype for function '__asan_on_error' [-Werror,-Wmissing-prototypes]
void __asan_on_error() {
     ^
<stdin>:964:6: note: this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function
void __asan_on_error() NO_SANITIZE;
     ^
                     void
<stdin>:986:6: error: no previous prototype for function '_Unwind_Backtrace' [-Werror,-Wmissing-prototypes]
void _Unwind_Backtrace(void *a, ...) {
     ^
<stdin>:964:6: note: this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function
void __asan_on_error() NO_SANITIZE;
     ^
                     void
<stdin>:986:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void _Unwind_Backtrace(void *a, ...) {
^
static 
<stdin>:993:7: error: no previous prototype for function '__asan_default_options' [-Werror,-Wmissing-prototypes]
char *__asan_default_options() {
      ^
<stdin>:964:6: note: this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function
void __asan_on_error() NO_SANITIZE;
     ^
                     void
<stdin>:986:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void _Unwind_Backtrace(void *a, ...) {
^
static 
<stdin>:993:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
char *__asan_default_options() {
^
static 
<stdin>:1008:6: error: no previous prototype for function '__ubsan_on_report' [-Werror,-Wmissing-prototypes]
void __ubsan_on_report(void) {
     ^
<stdin>:964:6: note: this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function
void __asan_on_error() NO_SANITIZE;
     ^
                     void
<stdin>:986:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void _Unwind_Backtrace(void *a, ...) {
^
static 
<stdin>:993:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
char *__asan_default_options() {
^
static 
<stdin>:1008:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void __ubsan_on_report(void) {
^
static 
<stdin>:1038:7: error: no previous prototype for function '__ubsan_default_options' [-Werror,-Wmissing-prototypes]
char *__ubsan_default_options() {
      ^
<stdin>:964:6: note: this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function
void __asan_on_error() NO_SANITIZE;
     ^
                     void
<stdin>:986:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void _Unwind_Backtrace(void *a, ...) {
^
static 
<stdin>:993:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
char *__asan_default_options() {
^
static 
<stdin>:1008:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void __ubsan_on_report(void) {
^
static 
<stdin>:1038:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
char *__ubsan_default_options() {
^
static 
format, arg);
<stdin>:1200:60: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
    int n = vfprintf(debug_stream ? debug_stream : stderr, format, arg);
                                                           ^~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
<stdin>:964:6: note: this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function
void __asan_on_error() NO_SANITIZE;
     ^
                     void
<stdin>:986:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void _Unwind_Backtrace(void *a, ...) {
^
static 
<stdin>:993:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
char *__asan_default_options() {
^
static 
<stdin>:1008:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void __ubsan_on_report(void) {
^
static 
<stdin>:1038:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
char *__ubsan_default_options() {
^
static 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant