monero icon indicating copy to clipboard operation
monero copied to clipboard

Remove src/platform

Open jeffro256 opened this issue 2 years ago • 2 comments

All the files in src/platform are currently unused and/or unnecessary:

  • mingw/alloca.h: unused throughout project
  • msc/sys/param.h: Justifications by file below
    1. fix_darwin.patch: sys/param.h is well-defined to be included only in OpenBSD environment
    2. int-util.h already handles when sys/param.h is not present and injects its own values
    3. db_drivers/liblmdb/mdb.c is a similar situation: already explicitly handles different platforms
    4. src/crypto/chacha.h uses int-util.h for endianness context
  • msc/alloca.h: unused
  • msc/inline_c.h: unused and not needed. the inline keyword is supported for C99 I believe, and certainly for C11, C14+
  • msc/stdbool.h: stdbool.h is standard since C99, and MSVC has supported it for a long time (~10 years)

There is a high likelihood that I missed some obscure backwards compatibility issue, and because of that I tried my best to do my due diligence, but I'm very open to the possibility that this commit may be too controversial.

jeffro256 avatar Apr 10 '22 06:04 jeffro256

Indeed, AFAI saw, all you said holds.

I am just a bit worried because three files include stdbool.h and maybe removing it from msc/stdbool.h may cause problems. However, as you said, MSVC has supported it for some time and msc/stdbool.h was added to Monero before 2015, so maybe removing it should be fine, unless there are people running old systems? I am not used to Windows though.

Moreover, there are other files in external/miniupnp/miniupnp/ that include sys/param.h that should be looked at,

I am not approving because I don't have a Windows system to test if things are working correctly, although compilation works (since the checks passed). I also don't know about any backwards compatibility.

Also, after those removals, are there any unused #includes that could be removed?

LeoNero avatar Jun 24 '22 18:06 LeoNero

Moreover, there are other files in external/miniupnp/miniupnp/ that include sys/param.h that should be looked at

Do you have any specific examples of things that may cause problems?

Also, after those removals, are there any unused #includes that could be removed?

I don't think so, most of it was unused anyways.

jeffro256 avatar Sep 20 '22 21:09 jeffro256

@tobtoht

jeffro256 avatar Jul 03 '23 00:07 jeffro256