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

Weird errors on alternative build

Open shakfu opened this issue 11 months ago • 5 comments

In my fork, I've moved things around a bit to enable a regular Max package type build with max-sdk-base as a submodule.

On my first attempt to compile, I got the following error:

~/src/scheme-for-max/source/projects/s4m/s4m-grid.c:302:60: error: cannot take the address of an rvalue of type 't_object *' (aka 'struct object *')
    t_max_err err = hashtab_lookup(s4m_arrays, array_name, &(t_object *)array);
                                                           ^~~~~~~~~~~~~~~~~~

I think this is a valid error, it should be (consistent with this similar case):

    t_max_err err = hashtab_lookup(s4m_arrays, array_name, (t_object **)&array);

If the above is fixed, then I get a bunch of errors and even more warnings (which are omitted to reduce the noise):

                             ^
~/src/scheme-for-max/source/projects/s4m/s4m.c:2087:56: error: cannot take the address of an rvalue of type 't_object *' (aka 'struct object *')
        hashtab_lookup(s4m_arrays, gensym(array_name), &(t_object *)array);
                                                       ^~~~~~~~~~~~~~~~~~
// ... (lots of warnings)
                            ^
~/src/scheme-for-max/source/projects/s4m/s4m.c:2316:9: error: void function 's4m_bang' should not return a value [-Wreturn-type]
        return defer(x, s4m_callback_bang, NULL, 1, ap);
        ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

// ... (lots of warnings)
                            ^
~/src/scheme-for-max/source/projects/s4m/s4m.c:2360:9: error: void function 's4m_int' should not return a value [-Wreturn-type]
        return defer(x, s4m_callback_int, NULL, 2, ap);
        ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


~/src/scheme-for-max/source/projects/s4m/s4m.c:2427:9: error: void function 's4m_float' should not return a value [-Wreturn-type]
        return defer(x, s4m_callback_float, NULL, 2, ap);
        ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


                            ^
~/src/scheme-for-max/source/projects/s4m/s4m.c:2508:13: error: void function 's4m_list' should not return a value [-Wreturn-type]
            return defer(x, s4m_callback_list, s, argc + 1, ap);
            ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


                            ^
~/src/scheme-for-max/source/projects/s4m/s4m.c:2584:9: error: void function 's4m_eval_string' should not return a value [-Wreturn-type]
        return defer(x, s4m_s7_eval_string, s, 0, NULL);
        ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                            ^
~/src/scheme-for-max/source/projects/s4m/s4m.c:2816:17: error: void function 's4m_msg' should not return a value [-Wreturn-type]
                return defer(x, s4m_callback_msg_inlet_0, s, argc, argv);
                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                            ^
~/src/scheme-for-max/source/projects/s4m/s4m.c:2818:17: error: void function 's4m_msg' should not return a value [-Wreturn-type]
                return defer(x, s4m_callback_msg_inlet_1, s, argc, argv);
                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                            ^
~/src/scheme-for-max/source/projects/s4m/s4m.c:2820:17: error: void function 's4m_msg' should not return a value [-Wreturn-type]
                return defer(x, s4m_callback_msg_inlet_2, s, argc, argv);
                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                            ^
~/src/scheme-for-max/source/projects/s4m/s4m.c:2822:17: error: void function 's4m_msg' should not return a value [-Wreturn-type]
                return defer(x, s4m_callback_msg_inlet_3, s, argc, argv);
                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                            ^
~/src/scheme-for-max/source/projects/s4m/s4m.c:2824:17: error: void function 's4m_msg' should not return a value [-Wreturn-type]
                return defer(x, s4m_callback_msg_inlet_4, s, argc, argv);
                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                            ^
~/src/scheme-for-max/source/projects/s4m/s4m.c:2826:17: error: void function 's4m_msg' should not return a value [-Wreturn-type]
                return defer(x, s4m_callback_msg_inlet_5, s, argc, argv);
                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                            ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
133 warnings and 20 errors generated.
make[3]: *** [source/projects/s4m/CMakeFiles/s4m.dir/s4m.c.o] Error 1
make[2]: *** [source/projects/s4m/CMakeFiles/s4m.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [build] Error 2

The first of this batch is similar to the initial error and easily fixable but the others, well it looks like there's a general pattern of widely using return defer(..) and return schedule(...) in void functions.

Do you have any insight about what may be the issue here?

shakfu avatar Jul 29 '23 19:07 shakfu