Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

fix compile error: warning as error #135

Closed
wants to merge 1 commit into from
Closed

Conversation

netcan
Copy link

@netcan netcan commented Jun 17, 2024

No description provided.

@cmuellner
Copy link

@gjtorikian, is there anything specific that is blocking this PR from landing?
The linter error in the CI is a false positive (it complains about code that has not been changed in this PR).

This issue blocks asciidoc installations (asciidoc-mathematical depends on this package).

The error message while building is:

mathematical.c: In function ‘process’:
mathematical.c:138:77: error: passing argument 2 of ‘cairo_svg_surface_create_for_stream’ makes pointer from integer without a cast [-Wint-conversion]
  138 |     surface = cairo_svg_surface_create_for_stream (cairoSvgSurfaceCallback, self, width_pt, height_pt);
      |                                                                             ^~~~
      |                                                                             |
      |                                                                             VALUE {aka long unsigned int}
In file included from ./mathematical.h:18:
/usr/include/cairo/cairo-svg.h:102:57: note: expected ‘void *’ but argument is of type ‘VALUE’ {aka ‘long unsigned int’}
  102 |                                      void              *closure,
      |                                      ~~~~~~~~~~~~~~~~~~~^~~~~~~
mathematical.c:149:91: error: passing argument 3 of ‘cairo_surface_write_to_png_stream’ makes pointer from integer without a cast [-Wint-conversion]
  149 |     cairo_surface_write_to_png_stream (cairo_get_target (cairo), cairoPngSurfaceCallback, self);
      |                                                                                           ^~~~
      |                                                                                           |
      |                                                                                           VALUE {aka long unsigned int}
In file included from /home/cm/.local/share/gem/ruby/gems/mathematical-1.6.18/ext/mathematical/lasem/src/lsmcairo.h:28,
                 from /home/cm/.local/share/gem/ruby/gems/mathematical-1.6.18/ext/mathematical/lasem/src/lsm.h:29,
                 from ./mathematical.h:11:
/usr/include/cairo/cairo.h:2606:58: note: expected ‘void *’ but argument is of type ‘VALUE’ {aka ‘long unsigned int’}
 2606 |                                    void                 *closure);
      |                                    ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
mathematical.c: In function ‘MATHEMATICAL_process’:
mathematical.c:232:40: error: passing argument 2 of ‘rb_rescue’ makes integer from pointer without a cast [-Wint-conversion]
  232 |     output = rb_rescue(process_helper, args, process_rescue, rb_Input);
      |                                        ^~~~
      |                                        |
      |                                        VALUE * {aka long unsigned int *}
In file included from /usr/include/ruby/ruby.h:41:
/usr/include/ruby/internal/iterator.h:364:47: note: expected ‘VALUE’ {aka ‘long unsigned int’} but argument is of type ‘VALUE *’ {aka ‘long unsigned int *’}
  364 | VALUE rb_rescue(VALUE (*b_proc)(VALUE), VALUE data1, VALUE (*r_proc)(VALUE, VALUE), VALUE data2);
      |                                         ~~~~~~^~~~~
mathematical.c:256:40: error: passing argument 2 of ‘rb_rescue’ makes integer from pointer without a cast [-Wint-conversion]
  256 |       hash = rb_rescue(process_helper, args, process_rescue, math);
      |                                        ^~~~
      |                                        |
      |                                        VALUE * {aka long unsigned int *}
/usr/include/ruby/internal/iterator.h:364:47: note: expected ‘VALUE’ {aka ‘long unsigned int’} but argument is of type ‘VALUE *’ {aka ‘long unsigned int *’}
  364 | VALUE rb_rescue(VALUE (*b_proc)(VALUE), VALUE data1, VALUE (*r_proc)(VALUE, VALUE), VALUE data2);
      |                                         ~~~~~~^~~~~
mathematical.c:265:12: error: assignment to ‘VALUE’ {aka ‘long unsigned int’} from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
  265 |     output = NULL;
      |            ^

Please let me know if anything can be done to merge this faster.

@cmuellner
Copy link

cmuellner commented Aug 13, 2024

Workaround for people that land here and don't know what to do:

  • Clone this repository
  • Apply this patch
  • gem build mathematical.gemspec
  • gem install ./mathematical-1.6.18.gem

This was all needed to get the AsciiDoc stack installed and working on Fedora 40.

@4e554c4c
Copy link
Collaborator

The casts in #133 look more sound

@cmuellner
Copy link

The casts in #133 look more sound

I don't see why they are not equivalent.
Further, #133 includes two unrelated changes (gitignore and fixes for the *test.rb files).
But anyway, I'm fine with any of the PRs landing.

@4e554c4c
Copy link
Collaborator

closed in favor of #136. feel free to open another PR if this does not resolve the issue.

@4e554c4c 4e554c4c closed this Aug 14, 2024
@cmuellner
Copy link

Works for me! Thanks!

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

Successfully merging this pull request may close these issues.

3 participants