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

Compiler warning under gcc 11.3.0 ubuntu-22.04 #957

Open
mvl22 opened this issue Nov 14, 2022 · 3 comments
Open

Compiler warning under gcc 11.3.0 ubuntu-22.04 #957

mvl22 opened this issue Nov 14, 2022 · 3 comments

Comments

@mvl22
Copy link

mvl22 commented Nov 14, 2022

make -j on ubuntu-22.04 (gcc version 11.3.0) includes output:

g++  -L/usr/local/lib -g -Wall -Wshadow -Wsign-compare -Wextra -Wunreachable-code -Wuninitialized -Wshadow -O3 -DNDEBUG  -std=c++11 -o tippecanoe-enumerate enumerate.o  -lsqlite3
tile.cpp: In function ‘bool find_common_edges(std::vector<partial>&, int, int, double, int, double)’:
tile.cpp:751:140: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘long int:40’ [-Wformat=]
  751 |                                                                         fprintf(stderr, "Internal error: polygon edge lookup failed for %lld,%lld to %lld,%lld or %lld,%lld to %lld,%lld\n", left[0].x, left[0].y, left[1].x, left[1].y, right[0].x, right[0].y, right[1].x, right[1].y);
      |                                                                                                                                         ~~~^
      |                                                                                                                                            |
      |                                                                                                                                            long long int
tile.cpp:751:145: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 4 has type ‘long int:40’ [-Wformat=]
  751 |                                                                         fprintf(stderr, "Internal error: polygon edge lookup failed for %lld,%lld to %lld,%lld or %lld,%lld to %lld,%lld\n", left[0].x, left[0].y, left[1].x, left[1].y, right[0].x, right[0].y, right[1].x, right[1].y);
      |                                                                                                                                              ~~~^
      |                                                                                                                                                 |
      |                                                                                                                                                 long long int
tile.cpp:751:153: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 5 has type ‘long int:40’ [-Wformat=]
  751 |                                                                         fprintf(stderr, "Internal error: polygon edge lookup failed for %lld,%lld to %lld,%lld or %lld,%lld to %lld,%lld\n", left[0].x, left[0].y, left[1].x, left[1].y, right[0].x, right[0].y, right[1].x, right[1].y);
      |                                                                                                                                                      ~~~^
      |                                                                                                                                                         |
      |                                                                                                                                                         long long int
tile.cpp:751:158: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 6 has type ‘long int:40’ [-Wformat=]
  751 |                                                                         fprintf(stderr, "Internal error: polygon edge lookup failed for %lld,%lld to %lld,%lld or %lld,%lld to %lld,%lld\n", left[0].x, left[0].y, left[1].x, left[1].y, right[0].x, right[0].y, right[1].x, right[1].y);
      |                                                                                                                                                           ~~~^
      |                                                                                                                                                              |
      |                                                                                                                                                              long long int
tile.cpp:751:166: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 7 has type ‘long int:40’ [-Wformat=]
  751 |                                                                         fprintf(stderr, "Internal error: polygon edge lookup failed for %lld,%lld to %lld,%lld or %lld,%lld to %lld,%lld\n", left[0].x, left[0].y, left[1].x, left[1].y, right[0].x, right[0].y, right[1].x, right[1].y);
      |                                                                                                                                                                   ~~~^
      |                                                                                                                                                                      |
      |                                                                                                                                                                      long long int
tile.cpp:751:171: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 8 has type ‘long int:40’ [-Wformat=]
  751 |                                                                         fprintf(stderr, "Internal error: polygon edge lookup failed for %lld,%lld to %lld,%lld or %lld,%lld to %lld,%lld\n", left[0].x, left[0].y, left[1].x, left[1].y, right[0].x, right[0].y, right[1].x, right[1].y);
      |                                                                                                                                                                        ~~~^
      |                                                                                                                                                                           |
      |                                                                                                                                                                           long long int
tile.cpp:751:179: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 9 has type ‘long int:40’ [-Wformat=]
  751 |                                                                         fprintf(stderr, "Internal error: polygon edge lookup failed for %lld,%lld to %lld,%lld or %lld,%lld to %lld,%lld\n", left[0].x, left[0].y, left[1].x, left[1].y, right[0].x, right[0].y, right[1].x, right[1].y);
      |                                                                                                                                                                                ~~~^
      |                                                                                                                                                                                   |
      |                                                                                                                                                                                   long long int
tile.cpp:751:184: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 10 has type ‘long int:40’ [-Wformat=]
  751 |                                                                         fprintf(stderr, "Internal error: polygon edge lookup failed for %lld,%lld to %lld,%lld or %lld,%lld to %lld,%lld\n", left[0].x, left[0].y, left[1].x, left[1].y, right[0].x, right[0].y, right[1].x, right[1].y);
      |                                                                                                                                                                                     ~~~^
      |                                                                                                                                                                                        |
      |                                                                                                                                                                                        long long int
geometry.cpp: In function ‘drawvec clean_or_clip_poly(drawvec&, int, int, bool)’:
geometry.cpp:301:65: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘long int:40’ [-Wformat=]
  301 |                                                 fprintf(f, "[%lld,%lld]", geom[k].x, geom[k].y);
      |                                                              ~~~^
      |                                                                 |
      |                                                                 long long int
geometry.cpp:301:70: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 4 has type ‘long int:40’ [-Wformat=]
  301 |                                                 fprintf(f, "[%lld,%lld]", geom[k].x, geom[k].y);
      |                                                                   ~~~^
      |                                                                      |
      |                                                                      long long int
geometry.cpp: In function ‘void check_polygon(drawvec&)’:
geometry.cpp:419:68: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘long int:40’ [-Wformat=]
  419 |                                                         printf("%lld,%lld at %lld not in outer ring (%lld to %lld)\n", geom[k].x, geom[k].y, (long long) k, (long long) outer_start, (long long) (outer_start + outer_len));
      |                                                                 ~~~^
      |                                                                    |
      |                                                                    long long int
geometry.cpp:419:73: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘long int:40’ [-Wformat=]
  419 |                                                         printf("%lld,%lld at %lld not in outer ring (%lld to %lld)\n", geom[k].x, geom[k].y, (long long) k, (long long) outer_start, (long long) (outer_start + outer_len));
      |                                                                      ~~~^
      |                                                                         |
      |                                                                         long long int
geometry.cpp: In function ‘drawvec reduce_tiny_poly(drawvec&, int, int, bool*, double*)’:
geometry.cpp:586:56: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 4 has type ‘long int:40’ [-Wformat=]
  586 |                                 fprintf(stderr, "%d/%lld/%lld ", geom[n].op, geom[n].x, geom[n].y);
      |                                                     ~~~^
      |                                                        |
      |                                                        long long int
geometry.cpp:586:61: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 5 has type ‘long int:40’ [-Wformat=]
  586 |                                 fprintf(stderr, "%d/%lld/%lld ", geom[n].op, geom[n].x, geom[n].y);
      |                                                          ~~~^
      |                                                             |
      |                                                             long long int
g++  -L/usr/local/lib -g -Wall -Wshadow -Wsign-compare -Wextra -Wunreachable-code -Wuninitialized -Wshadow -O3 -DNDEBUG  -std=c++11 -o tippecanoe-json-tool jsontool.o jsonpull/jsonpull.o csv.o text.o geojson-loop.o  -lm -lz -lsqlite3 -lpthread
@e-n-f
Copy link
Contributor

e-n-f commented Nov 14, 2022

Thanks, I will look into this in https://github.com/felt/tippecanoe.

@e-n-f
Copy link
Contributor

e-n-f commented Nov 14, 2022

x and y are declared as long long bitfields:

struct draw {
        long long x : 40;
        signed char op;
        long long y : 40;
        signed char necessary;
        …
};

so I would expect them to remain long long for printf purposes, not to be de-promoted to long, but I will add some casts to make gcc happy.

1 similar comment
@e-n-f
Copy link
Contributor

e-n-f commented Nov 14, 2022

x and y are declared as long long bitfields:

struct draw {
        long long x : 40;
        signed char op;
        long long y : 40;
        signed char necessary;
        …
};

so I would expect them to remain long long for printf purposes, not to be de-promoted to long, but I will add some casts to make gcc happy.

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

2 participants