akiradeveloper / dm-writeboost

Log-structured Caching for Linux
GNU General Public License v2.0
120 stars 18 forks source link

uninitialized_var macro was removed in linux-5.9 #219

Closed meke closed 3 years ago

meke commented 3 years ago

uninitialized_var macro was removed in linux-5.9.

tested on linux-5.9, but I haven't tested it in other environments

  CC [M]  /home/meke/trunk/pkgs/kernel/BUILD/kernel-5.9/dm-writeboost-2.2.12/src/dm-writeboost-metadata.o
/home/meke/trunk/pkgs/kernel/BUILD/kernel-5.9/dm-writeboost-2.2.12/src/dm-writeboost-metadata.c: In function 'infer_last_writeback_id':
/home/meke/trunk/pkgs/kernel/BUILD/kernel-5.9/dm-writeboost-2.2.12/src/dm-writeboost-metadata.c:984:9: warning: parameter names (without types) in function declaration
  984 |  struct superblock_record_device uninitialized_var(record);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
/home/meke/trunk/pkgs/kernel/BUILD/kernel-5.9/dm-writeboost-2.2.12/src/dm-writeboost-metadata.c:985:32: error: 'record' undeclared (first use in this function); did you mean 'record_id'?
  985 |  err = read_superblock_record(&record, wb);
      |                                ^~~~~~
      |                                record_id
/home/meke/trunk/pkgs/kernel/BUILD/kernel-5.9/dm-writeboost-2.2.12/src/dm-writeboost-metadata.c:985:32: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [scripts/Makefile.build:283: /home/meke/trunk/pkgs/kernel/BUILD/kernel-5.9/dm-writeboost-2.2.12/src/dm-writeboost-metadata.o] Error 1
piso77 commented 3 years ago

No, please no, don't reintroduce that macro:

https://www.mail-archive.com/b43-dev@lists.infradead.org/msg04356.html

meke commented 3 years ago

dm-writeboost also supports old environments, I tried to reduce the impact as much as possible.

akiradeveloper commented 3 years ago

As of 1.0.0 this macro is already used but I don't remember why I wrote like this. Maybe, it is just to suppress compiler warning but maybe not.

I have a script to build this module with lot of old kernels from 3.16. If I remove this macro, the compiler says ok without warning so it's not about kernel but compiler flags.

Thanks to two PRs. My opinion is resurrecting the deprecated macro as @meke suggests looks non-sense to me but going straight to the code should-be as @piso77 suggests also looks too extreme to me because I have no confidence on the consequence of doing so.

Another solution is in the middle: for kernel <= 5.8 we continue to use uninitialized_var and for newer versions use uninitialized_var(x) x. What do you think?

meke commented 3 years ago

I referred to this article for uninitialized_var

https://bugs.ruby-lang.org/issues/3018 (sorry japanese)

This macro is a process to clear the warning of the compiler. If you don't get a warning in the oldest supported environment, you can remove it.

I redefined the macro for the old compiler, but I think it should be removed if it's not needed Which OS should be the minimum standard?

akiradeveloper commented 3 years ago

Sorry, I will drop this PR. Thanks you as always.