UASM icon indicating copy to clipboard operation
UASM copied to clipboard

Build failure on newer clang

Open N-R-K opened this issue 1 year ago • 3 comments

uasm 2.56.2 currently fails to build on newer clang due to it being more strict about obsolete and/or removed C features ^0.

Bug report about it on gentoo/guru: https://bugs.gentoo.org/927802

I've currently patched the source to fix these errors. The patch can be found here: build-fix.patch. I can open a pull-request if there's interest in merging these.

These errors can be reproduced by running the following with a new clang (I'm using 16.0.6):

$ make -j8 -f gccLinux64.mak CC="clang" CFLAGS="-w -march=native -O2 -flto" LDFLAGS='${CFLAGS}'

There were also a huge ton of warnings, but I haven't touched them since they didn't result in build error.

N-R-K avatar Apr 01 '24 17:04 N-R-K

There are errors on all Clangs (here 3.8 and 5.0), not only new. Not to mention GCC, that doesn't have '-fwritable-strings' since GCC-4.

$ make -f Makefile_Linux CC=clang

clang -D __UNIX__ -c -IH -D __UNIX__ -DNDEBUG -O2 -ansi -funsigned-char -fwritable-strings -o GccUnixR/dbgcv.o dbgcv.c
clang -D __UNIX__ -c -IH -D __UNIX__ -DNDEBUG -O2 -ansi -funsigned-char -fwritable-strings -o GccUnixR/invoke.o invoke.c
In file included from invoke.c:15:
In file included from H/parser.h:59:
H/instruct.h:1241:10: warning: '/*' within block comment [-Wcomment]
/* #if 0 /* v2.09: added, inactive ( not supported by ML64 v8,9,10 ) */
         ^
In file included from dbgcv.c:14:

(...)

In file included from dbgcv.c:24:
H/picohash.h:262:1: error: unknown type name 'inline'
inline void _picohash_md5_init(_picohash_md5_ctx_t* ctx)
^
H/picohash.h:262:8: error: expected identifier or '('
inline void _picohash_md5_init(_picohash_md5_ctx_t* ctx)
       ^
H/picohash.h:273:1: error: unknown type name 'inline'
inline void _picohash_md5_update(_picohash_md5_ctx_t* ctx, const void* data, size_t size)
^
H/picohash.h:273:8: error: expected identifier or '('
inline void _picohash_md5_update(_picohash_md5_ctx_t* ctx, const void* data, size_t size)
       ^
H/picohash.h:307:1: error: unknown type name 'inline'
inline void _picohash_md5_final(_picohash_md5_ctx_t* ctx, void* _digest)
^
H/picohash.h:307:8: error: expected identifier or '('
inline void _picohash_md5_final(_picohash_md5_ctx_t* ctx, void* _digest)
       ^
H/picohash.h:364:8: invoke.cerror: unknown type name 'inline'
static inline uint32_t _picohash_sha1_rol32(uint32_t number, uint8_t bits)
       ^
H/picohash.h:364:23: error: expected ';' after top level declarator
static inline uint32_t _picohash_sha1_rol32(uint32_t number, uint8_t bits)
                      ^

tansy avatar Apr 02 '24 14:04 tansy

@tansy You're using Makefile_Linux which according to the git log has not been updated in 6 years. I'm using gccLinux64.mak which doesn't enable -fwriteable-strings nor -ansi (which is causing inline errors).

N-R-K avatar Apr 02 '24 14:04 N-R-K

You're using Makefile_Linux which according to the git log has not been updated in 6 years

Where does it say so? I use Makefile that is, according to name, suitable to my system. And modification time says 16.03.2022. How am I suppose to know that the `Makefile_Linux' is not for Linux? Maybe they all should be renamed? To Makefile-OS-compiler, or moved to build/ directory and named accordingly.


Now it fails at _MAX_PATH, not to mention other things:

dbgcv.c:1251:8: warning: incompatible pointer types returning 'CV_SECTION *' (aka 'struct CV_SECTION *') from a function with result type
      'uint_8 *' (aka 'unsigned char *') [-Wincompatible-pointer-types]
        return(cv->section);
              ^~~~~~~~~~~~~
dbgcv.c:1258:9: warning: 'BUFSIZ' macro redefined [-Wmacro-redefined]
#define BUFSIZ 1024*4
        ^
/usr/include/stdio.h:128:10: note: previous definition is here
# define BUFSIZ _IO_BUFSIZ
         ^
dbgcv.c:1348:25: error: use of undeclared identifier '_MAX_PATH'
                cv.currdir = LclAlloc(_MAX_PATH * 4);
                                      ^
dbgcv.c:1349:3: warning: implicit declaration of function '_getcwd' is invalid in C99 [-Wimplicit-function-declaration]
                _getcwd(cv.currdir, _MAX_PATH * 4);
                ^
dbgcv.c:1349:23: error: use of undeclared identifier '_MAX_PATH'
                _getcwd(cv.currdir, _MAX_PATH * 4);
                                    ^
dbgcv.c:1528:32: warning: passing 'char *' to parameter of type 'uint_8 *' (aka 'unsigned char *') converts between pointers to integer
      types with different sign [-Wpointer-sign]
                cv.ps = SetPrefixName(cv.ps, name, len);
                                             ^~~~
dbgcv.c:120:42: note: passing argument to parameter 'name' here
uint_8* SetPrefixName(uint_8* p, uint_8* name, int len)
                                         ^
dbgcv.c:1558:5: warning: assigning to 'char *' from 'unsigned char [1]' converts between pointers to integer types with different sign
      [-Wpointer-sign]
                s = EnvBlock->rgsz;
                  ^ ~~~~~~~~~~~~~~
dbgcv.c:1571:16: error: use of undeclared identifier '_pgmptr'
                len = strlen(_pgmptr) + 1;
                             ^
dbgcv.c:1572:17: error: use of undeclared identifier '_pgmptr'
                s = strcpy(s, _pgmptr) + len;
                              ^

GCC fails in the same spot either.

tansy avatar Apr 02 '24 15:04 tansy