Why does this template work in a single file but not across files? - ats

Consider array.sats:
#include "share/atspre_staload.hats"
fun {a:t#ype} make: (int, a) -> void
array.dats:
#include "share/atspre_staload.hats"
staload "./array.sats"
implement {a} make(n: int, x: a) = ()
and example.dats:
staload Array = "./array.sats"
implement main0() = () where {
val arr = $Array.make<int>(10, 42)
}
These fail to compile with a bunch of template errors:
$ make clean all
rm -fv *_[sd]ats.[co] example
removed 'array_dats.c'
removed 'array_dats.o'
removed 'array_sats.c'
removed 'array_sats.o'
removed 'example_dats.c'
patscc -DATS_MEMALLOC_GCBDW -c array.sats
clang: warning: argument unused during compilation: '-L/usr/local/lib/ats2-postiats-0.3.9/ccomp/atslib/lib' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-L/usr/local/lib/ats2-postiats-0.3.9/ccomp/atslib/lib64' [-Wunused-command-line-argument]
patscc -DATS_MEMALLOC_GCBDW -c array.dats
clang: warning: argument unused during compilation: '-L/usr/local/lib/ats2-postiats-0.3.9/ccomp/atslib/lib' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-L/usr/local/lib/ats2-postiats-0.3.9/ccomp/atslib/lib64' [-Wunused-command-line-argument]
patscc -DATS_MEMALLOC_GCBDW -o example example.dats -lgc
example_dats.c:169:23: error: use of undeclared identifier 'PMVtmpltcstmat'
ATSINSmove_void(tmp1, PMVtmpltcstmat[0](make<S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int))>)(ATSPMVi0nt(10), ATSPMVi0nt(42))) ;
^
example_dats.c:169:46: warning: implicit declaration of function 'S2Eapp' is invalid in C99 [-Wimplicit-function-declaration]
ATSINSmove_void(tmp1, PMVtmpltcstmat[0](make<S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int))>)(ATSPMVi0nt(10), ATSPMVi0nt(42))) ;
^
example_dats.c:169:53: warning: implicit declaration of function 'S2Ecst' is invalid in C99 [-Wimplicit-function-declaration]
ATSINSmove_void(tmp1, PMVtmpltcstmat[0](make<S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int))>)(ATSPMVi0nt(10), ATSPMVi0nt(42))) ;
^
example_dats.c:169:60: error: use of undeclared identifier 'g0int_t0ype'
ATSINSmove_void(tmp1, PMVtmpltcstmat[0](make<S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int))>)(ATSPMVi0nt(10), ATSPMVi0nt(42))) ;
^
example_dats.c:169:41: error: use of undeclared identifier 'make'
ATSINSmove_void(tmp1, PMVtmpltcstmat[0](make<S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int))>)(ATSPMVi0nt(10), ATSPMVi0nt(42))) ;
^
example_dats.c:169:99: error: expected expression
ATSINSmove_void(tmp1, PMVtmpltcstmat[0](make<S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int))>)(ATSPMVi0nt(10), ATSPMVi0nt(42))) ;
^
2 warnings and 4 errors generated.
make: *** [example] Error 1
Meanwhile the same content in a single file compiles and runs without error:
#include "share/atspre_staload.hats"
extern fun {a:t#ype} make: (int, a) -> void
#include "share/atspre_staload.hats"
implement {a} make(n: int, x: a) = ()
implement main0() = () where {
val arr = make<int>(10, 42)
}
What's wrong with the separated code? Very similar code in the $UNSAFE files seems to work fine with templates and with a namespace.

You also need to staload array.dats:
staload Array = "./array.sats"
staload _(*Array*) = "./array.dats"
implement main0() = () where {
val arr = $Array.make<int>(10, 42)
}

Related

Swoole make failed ubuntu16.04

I am trying to install SWOOLE on my Ubuntu-16.04
I tried this sudo pecl install swoole
But am getting a long list of errors(Skipped some lines)
In file included from /tmp/pear/temp/swoole/php_swoole.h:156:0,
from /tmp/pear/temp/swoole/swoole.c:16:
/tmp/pear/temp/swoole/php7_wrapper.h: In function 'sw_zend_is_callable':
/tmp/pear/temp/swoole/php7_wrapper.h:238:5: error: unknown type name 'zend_string'
zend_string *key = NULL;
^
/tmp/pear/temp/swoole/php7_wrapper.h:239:5: warning: passing argument 3 of 'zend_is_callable' from incompatible pointer type [enabled by default]
int ret = zend_is_callable(cb, a, &key);
^
In file included from /usr/include/php5/main/php.h:39:0,
from /tmp/pear/temp/swoole/php_swoole.h:25,
from /tmp/pear/temp/swoole/swoole.c:16:
/usr/include/php5/Zend/zend_API.h:301:20: note: expected 'char **' but argument is of type 'int **'
ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name TSRMLS_DC);
^
In file included from /usr/include/php5/Zend/zend.h:252:0,
from /usr/include/php5/main/php.h:35,
from /tmp/pear/temp/swoole/php_swoole.h:25,
from /tmp/pear/temp/swoole/swoole.c:16:
/tmp/pear/temp/swoole/php7_wrapper.h:240:29: error: request for member 'val' in something not a structure or union
char *tmp = estrndup(key->val, key->len);
^
/usr/include/php5/Zend/zend_alloc.h:78:44: note: in definition of macro 'estrndup'
#define estrndup(s, length) _estrndup((s), (length) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
^
/tmp/pear/temp/swoole/php7_wrapper.h:240:39: error: request for member 'len' in something not a structure or union
char *tmp = estrndup(key->val, key->len);
^
/usr/include/php5/Zend/zend_alloc.h:78:49: note: in definition of macro 'estrndup'
#define estrndup(s, length) _estrndup((s), (length) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
^
In file included from /tmp/pear/temp/swoole/php_swoole.h:156:0,
from /tmp/pear/temp/swoole/swoole.c:16:
/tmp/pear/temp/swoole/php7_wrapper.h: In function 'sw_zend_is_callable_ex':
/tmp/pear/temp/swoole/php7_wrapper.h:248:5: error: unknown type name 'zend_string'
zend_string *key = NULL;
^
/tmp/pear/temp/swoole/php7_wrapper.h:249:5: warning: passing argument 4 of 'zend_is_callable_ex' from incompatible pointer type [enabled by default]
int ret = zend_is_callable_ex(callable, NULL, check_flags, &key, fcc, error);
make: *** [swoole.lo] Error 1
ERROR: `make' failed
I have also tried this
cd swoole-src
./configure
make
Which is also giving the similar errors.
How to solve this? thanks in advance!
EDIT : Added the first Generated ERRORS too

How do you create a map or hashtable with a datatype value?

I feel like I've asked this very question and gotten an answer before, but I'm not able to find that Q&A.
Hashtables and maps as documented in the ATS2 tutorial have undocumented requirements. The big problem is that I can't see figure out those requirements from seeing the errors that result from not providing them.
So for example this string -> datatype map:
#include "share/atspre_staload.hats"
#include "share/atspre_staload_libats_ML.hats"
datatype example = example of (string)
// commented: this doesn't change the error output
//fn fprint_example(out: FILEref, w: example): void = fprint!(out, "(not implemented)")
//overload fprint with fprint_example
local
typedef key = string
and itm = example
staload "libats/ML/SATS/funmap.sats"
in
#include "libats/ML/HATS/myfunmap.hats"
end
val test = myfunmap_nil()
implement main0() = ()
fails to build with these errors:
patscc -DATS_MEMALLOC_GCBDW -o test test.dats -latslib -lgc
test_dats.c:20972:54: warning: implicit declaration of function 'S2Ecst' is invalid in C99 [-Wimplicit-function-declaration]
ATSINSmove(tmp859__1, PMVtmpltcstmat[0](tostrptr_val<S2Ecst(example)>)(arg1)) ;
^
test_dats.c:20972:61: error: use of undeclared identifier 'example'
ATSINSmove(tmp859__1, PMVtmpltcstmat[0](tostrptr_val<S2Ecst(example)>)(arg1)) ;
^
test_dats.c:20972:41: error: use of undeclared identifier 'tostrptr_val'
ATSINSmove(tmp859__1, PMVtmpltcstmat[0](tostrptr_val<S2Ecst(example)>)(arg1)) ;
^
test_dats.c:20972:70: error: expected expression
ATSINSmove(tmp859__1, PMVtmpltcstmat[0](tostrptr_val<S2Ecst(example)>)(arg1)) ;
^
test_dats.c:20972:23: error: use of undeclared identifier 'PMVtmpltcstmat'
ATSINSmove(tmp859__1, PMVtmpltcstmat[0](tostrptr_val<S2Ecst(example)>)(arg1)) ;
^
1 warning and 4 errors generated.
make: *** [test] Error 1
So it seems that a tostrptr_val<example> is unimplemented...
... and at this point, of forming this question, I found prelude/*/tostring where this stuff is implemented. OK. That brought me to
#include "share/atspre_staload.hats"
#include "share/atspre_staload_libats_ML.hats"
datatype example = example of (string)
fn tostrptr_example(ex: example):<!wrt> Strptr1 = $UNSAFE.castvwtp0{Strptr1}("not implemented")
fn tostring_example(ex: example):<> string = "not implemented"
fn fprint_example(out: FILEref, ex: example): void = fprint!(out, tostring_example(ex))
implement tostrptr_val<example> = tostrptr_example
implement tostring_val<example> = tostring_example
implement fprint_val<example> = fprint_example
local
typedef key = string
and itm = example
staload "libats/ML/SATS/funmap.sats"
in
#include "libats/ML/HATS/myfunmap.hats"
end
val test = myfunmap_nil()
implement main0() = ()
which still doesn't compile:
patscc -DATS_MEMALLOC_GCBDW -o test test.dats -latslib -lgc
test_dats.c:20765:31: warning: implicit declaration of function 'fprint_example_5' is invalid in C99 [-Wimplicit-function-declaration]
ATSINSmove_void(tmpret822__1, fprint_example_5(env0, arg1)) ;
^
1 warning generated.
Undefined symbols for architecture x86_64:
"_fprint_example_5", referenced from:
_ATSLIB_056_libats_056_funmap_avltree__funmap_foreach__fwork__123__1 in test_dats-bd83ab.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [test] Error 1
All I can decipher from this is that a single function in /libats/DATS/funmap_avltree.dats is using example in a manner I haven't prepared for.
You need to implement a fprint_val instanace for printing 'example':
implement fprint_val<example>(out, x) = ...

EGlib 2.6.20 does not install (trying to install SCIP)

I am trying to solve an integer linear program using SCIP. The beta version that I require (for exact solving) is given at:
http://scip.zib.de/#exact
As linked there, the source code is at:
http://scip.zib.de/download.php?fname=scip-3.0.0-ex.tgz
I followed the INSTALL file. It requires the installation of EGlib 2.6.20. However, this installation fails during 'make' with the following error:
phani#OptiPlex-9030-AIO ~/EGlib-2.6.20 $ make
make[1]: Entering directory '/home/phani/EGlib-2.6.20'
make[1]: Leaving directory '/home/phani/EGlib-2.6.20'
make[1]: Entering directory '/home/phani/EGlib-2.6.20'
Building include/EGlib.h
Compiling src/eg_bit.c
Compiling src/eg_compare.c
Compiling src/eg_io.c
src/eg_io.c: In function ‘EGioGets’:
src/eg_io.c:618:7: warning: unused variable ‘b’ [-Wunused-variable]
char*b = buf;
^
src/eg_io.c: In function ‘EGioEof’:
src/eg_io.c:648:6: warning: unused variable ‘err’ [-Wunused-variable]
int err;
^
src/eg_io.c: In function ‘EGmvar’:
src/eg_io.c:42:2: warning: second parameter of ‘va_start’ not last named argument [-Wvarargs]
va_start (largs, nind);
^
Compiling src/eg_lpnum.c
Compiling src/eg_net.c
Compiling src/eg_random.c
Compiling src/eg_macros.c
Compiling src/eg_ehash.c
Compiling src/eg_perm_it.c
Compiling src/eg_symtab.c
Compiling src/eg_keytab.c
Compiling src/eg_simula.c
In file included from src/eg_simula.c:25:0:
src/eg_simula.h:227:2: error: unknown type name ‘dbl_EGeHeapCn_t’
dbl_EGeHeapCn_t heap_cn;/**< connector in the heap containing the agent */
^
src/eg_simula.h:240:2: error: unknown type name ‘dbl_EGeHeap_t’
dbl_EGeHeap_t hp; /**< Heap containing events to be processed */
^
src/eg_simula.c: In function ‘EGsimExp’:
src/eg_simula.c:29:30: warning: unused parameter ‘t’ [-Wunused-parameter]
double EGsimExp(const double t, void*const data)
^
src/eg_simula.c: In function ‘EGsimUniform’:
src/eg_simula.c:40:34: warning: unused parameter ‘t’ [-Wunused-parameter]
double EGsimUniform(const double t, void*const data)
^
src/eg_simula.c: In function ‘EGsimNormal’:
src/eg_simula.c:51:33: warning: unused parameter ‘t’ [-Wunused-parameter]
double EGsimNormal(const double t, void*const data)
^
In file included from src/eg_simula.c:25:0:
src/eg_simula.c: In function ‘EGsimNewEvent’:
src/eg_simula.h:277:2: warning: implicit declaration of function ‘dbl_EGeHeapCnInit’ [-Wimplicit-function-declaration]
dbl_EGeHeapCnInit(&(__EGsimA->heap_cn));\
^
src/eg_simula.c:73:2: note: in expansion of macro ‘EGsimSetAgent’
EGsimSetAgent(la,sim->cur_time + gen->gen(sim->cur_time,gen->data));
^
src/eg_simula.c:74:13: error: request for member ‘val’ in something not a structure or union
la->heap_cn.val = la->last_time;
^
src/eg_simula.c:77:12: error: request for member ‘sz’ in something not a structure or union
if(sim->hp.sz == sim->hp.max_sz)
^
src/eg_simula.c:77:26: error: request for member ‘max_sz’ in something not a structure or union
if(sim->hp.sz == sim->hp.max_sz)
^
src/eg_simula.c:78:3: warning: implicit declaration of function ‘dbl_EGeHeapResize’ [-Wimplicit-function-declaration]
dbl_EGeHeapResize(&(sim->hp),sim->hp.sz*2);
^
src/eg_simula.c:78:39: error: request for member ‘sz’ in something not a structure or union
dbl_EGeHeapResize(&(sim->hp),sim->hp.sz*2);
^
src/eg_simula.c:80:9: warning: implicit declaration of function ‘dbl_EGeHeapAdd’ [-Wimplicit-function-declaration]
rval = dbl_EGeHeapAdd(&(sim->hp),&(la->heap_cn));
^
In file included from src/eg_simula.h:47:0,
from src/eg_simula.c:25:
src/eg_simula.c:85:55: error: request for member ‘val’ in something not a structure or union
MESSAGE(EG_SIM_VERBOSE,"new Agent at %lf",la->heap_cn.val);
^
src/eg_macros.h:246:18: note: in definition of macro ‘MESSAGE’
fprintf(stderr,__VA_ARGS__);\
^
In file included from src/eg_simula.h:47:0,
from src/eg_simula.c:25:
src/eg_simula.c: In function ‘EGsim’:
src/eg_simula.c:284:22: warning: implicit declaration of function ‘dbl_EGeHeapGetMin’ [-Wimplicit-function-declaration]
ca = EGcontainerOf(dbl_EGeHeapGetMin(&(sim->hp)), EGsimAgent_t,heap_cn);
^
src/eg_macros.h:134:56: note: in definition of macro ‘EGcontainerOf’
typeof(((__type *)0)->__member) *const __EGcOf_ptr = (__ptr);\
^
src/eg_macros.h:134:55: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
typeof(((__type *)0)->__member) *const __EGcOf_ptr = (__ptr);\
^
src/eg_simula.c:284:8: note: in expansion of macro ‘EGcontainerOf’
ca = EGcontainerOf(dbl_EGeHeapGetMin(&(sim->hp)), EGsimAgent_t,heap_cn);
^
src/eg_simula.c:285:30: error: request for member ‘val’ in something not a structure or union
sim->cur_time = ca->heap_cn.val;
^
src/eg_simula.c:327:17: error: request for member ‘val’ in something not a structure or union
na->heap_cn.val = sim->cur_time + cn->gen(sim->cur_time,cn->data);
^
src/eg_simula.c:328:6: warning: implicit declaration of function ‘dbl_EGeHeapSiftUp’ [-Wimplicit-function-declaration]
dbl_EGeHeapSiftUp(&(sim->hp),&(na->heap_cn));
^
src/eg_simula.c:365:17: error: request for member ‘val’ in something not a structure or union
ca->heap_cn.val = sim->cur_time;
^
src/eg_simula.c:371:17: error: request for member ‘val’ in something not a structure or union
ca->heap_cn.val = sim->cur_time + nn->gen(sim->cur_time,nn->data);
^
src/eg_simula.c:377:17: error: request for member ‘val’ in something not a structure or union
ca->heap_cn.val = DBL_MAX;
^
src/eg_simula.c:381:12: warning: implicit declaration of function ‘dbl_EGeHeapSiftDown’ [-Wimplicit-function-declaration]
rval = dbl_EGeHeapSiftDown(&(sim->hp),&(ca->heap_cn));
^
src/eg_simula.c:388:5: warning: implicit declaration of function ‘dbl_EGeHeapDel’ [-Wimplicit-function-declaration]
dbl_EGeHeapDel(&(sim->hp),&(ca->heap_cn));
^
src/eg_simula.c:429:17: error: request for member ‘val’ in something not a structure or union
ca->heap_cn.val = sim->cur_time;
^
src/eg_simula.c:433:17: error: request for member ‘val’ in something not a structure or union
ca->heap_cn.val = sim->cur_time + nn->gen(sim->cur_time,nn->data);
^
src/eg_simula.c:441:17: error: request for member ‘val’ in something not a structure or union
ca->heap_cn.val = DBL_MAX;
^
Makefile.library:38: recipe for target 'obj/eg_simula.o' failed
make[1]: *** [obj/eg_simula.o] Error 1
make[1]: Leaving directory '/home/phani/EGlib-2.6.20'
Makefile:23: recipe for target 'library' failed
make: *** [library] Error 2
After some searching, I have noticed that dbl_EGeHeap_t is not defined in the source code, and that seems to be throwing errors.
On searching online, it seems to be the case that it was defined in EGlib 2.6.15 (https://conexo.dii.uchile.cl/SVN/EGlib/EGlib2/tags/EGlib-2.6.15/TEmplate/dbl_eg_eheap.h), but the corresponding file in 2.6.20 does not have the definition.
Has anybody else experienced this? I badly need a solution to this.

Multiple errors when compiling wxWidgets with gcc 4.8.1

I've been trying for a while now compile wxWidgets library for Code::Blocks and I am still getting a lot of different errors.
My gcc verions is: gcc (tdm-2) 4.8.1 and I want to build newest wxWidgets: 3.1.0. I've tried 3 different sources and each time I have some error (sometimes this same, sometimes different). I am working on Windows 8.1.
[1]mingw32-make -f makefile.gcc UNICODE=1 MONOLITHIC=1 SHARED=1 BUILD=debug CXXFLAGS="-std=gnu++11"
and the error output:
../../src/common/wxcrt.cpp: In function 'int wxVsprintf(wchar_t*, const wxString
&, va_list)':
../../src/common/wxcrt.cpp:623:47: error: invalid conversion from 'const wchar_t
*' to 'size_t {aka unsigned int}' [-fpermissive]
return wxCRT_VsprintfW(str, format.wc_str(), argptr);
^
../../src/common/wxcrt.cpp:623:56: error: cannot convert 'va_list {aka char*}' t
o 'const wchar_t*' for argument '3' to 'int vswprintf(wchar_t*, size_t, const wc
har_t*, char*)'
return wxCRT_VsprintfW(str, format.wc_str(), argptr);
^
../../src/common/wxcrt.cpp:632:1: warning: control reaches end of non-void funct
ion [-Wreturn-type]
}
^
makefile.gcc:6786: recipe for target 'gcc_mswuddll\monodll_wxcrt.o' failed
mingw32-make: *** [gcc_mswuddll\monodll_wxcrt.o] Error 1
[2]mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=debug and the error output:
../../src/common/wxcrt.cpp: In function 'int wxVsprintf(wchar_t*, const wxString
&, va_list)':
../../src/common/wxcrt.cpp:623:47: error: invalid conversion from 'const wchar_t
*' to 'size_t {aka unsigned int}' [-fpermissive]
return wxCRT_VsprintfW(str, format.wc_str(), argptr);
^
../../src/common/wxcrt.cpp:623:56: error: cannot convert 'va_list {aka char*}' t
o 'const wchar_t*' for argument '3' to 'int vswprintf(wchar_t*, size_t, const wc
har_t*, char*)'
return wxCRT_VsprintfW(str, format.wc_str(), argptr);
^
../../src/common/wxcrt.cpp:632:1: warning: control reaches end of non-void funct
ion [-Wreturn-type]
}
^
makefile.gcc:11860: recipe for target 'gcc_mswuddll\basedll_wxcrt.o' failed
mingw32-make: *** [gcc_mswuddll\basedll_wxcrt.o] Error 1
[3]mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 USE_OPENGL=1 VENDOR=cb CXXFLAGS="-fno-keep-inline-dllexport"1 and the error:
../../src/common/wxcrt.cpp: In function 'int wxVsprintf(wchar_t*, const wxString
&, va_list)':
../../src/common/wxcrt.cpp:623:47: error: invalid conversion from 'const wchar_t
*' to 'size_t {aka unsigned int}' [-fpermissive]
return wxCRT_VsprintfW(str, format.wc_str(), argptr);
^
../../src/common/wxcrt.cpp:623:56: error: cannot convert 'va_list {aka char*}' t
o 'const wchar_t*' for argument '3' to 'int vswprintf(wchar_t*, size_t, const wc
har_t*, char*)'
return wxCRT_VsprintfW(str, format.wc_str(), argptr);
^
../../src/common/wxcrt.cpp:632:1: warning: control reaches end of non-void funct
ion [-Wreturn-type]
}
^
makefile.gcc:6786: recipe for target 'gcc_mswudll\monodll_wxcrt.o' failed
mingw32-make: *** [gcc_mswudll\monodll_wxcrt.o] Error 1
Can someone please advice me what more I can do?
I'm not sure why are you speaking about multiple errors, this is clearly one and the same error and is due to using standard-like vswprintf() instead of the function from MSVC CRT which is normally used by MinGW by default. The former should only be used when __USE_MINGW_ANSI_STDIO is in effect and it's very strange that you still get it without it, I wonder if you have CPPFLAGS or similar set in your environment?
Anyhow, I'd recommend using TDM-GCC 4.9 as 3.1.0 definitely compiles with it (this is what the official binaries have been built with). 4.8 is supposed to work too, of course, so it could be worth checking how is __USE_MINGW_ANSI_STDIO getting defined, but installing 4.9 will probably be simpler for you.

GCC/G++ Errors Mac OS X Yosemite

since some weeks, I'm working with a new Mac which works with OS X Yosemite (Version 10.10.3). I figured out a lot of trouble installing programs from source, why I already changed the compiler to, e.g., gcc 4.2, 4.7, and 4.9. Furthermore, I "removed" the connection to clang, but also this produces still errors during compiling. However, doing the same on a Mac OS X machine version 10.7.5 works fine. There, gcc version 4.2.1 is running.
Here's an example error message, I get typing make in the command line:
cc -O2 -c -o swat.o swat.c
In file included from swat.c:25:
./swat.h:85:35: warning: '/*' within block comment [-Wcomment]
/* int *maxstu_vec; NOT NEEDED /* array of length length + 1, used to hold row of scores,
^
swat.c:29:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
compare_scores(entry1, entry2)
^
swat.c:35:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
compare_z_scores(entry1, entry2)
^
swat.c:42:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
compare_E_values(entry1, entry2)
^
swat.c:49:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main(argc,argv)
^
swat.c:75:3: warning: implicit declaration of function 'get_parameters' is invalid in C99 [-Wimplicit-function-declaration]
get_parameters(argc, argv, "swat");
^
swat.c:85:3: warning: implicit declaration of function 'alloc_hist' is invalid in C99 [-Wimplicit-function-declaration]
alloc_hist();
^
swat.c:86:10: warning: implicit declaration of function 'get_next_file_entry' is invalid in C99 [-Wimplicit-function-declaration]
while (get_next_file_entry(qdb)) {
^
swat.c:95:5: warning: implicit declaration of function 'notify' is invalid in C99 [-Wimplicit-function-declaration]
notify("Searching: ");
^
swat.c:98:12: warning: implicit declaration of function 'append_seq_entry' is invalid in C99 [-Wimplicit-function-declaration]
s_entry = append_seq_entry(sdb);
^
swat.c:110:2: warning: implicit declaration of function 'set_score' is invalid in C99 [-Wimplicit-function-declaration]
set_score(s_entry, score);
^
swat.c:127:57: warning: implicit declaration of function 'get_seq_length' is invalid in C99 [-Wimplicit-function-declaration]
score = parameters->align(q_profile, get_seq(s_entry), get_seq_length(s_entry), 1, 0, 0, 0, 0, 0);
^
swat.c:146:5: warning: implicit declaration of function 'initialize_hist' is invalid in C99 [-Wimplicit-function-declaration]
initialize_hist();
^
swat.c:155:7: warning: implicit declaration of function 'update_hist' is invalid in C99 [-Wimplicit-function-declaration]
update_hist(score_entry, 0);
^
swat.c:158:5: warning: implicit declaration of function 'process_hist' is invalid in C99 [-Wimplicit-function-declaration]
process_hist();
^
swat.c:172:2: warning: implicit declaration of function 'fit_log_n' is invalid in C99 [-Wimplicit-function-declaration]
fit_log_n(q_length);
^
swat.c:175:4: warning: implicit declaration of function 'find_z' is invalid in C99 [-Wimplicit-function-declaration]
find_z(score_entry);
^
swat.c:195:9: warning: implicit declaration of function 'reject_entry' is invalid in C99 [-Wimplicit-function-declaration]
if (!reject_entry(score_entry)) nz++; /* assumes Smith-Waterman */
^
swat.c:202:7: warning: implicit declaration of function 'new_est_lambda_K' is invalid in C99 [-Wimplicit-function-declaration]
new_est_lambda_K(q_length, score_entries, last_score_entry);
^
swat.c:242:24: warning: '&&' within '||' [-Wlogical-op-parentheses]
if (parameters->use_n && score_entry >= score_entries + parameters->max_num_alignments
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
swat.c:242:24: note: place parentheses around the '&&' expression to silence this warning
if (parameters->use_n && score_entry >= score_entries + parameters->max_num_alignments
^
( )
swat.c:243:24: warning: '&&' within '||' [-Wlogical-op-parentheses]
|| parameters->use_z && score_entry->z < parameters->z_cutoff || !score_entry->score)
~~ ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
swat.c:243:24: note: place parentheses around the '&&' expression to silence this warning
|| parameters->use_z && score_entry->z < parameters->z_cutoff || !score_entry->score)
^
( )
swat.c:256:29: warning: data argument not used by format string [-Wformat-extra-args]
score_entry->score, score_entry->z, e_value, score_entry->E);
^
swat.c:261:2: warning: implicit declaration of function 'print_alignment' is invalid in C99 [-Wimplicit-function-declaration]
print_alignment(q_profile);
^
swat.c:266:65: warning: data argument not used by format string [-Wformat-extra-args]
get_id(seq_num), get_seq_length(seq_num), score_entry->score, score_entry->z);
^
swat.c:272:5: warning: implicit declaration of function 'free_profile' is invalid in C99 [-Wimplicit-function-declaration]
free_profile(q_profile);
^
25 warnings generated.
cc -O2 -c -o weibull.o weibull.c
In file included from weibull.c:25:
./swat.h:85:35: warning: '/*' within block comment [-Wcomment]
/* int *maxstu_vec; NOT NEEDED /* array of length length + 1, used to hold row of scores,
^
weibull.c:47:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
reject_entry(score_entry)
^
weibull.c:50:32: warning: '&&' within '||' [-Wlogical-op-parentheses]
return (!parameters->nw_flag && !score_entry->score || score_entry->length < LENGTH_CUTOFF);
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ ~~
weibull.c:50:32: note: place parentheses around the '&&' expression to silence this warning
return (!parameters->nw_flag && !score_entry->score || score_entry->length < LENGTH_CUTOFF);
^
( )
weibull.c:53:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
alloc_hist()
^
weibull.c:65:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
weibull.c:67:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
initialize_hist()
^
weibull.c:78:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
weibull.c:80:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
update_hist(score_entry, z_flag)
^
weibull.c:88:5: error: non-void function 'update_hist' should return a value [-Wreturn-type]
return;
^
weibull.c:92:5: error: non-void function 'update_hist' should return a value [-Wreturn-type]
return;
^
weibull.c:106:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
prune_hist(score_entry)
^
weibull.c:111:34: error: non-void function 'prune_hist' should return a value [-Wreturn-type]
if (reject_entry(score_entry)) return;
^
weibull.c:127:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
process_hist()
^
weibull.c:155:5: warning: implicit declaration of function 'fatalError' is invalid in C99 [-Wimplicit-function-declaration]
fatalError("No entries have scores exceeding -gap_init");
^
weibull.c:168:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
fit_log_n(q_length)
^
weibull.c:300:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
est_lambda_K(q_length)
^
weibull.c:399:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
new_est_lambda_K(q_length, score_entries, last_score_entry) /* using non-extreme-value dist'n */
^
weibull.c:644:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
find_z(entry)
^
weibull.c:652:21: warning: implicit declaration of function 'make_log_table' is invalid in C99 [-Wimplicit-function-declaration]
if (!log_table) make_log_table();
^
weibull.c:665:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
make_log_table()
^
17 warnings and 3 errors generated.
make: *** [weibull.o] Error 1
Maybe someone of you has any idea, what the problem could be???
I would be very glad for every answer :)
weibull.c:88:5: error: non-void function 'update_hist' should return a value [-Wreturn-type]
return;
^
weibull.c:92:5: error: non-void function 'update_hist' should return a value [-Wreturn-type]
return;
^
and
weibull.c:111:34: error: non-void function 'prune_hist' should return a value [-Wreturn-type]
if (reject_entry(score_entry)) return;
^
must return a vaule of type in given function's header.
I found a solution. The problem was, as I already feared, the compiler.
I installed a relatively new version (gcc 4.9), set this version as active and added the path in ~/.bash_profile (that was the most important step). Furthermore, I adopted the makefile. Opening a new terminal and typing "make" runs without errors.

Resources