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

warnings about parentheses, etc (clang-8) #115

Open
yurivict opened this issue May 25, 2019 · 0 comments
Open

warnings about parentheses, etc (clang-8) #115

yurivict opened this issue May 25, 2019 · 0 comments

Comments

@yurivict
Copy link

yurivict commented May 25, 2019

locfit/makecmd.c:88:36: warning: '&&' within '||' [-Wlogical-op-parentheses]
    } while ((instr) || (*z !=' ') && (!isterminator(*z)));
                     ~~ ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
locfit/makecmd.c:88:36: note: place parentheses around the '&&' expression to silence this warning
    } while ((instr) || (*z !=' ') && (!isterminator(*z)));
                                   ^
                        (                                )
locfit/startlf.c:425:14: warning: comparison of array 'lf.mi' not equal to a null pointer is always true [-Wtautological-pointer-compare]
    { if (lf.mi!=NULL) lf.mi[MEV] = ENULL;
          ~~~^~  ~~~~

locfit/startlf.c:240:10: warning: comparison of array 'lf.mi' equal to a null pointer is always false [-Wtautological-pointer-compare]
{ if (lf.mi==NULL) return(1);
      ~~~^~  ~~~~
locfit/makecmd.c:203:29: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
  sprintf((char *)vdptr(vs),cmdline);
                            ^~~~~~~
locfit/makecmd.c:203:29: note: treat the string as an argument to avoid this
  sprintf((char *)vdptr(vs),cmdline);
                            ^
                            "%s", 
locfit/c_plot.c:470:14: warning: incompatible pointer types passing 'char *' to parameter of type 'vari *' [-Wincompatible-pointer-types]
  setvarname(curstr,tname);
             ^~~~~~
locfit/vari.hpp:23:27: note: passing argument to parameter 'v' here
    void setvarname(vari* v, varname name);
                          ^
In file included from sampling.cpp:9:
./sampling.h:50:13: warning: unused typedef 'matrix_type' [-Wunused-local-typedef]
                typedef M matrix_type;
                          ^
./sampling.h:113:19: warning: unused typedef 'const_matrix_type' [-Wunused-local-typedef]
                typedef const M const_matrix_type; 
                                ^
./sampling.h:114:42: warning: unused typedef 'vector_type' [-Wunused-local-typedef]
                typedef vector<typename E::value_type> vector_type; 
                                                       ^
./sampling.h:120:19: warning: unused typedef 'const_matrix_type' [-Wunused-local-typedef]
                typedef const M const_matrix_type; 
                                ^
./sampling.h:121:42: warning: unused typedef 'matrix_type' 1 warning generated.
[-Wunused-local-typedef]
                typedef matrix<typename E::value_type> matrix_type; 
                                                       ^

Please compile with clang and fix these and other warnings. Many of them indicate real problems in the code.

@yurivict yurivict changed the title warnings about parentheses (clang-8) warnings about parentheses, etc (clang-8) May 25, 2019
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

No branches or pull requests

1 participant