githwxi / ATS-Postiats

ATS2: Unleashing the Potentials of Types and Templates
www.ats-lang.org
Other
353 stars 52 forks source link

Warning when using lstat #236

Closed antoyo closed 5 years ago

antoyo commented 5 years ago

Hi. When using the lstat function from the file libats/libc/SATS/sys/stat.sats, I get the following warning:

/src/main.dats: In function 'symlink_exists_199':
/usr/lib/ats2-postiats-0.3.11/libats/libc/CATS/sys/stat.cats:74:34: warning: implicit declaration of function 'lstat'; did you mean 'fstat'? [-Wimplicit-function-declaration]
 #define atslib_libats_libc_lstat lstat
                                  ^~~~~
/usr/lib/ats2-postiats-0.3.11/ccomp/runtime/pats_ccomp_instrset.h:276:37: note: in definition of macro 'ATSINSmove'
 #define ATSINSmove(tmp, val) (tmp = val)
                                     ^~~
/src/main.dats:189:20: note: in expansion of macro 'atslib_libats_libc_lstat'
         val error = $STAT.lstat(filename, stat)
                    ^~~~~~~~~~~~~~~~~~~~~~~~

I guess it needs to be declared somewhere in the standard library. Thanks to fix this.

githwxi commented 5 years ago

It seems that you need -D_GNU_SOURCE or -D_BSD_SOURCE for lstat.

antoyo commented 5 years ago

Thanks.