zertovitch / gid

GID (Generic Image Decoder): a standalone, portable generic Ada package for decoding images
https://gen-img-dec.sourceforge.io/
23 stars 3 forks source link

warnings, some involving ada 2022 #1

Open johnperry-math opened 4 days ago

johnperry-math commented 4 days ago

Hi! I'm using GID in a project, and when I alr build with pragma Ada_2022; in my source files, I get some warnings:

Array aggregate notation

project.adb:65:07: warning: array aggregate using () is an obsolescent syntax, use [] instead [-gnatwj]                                                                                   
project.adb:65:07: warning: in instantiation at gid-decoding_png.adb:1126 [-gnatwj]
project.adb:65:07: warning: in instantiation at gid-decoding_png.adb:1466 [-gnatwj]
project.adb:65:07: warning: in instantiation at gid.adb:136 [-gnatwj]

It's easy to eliminate on my end by adding pragma Ada_12 (GID); to my code, but would you consider adding pragma Ada_2012 to these source files?

(whoops, I thought that compiled when I added it on my end)

Unused variables

gid-decoding_png.adb:743:09: warning: variable "slide" is never read and never assigned [-gnatwu]
gid-decoding_png.adb:746:09: warning: variable "crc32val" is never read and never assigned [-gnatwu]

I haven't looked into these, but I find it surprising that crc32val is unused. I don't know if you think it worth eliminating them, but it seems a good idea to report it.

I enjoy the package for now, by the way!

zertovitch commented 16 hours ago

About the first bunch of warnings, perhaps you don't get them when you remove pragma Ada_2022; ? Or does it prevent you to use the 2022 syntax elsewhere? Another way is to remove the -gnatwj switch, using -gnatwJ. Adding pragma Ada_2012 ? Really not my preferred option...

Regarding the second batch, it is a GNAT bug. Try commenting out slide for instance...