bin/185582: make rpcgen generate usable sample code
Pawel Biernacki
pawel.biernacki at gmail.com
Wed Jan 8 14:40:00 UTC 2014
>Number: 185582
>Category: bin
>Synopsis: make rpcgen generate usable sample code
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Jan 08 14:40:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator: Pawel Biernacki
>Release: FreeBSD 11.0-CURRENT
>Organization:
MysteriousCode
>Environment:
FreeBSD hal9000.local 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r260414: Wed Jan 8 00:50:28 GMT 2014 root at hal9000.local:/usr/obj/usr/src/sys/HAL9000 amd64
>Description:
rpcgen generates almost correct ANSI C code. The problem is that in generated sample client main function lacks proper declaration by omitting return type. Incorrect declaration also makes it impossible to compile generated code with c++ compiler. Another problem is that sample makefile uses $(RM) macro, but does not define it. Let's change it to just rm as in src/Makefile.inc1.
>How-To-Repeat:
$ cat test.x
program TEST_PROG {
version TEST_VERS {
int TEST(int) = 1;
} = 1;
} = 0x23456789;
$ rpcgen -aC test.x
$ make -f makefile.test
cc -O3 -fstrict-aliasing -pipe -march=native -fno-omit-frame-pointer -c test_clnt.c
cc -O3 -fstrict-aliasing -pipe -march=native -fno-omit-frame-pointer -c test_client.c
test_client.c:37:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main(int argc, char *argv[])
^~~~
1 warning generated.
cc -o test_client test_clnt.o test_client.o
cc -O3 -fstrict-aliasing -pipe -march=native -fno-omit-frame-pointer -c test_svc.c
cc -O3 -fstrict-aliasing -pipe -march=native -fno-omit-frame-pointer -c test_server.c
cc -o test_server test_svc.o test_server.o
$ make -f makefile.test clean
-f core test.h test_clnt.c test_svc.c test_client.c test_server.c test_clnt.o test_client.o test_svc.o test_server.o test_client test_server
make: exec(-f) failed (No such file or directory)
*** Error code 1
Stop.
make: stopped in /usr/home/kaktus/kodzik/rpc/test
>Fix:
Patch attached with submission follows:
Index: usr.bin/rpcgen/rpc_main.c
===================================================================
--- usr.bin/rpcgen/rpc_main.c (revision 260414)
+++ usr.bin/rpcgen/rpc_main.c (working copy)
@@ -879,7 +879,7 @@
$(LDLIBS) \n\n");
f_print(fout, "$(SERVER) : $(OBJECTS_SVC) \n");
f_print(fout, "\t$(CC) -o $(SERVER) $(OBJECTS_SVC) $(LDLIBS)\n\n ");
- f_print(fout, "clean:\n\t $(RM) -f core $(TARGETS) $(OBJECTS_CLNT) \
+ f_print(fout, "clean:\n\t rm -f core $(TARGETS) $(OBJECTS_CLNT) \
$(OBJECTS_SVC) $(CLIENT) $(SERVER)\n\n");
}
Index: usr.bin/rpcgen/rpc_sample.c
===================================================================
--- usr.bin/rpcgen/rpc_sample.c (revision 260414)
+++ usr.bin/rpcgen/rpc_sample.c (working copy)
@@ -270,6 +270,7 @@
version_list *vp;
f_print(fout, "\n\n");
+ f_print(fout, "int\n");
f_print(fout, "main(int argc, char *argv[])\n{\n");
f_print(fout, "\tchar *host;");
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list