scheme-for-pd icon indicating copy to clipboard operation
scheme-for-pd copied to clipboard

build on macOS Catalina (10.15.7) giving errors

Open shakfu opened this issue 2 years ago • 2 comments

Hi Iain,

Was just attempting to build for macOS after seeing your nice video (👍 ) and I got some errors (note that PDDIR is exported via export PDDIR="/Applications/Studio/Pd-0.51-4.app/Contents/Resources"):

make
++++ info: using Makefile.pdlibbuilder version 0.6.0
++++ info: using Pd API /Applications/Studio/Pd-0.51-4.app/Contents/Resources/src/m_pd.h
++++ info: making target all in lib s4pd
++++ info: making s4pd.o in lib s4pd
cc -DPD -I "/Applications/Studio/Pd-0.51-4.app/Contents/Resources/src" -DUNIX -DMACOSX -I /sw/include   -I .  -Wall -Wextra -Wshadow -Winline -Wstrict-aliasing -O3 -ffast-math -funroll-loops -fomit-frame-pointer -arch x86_64 -mmacosx-version-min=10.6 -o s4pd.o -c s4pd.c
s4pd.c:251:5: error: implicit declaration of function 'close' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
    close(filedesc);
    ^
s4pd.c:323:23: warning: incompatible pointer types passing 's7_pointer *'
      (aka 'struct s7_cell **') to parameter of type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
    if( s7_is_boolean(s7_obj) ){
                      ^~~~~~
                      *
./s7.h:162:31: note: passing argument to parameter 'x' here
bool s7_is_boolean(s7_pointer x)...
                              ^
s4pd.c:325:46: warning: incompatible pointer types passing 's7_pointer *'
      (aka 'struct s7_cell **') to parameter of type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        SETFLOAT(atom, (float)s7_boolean(s7, s7_obj));
                                             ^~~~~~
                                             *
/Applications/Studio/Pd-0.51-4.app/Contents/Resources/src/m_pd.h:322:77: note:
      expanded from macro 'SETFLOAT'
#define SETFLOAT(atom, f) ((atom)->a_type = A_FLOAT, (atom)->a_w.w_float = (f))
                                                                            ^
./s7.h:163:43: note: passing argument to parameter 'x' here
bool s7_boolean(s7_scheme *sc, s7_pointer x);                                ...
                                          ^
s4pd.c:327:28: warning: incompatible pointer types passing 's7_pointer *'
      (aka 'struct s7_cell **') to parameter of type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
    else if( s7_is_integer(s7_obj)){
                           ^~~~~~
                           *
./s7.h:246:31: note: passing argument to parameter 'p' here
bool s7_is_integer(s7_pointer p)...
                              ^
s4pd.c:329:35: warning: incompatible pointer types passing 's7_pointer *'
      (aka 'struct s7_cell **') to parameter of type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        SETFLOAT(atom, s7_integer(s7_obj));
                                  ^~~~~~
                                  *
/Applications/Studio/Pd-0.51-4.app/Contents/Resources/src/m_pd.h:322:77: note:
      expanded from macro 'SETFLOAT'
#define SETFLOAT(atom, f) ((atom)->a_type = A_FLOAT, (atom)->a_w.w_float = (f))
                                                                            ^
./s7.h:247:30: note: passing argument to parameter 'p' here
s7_int s7_integer(s7_pointer p)...
                             ^
s4pd.c:331:25: warning: incompatible pointer types passing 's7_pointer *'
      (aka 'struct s7_cell **') to parameter of type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
    else if( s7_is_real(s7_obj)){
                        ^~~~~~
                        *
./s7.h:250:28: note: passing argument to parameter 'p' here
bool s7_is_real(s7_pointer p)...
                           ^
s4pd.c:333:32: warning: incompatible pointer types passing 's7_pointer *'
      (aka 'struct s7_cell **') to parameter of type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        SETFLOAT(atom, s7_real(s7_obj));
                               ^~~~~~
                               *
/Applications/Studio/Pd-0.51-4.app/Contents/Resources/src/m_pd.h:322:77: note:
      expanded from macro 'SETFLOAT'
#define SETFLOAT(atom, f) ((atom)->a_type = A_FLOAT, (atom)->a_w.w_float = (f))
                                                                            ^
./s7.h:251:30: note: passing argument to parameter 'p' here
s7_double s7_real(s7_pointer p)...
                             ^
s4pd.c:335:27: warning: incompatible pointer types passing 's7_pointer *'
      (aka 'struct s7_cell **') to parameter of type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
    else if( s7_is_symbol(s7_obj) ){
                          ^~~~~~
                          *
./s7.h:362:30: note: passing argument to parameter 'p' here
bool s7_is_symbol(s7_pointer p)...
                             ^
s4pd.c:338:48: warning: incompatible pointer types passing 's7_pointer *'
      (aka 'struct s7_cell **') to parameter of type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        SETSYMBOL(atom, gensym( s7_symbol_name(s7_obj)));
                                               ^~~~~~
                                               *
/Applications/Studio/Pd-0.51-4.app/Contents/Resources/src/m_pd.h:324:29: note:
      expanded from macro 'SETSYMBOL'
    (atom)->a_w.w_symbol = (s))
                            ^
./s7.h:363:39: note: passing argument to parameter 'p' here
const char *s7_symbol_name(s7_pointer p);                                   /...
                                      ^
s4pd.c:340:27: warning: incompatible pointer types passing 's7_pointer *'
      (aka 'struct s7_cell **') to parameter of type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
    else if( s7_is_string(s7_obj) ){
                          ^~~~~~
                          *
./s7.h:231:30: note: passing argument to parameter 'p' here
bool s7_is_string(s7_pointer p)...
                             ^
s4pd.c:342:43: warning: incompatible pointer types passing 's7_pointer *'
      (aka 'struct s7_cell **') to parameter of type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        SETSYMBOL(atom, gensym( s7_string(s7_obj)));
                                          ^~~~~~
                                          *
/Applications/Studio/Pd-0.51-4.app/Contents/Resources/src/m_pd.h:324:29: note:
      expanded from macro 'SETSYMBOL'
    (atom)->a_w.w_symbol = (s))
                            ^
./s7.h:232:34: note: passing argument to parameter 'p' here
const char *s7_string(s7_pointer p);                                         /...
                                 ^
s4pd.c:344:30: warning: incompatible pointer types passing 's7_pointer *'
      (aka 'struct s7_cell **') to parameter of type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
    else if( s7_is_character(s7_obj) ){
                             ^~~~~~
                             *
./s7.h:240:33: note: passing argument to parameter 'p' here
bool s7_is_character(s7_pointer p)...
                                ^
s4pd.c:347:31: warning: incompatible pointer types passing 's7_pointer *'
      (aka 'struct s7_cell **') to parameter of type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        out[0] = s7_character(s7_obj);
                              ^~~~~~
                              *
./s7.h:241:33: note: passing argument to parameter 'p' here
uint8_t s7_character(s7_pointer p)...
                                ^
s4pd.c:351:93: warning: incompatible pointer types passing 's7_pointer *'
      (aka 'struct s7_cell **') to parameter of type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
  ...Scheme to Max conversion for: %s", s7_object_to_c_string(s7, s7_obj));
                                                                  ^~~~~~
                                                                  *
./s7.h:65:55: note: passing argument to parameter 'obj' here
char *s7_object_to_c_string(s7_scheme *sc, s7_pointer obj);          /* ...
                                                      ^
s4pd.c:373:32: warning: passing 'const char *' to parameter of type 'char *'
      discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        s4pd_s7_eval_string(x, code_sym->s_name);
                               ^~~~~~~~~~~~~~~~
s4pd.c:53:43: note: passing argument to parameter 'string_to_eval' here
void s4pd_s7_eval_string(t_s4pd *x, char *string_to_eval);
                                          ^
s4pd.c:403:11: warning: initializing 'char *' with an expression of type
      'const char *' discards qualifiers
      [-Wincompatible-pointer-types-discards-qualifiers]
    char *token_1 = s->s_name;
          ^         ~~~~~~~~~
s4pd.c:405:10: warning: unused variable 'size' [-Wunused-variable]
    long size = 0;
         ^
s4pd.c:406:11: warning: unused variable 'atoms_as_text' [-Wunused-variable]
    char *atoms_as_text = NULL;
          ^
s4pd.c:466:5: error: implicit declaration of function 'close' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
    close(filedesc);
    ^
s4pd.c:496:17: warning: incompatible pointer types initializing 's7_pointer *'
      (aka 'struct s7_cell **') with an expression of type 's7_pointer'
      (aka 'struct s7_cell *') [-Wincompatible-pointer-types]
    s7_pointer *s7_return_value = s7_nil(x->s7);
                ^                 ~~~~~~~~~~~~~
s4pd.c:500:23: warning: assigning to 'char *' from 'const char *' discards
      qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        receiver_name = s7_symbol_name( s7_car(args) );
                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s4pd.c:503:16: warning: incompatible pointer types returning 's7_pointer *'
      (aka 'struct s7_cell **') from a function with result type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        return s7_return_value;
               ^~~~~~~~~~~~~~~
               *
s4pd.c:507:16: warning: incompatible pointer types returning 's7_pointer *'
      (aka 'struct s7_cell **') from a function with result type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        return s7_return_value;
               ^~~~~~~~~~~~~~~
               *
s4pd.c:513:20: warning: assigning to 'char *' from 'const char *' discards
      qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        msg_symbol = s7_symbol_name( s7_cadr(args) );
                   ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s4pd.c:524:16: warning: incompatible pointer types returning 's7_pointer *'
      (aka 'struct s7_cell **') from a function with result type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        return s7_return_value;
               ^~~~~~~~~~~~~~~
               *
s4pd.c:532:34: warning: incompatible pointer types passing 's7_pointer'
      (aka 'struct s7_cell *') to parameter of type 's7_pointer *'
      (aka 'struct s7_cell **') [-Wincompatible-pointer-types]
        err = s7_obj_to_atom(s7, s7_list_ref(s7, args, i + starting_arg), arg_at...
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s4pd.c:316:47: note: passing argument to parameter 's7_obj' here
int s7_obj_to_atom(s7_scheme *s7, s7_pointer *s7_obj, t_atom *atom){
                                              ^
s4pd.c:535:20: warning: incompatible pointer types returning 's7_pointer *'
      (aka 'struct s7_cell **') from a function with result type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
            return s7_return_value;
                   ^~~~~~~~~~~~~~~
                   *
s4pd.c:541:12: warning: incompatible pointer types returning 's7_pointer *'
      (aka 'struct s7_cell **') from a function with result type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
    return s7_return_value;
           ^~~~~~~~~~~~~~~
           *
s4pd.c:549:17: warning: incompatible pointer types initializing 's7_pointer *'
      (aka 'struct s7_cell **') with an expression of type 's7_pointer'
      (aka 'struct s7_cell *') [-Wincompatible-pointer-types]
    s7_pointer *s7_return_value = s7_make_boolean(x->s7, false);
                ^                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s4pd.c:559:20: warning: assigning to 'char *' from 'const char *' discards
      qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        array_name = s7_symbol_name( s7_car(args) );
                   ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s4pd.c:562:16: warning: incompatible pointer types returning 's7_pointer *'
      (aka 'struct s7_cell **') from a function with result type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        return s7_return_value;
               ^~~~~~~~~~~~~~~
               *
s4pd.c:568:16: warning: incompatible pointer types returning 's7_pointer *'
      (aka 'struct s7_cell **') from a function with result type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        return s7_return_value;
               ^~~~~~~~~~~~~~~
               *
s4pd.c:573:16: warning: incompatible pointer types returning 's7_pointer *'
      (aka 'struct s7_cell **') from a function with result type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        return s7_return_value;
               ^~~~~~~~~~~~~~~
               *
s4pd.c:574:44: warning: incompatible pointer types passing 't_int *'
      (aka 'long *') to parameter of type 'int *' [-Wincompatible-pointer-types]
    }else if (!garray_getfloatwords(array, &num_points, &values_vector)){
                                           ^~~~~~~~~~~
/Applications/Studio/Pd-0.51-4.app/Contents/Resources/src/m_pd.h:678:51: note:
      passing argument to parameter 'size' here
EXTERN int garray_getfloatwords(t_garray *x, int *size, t_word **vec);
                                                  ^
s4pd.c:576:16: warning: incompatible pointer types returning 's7_pointer *'
      (aka 'struct s7_cell **') from a function with result type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        return s7_return_value;
               ^~~~~~~~~~~~~~~
               *
s4pd.c:581:16: warning: incompatible pointer types returning 's7_pointer *'
      (aka 'struct s7_cell **') from a function with result type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        return s7_return_value;
               ^~~~~~~~~~~~~~~
               *
s4pd.c:584:21: warning: incompatible pointer types assigning to 's7_pointer *'
      (aka 'struct s7_cell **') from 's7_pointer' (aka 'struct s7_cell *')
      [-Wincompatible-pointer-types]
    s7_return_value = s7_make_real(x->s7, values_vector[ arr_index ].w_float);
                    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s4pd.c:585:12: warning: incompatible pointer types returning 's7_pointer *'
      (aka 'struct s7_cell **') from a function with result type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
    return s7_return_value;
           ^~~~~~~~~~~~~~~
           *
s4pd.c:594:17: warning: incompatible pointer types initializing 's7_pointer *'
      (aka 'struct s7_cell **') with an expression of type 's7_pointer'
      (aka 'struct s7_cell *') [-Wincompatible-pointer-types]
    s7_pointer *s7_return_value = s7_make_boolean(x->s7, false);
                ^                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s4pd.c:606:20: warning: assigning to 'char *' from 'const char *' discards
      qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        array_name = s7_symbol_name( s7_car(args) );
                   ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s4pd.c:609:16: warning: incompatible pointer types returning 's7_pointer *'
      (aka 'struct s7_cell **') from a function with result type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        return s7_return_value;
               ^~~~~~~~~~~~~~~
               *
s4pd.c:615:16: warning: incompatible pointer types returning 's7_pointer *'
      (aka 'struct s7_cell **') from a function with result type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        return s7_return_value;
               ^~~~~~~~~~~~~~~
               *
s4pd.c:621:16: warning: incompatible pointer types returning 's7_pointer *'
      (aka 'struct s7_cell **') from a function with result type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        return s7_return_value;
               ^~~~~~~~~~~~~~~
               *
s4pd.c:628:16: warning: incompatible pointer types returning 's7_pointer *'
      (aka 'struct s7_cell **') from a function with result type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        return s7_return_value;
               ^~~~~~~~~~~~~~~
               *
s4pd.c:629:44: warning: incompatible pointer types passing 't_int *'
      (aka 'long *') to parameter of type 'int *' [-Wincompatible-pointer-types]
    }else if (!garray_getfloatwords(array, &num_points, &values_vector)){
                                           ^~~~~~~~~~~
/Applications/Studio/Pd-0.51-4.app/Contents/Resources/src/m_pd.h:678:51: note:
      passing argument to parameter 'size' here
EXTERN int garray_getfloatwords(t_garray *x, int *size, t_word **vec);
                                                  ^
s4pd.c:631:16: warning: incompatible pointer types returning 's7_pointer *'
      (aka 'struct s7_cell **') from a function with result type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        return s7_return_value;
               ^~~~~~~~~~~~~~~
               *
s4pd.c:636:16: warning: incompatible pointer types returning 's7_pointer *'
      (aka 'struct s7_cell **') from a function with result type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        return s7_return_value;
               ^~~~~~~~~~~~~~~
               *
s4pd.c:641:21: warning: incompatible pointer types assigning to 's7_pointer *'
      (aka 'struct s7_cell **') from 's7_pointer' (aka 'struct s7_cell *')
      [-Wincompatible-pointer-types]
    s7_return_value = s7_make_real(x->s7, value);
                    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
s4pd.c:642:12: warning: incompatible pointer types returning 's7_pointer *'
      (aka 'struct s7_cell **') from a function with result type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
    return s7_return_value;
           ^~~~~~~~~~~~~~~
           *
s4pd.c:666:34: warning: incompatible pointer types passing 's7_pointer'
      (aka 'struct s7_cell *') to parameter of type 's7_pointer *' (aka
      'struct s7_cell **'); take the address with &
      [-Wincompatible-pointer-types]
        err = s7_obj_to_atom(s7, s7_out_val, &output_atom);
                                 ^~~~~~~~~~
                                 &
s4pd.c:316:47: note: passing argument to parameter 's7_obj' here
int s7_obj_to_atom(s7_scheme *s7, s7_pointer *s7_obj, t_atom *atom){
                                              ^
s4pd.c:678:34: warning: incompatible pointer types passing 's7_pointer'
      (aka 'struct s7_cell *') to parameter of type 's7_pointer *' (aka
      'struct s7_cell **'); take the address with &
      [-Wincompatible-pointer-types]
        err = s7_obj_to_atom(s7, s7_out_val, &output_atom);
                                 ^~~~~~~~~~
                                 &
s4pd.c:316:47: note: passing argument to parameter 's7_obj' here
int s7_obj_to_atom(s7_scheme *s7, s7_pointer *s7_obj, t_atom *atom){
                                              ^
s4pd.c:690:21: warning: incompatible pointer types initializing 's7_pointer *'
      (aka 'struct s7_cell **') with an expression of type 's7_pointer'
      (aka 'struct s7_cell *') [-Wincompatible-pointer-types]
        s7_pointer *first = s7_car(s7_out_val);
                    ^       ~~~~~~~~~~~~~~~~~~
s4pd.c:694:26: warning: incompatible pointer types passing 's7_pointer *'
      (aka 'struct s7_cell **') to parameter of type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        if( s7_is_number(first) || s7_is_boolean(first) ){
                         ^~~~~
                         *
./s7.h:245:30: note: passing argument to parameter 'p' here
bool s7_is_number(s7_pointer p)...
                             ^
s4pd.c:694:50: warning: incompatible pointer types passing 's7_pointer *'
      (aka 'struct s7_cell **') to parameter of type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
        if( s7_is_number(first) || s7_is_boolean(first) ){
                                                 ^~~~~
                                                 *
./s7.h:162:31: note: passing argument to parameter 'x' here
bool s7_is_boolean(s7_pointer x)...
                              ^
s4pd.c:697:36: warning: incompatible pointer types passing 's7_pointer'
      (aka 'struct s7_cell *') to parameter of type 's7_pointer *'
      (aka 'struct s7_cell **') [-Wincompatible-pointer-types]
                s7_obj_to_atom(s7, s7_list_ref(s7, s7_out_val, i), &out_...
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s4pd.c:316:47: note: passing argument to parameter 's7_obj' here
int s7_obj_to_atom(s7_scheme *s7, s7_pointer *s7_obj, t_atom *atom){
                                              ^
s4pd.c:706:36: warning: incompatible pointer types passing 's7_pointer'
      (aka 'struct s7_cell *') to parameter of type 's7_pointer *'
      (aka 'struct s7_cell **') [-Wincompatible-pointer-types]
                s7_obj_to_atom(s7, s7_list_ref(s7, s7_out_val, i), &out_...
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s4pd.c:316:47: note: passing argument to parameter 's7_obj' here
int s7_obj_to_atom(s7_scheme *s7, s7_pointer *s7_obj, t_atom *atom){
                                              ^
s4pd.c:721:25: warning: incompatible pointer types initializing 's7_pointer *'
      (aka 'struct s7_cell **') with an expression of type 's7_pointer'
      (aka 'struct s7_cell *') [-Wincompatible-pointer-types]
            s7_pointer *item = s7_vector_ref(s7, s7_out_val, i);
                        ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s4pd.c:722:30: warning: incompatible pointer types passing 's7_pointer *'
      (aka 'struct s7_cell **') to parameter of type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
            if( s7_is_number(item) || s7_is_boolean(item)){
                             ^~~~
                             *
./s7.h:245:30: note: passing argument to parameter 'p' here
bool s7_is_number(s7_pointer p)...
                             ^
s4pd.c:722:53: warning: incompatible pointer types passing 's7_pointer *'
      (aka 'struct s7_cell **') to parameter of type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
            if( s7_is_number(item) || s7_is_boolean(item)){
                                                    ^~~~
                                                    *
./s7.h:162:31: note: passing argument to parameter 'x' here
bool s7_is_boolean(s7_pointer x)...
                              ^
s4pd.c:659:15: warning: unused variable 'msg_sym' [-Wunused-variable]
    t_symbol *msg_sym;  // the first symbol for the outlet_anything message
              ^
s4pd.c:834:5: error: implicit declaration of function 'close' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
    close(filedesc);
    ^
s4pd.c:883:17: warning: incompatible pointer types initializing 's7_pointer *'
      (aka 'struct s7_cell **') with an expression of type 's7_pointer'
      (aka 'struct s7_cell *') [-Wincompatible-pointer-types]
    s7_pointer *s7_cb_handle = s7_cadr(args);
                ^              ~~~~~~~~~~~~~
s4pd.c:884:36: warning: incompatible pointer types passing 's7_pointer *'
      (aka 'struct s7_cell **') to parameter of type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
    cb_handle_str = s7_symbol_name(s7_cb_handle);
                                   ^~~~~~~~~~~~
                                   *
./s7.h:363:39: note: passing argument to parameter 'p' here
const char *s7_symbol_name(s7_pointer p);                                   /...
                                      ^
s4pd.c:884:19: warning: assigning to 'char *' from 'const char *' discards
      qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    cb_handle_str = s7_symbol_name(s7_cb_handle);
                  ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s4pd.c:931:17: warning: incompatible pointer types initializing 's7_pointer *'
      (aka 'struct s7_cell **') with an expression of type 's7_pointer'
      (aka 'struct s7_cell *') [-Wincompatible-pointer-types]
    s7_pointer *s7_args = s7_nil(x->s7);
                ^         ~~~~~~~~~~~~~
s4pd.c:932:69: warning: incompatible pointer types passing 's7_pointer *'
      (aka 'struct s7_cell **') to parameter of type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
    s7_args = s7_cons(x->s7, s7_make_symbol(x->s7, handle->s_name), s7_args);
                                                                    ^~~~~~~
                                                                    *
./s7.h:176:60: note: passing argument to parameter 'b' here
  ...s7_cons(s7_scheme *sc, s7_pointer a, s7_pointer b);               /* (co...
                                                     ^
s4pd.c:932:13: warning: incompatible pointer types assigning to 's7_pointer *'
      (aka 'struct s7_cell **') from 's7_pointer' (aka 'struct s7_cell *')
      [-Wincompatible-pointer-types]
    s7_args = s7_cons(x->s7, s7_make_symbol(x->s7, handle->s_name), s7_args);
            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s4pd.c:933:71: warning: incompatible pointer types passing 's7_pointer *'
      (aka 'struct s7_cell **') to parameter of type 's7_pointer'
      (aka 'struct s7_cell *'); dereference with *
      [-Wincompatible-pointer-types]
  ...s7_name_to_value(x->s7, "s4pd-execute-callback"), s7_args);
                                                       ^~~~~~~
                                                       *
s4pd.c:795:59: note: passing argument to parameter 'args' here
void s4pd_s7_call(t_s4pd *x, s7_pointer funct, s7_pointer args){
                                                          ^
65 warnings and 3 errors generated.
make: *** [s4pd.o] Error 1

shakfu avatar Nov 24 '21 10:11 shakfu

Here's the solution:

add #include <unistd.h> for close() to s4pd.c:

diff --git a/s4pd.c b/s4pd.c
index dd46ec0..70b437c 100644
--- a/s4pd.c
+++ b/s4pd.c
@@ -3,6 +3,7 @@
 #include "s7.h"
 #include "time.h"
 #include <stdlib.h>
+#include <unistd.h> // for close

 #define MAX_OUTLETS 32
 #define MAX_ATOMS_PER_MESSAGE 1024

shakfu avatar Nov 24 '21 14:11 shakfu

Thanks Shakfu, I'm honestly not much of a C dev, so can anyone weigh in on whether this is safe for other compilers and platforms to add or does it need to be in an #ifdef?

BTW. I do plan to go through my mess of warnings and get it clean later as I would like to set things up so that s4pd is easy to extend at a C level. :-)

iainctduncan avatar Nov 24 '21 15:11 iainctduncan