Bug 185582 - [patch] rpcgen(1): make rpcgen generate usable sample code
Summary: [patch] rpcgen(1): make rpcgen generate usable sample code
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: Bryan Drewery
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-08 14:40 UTC by Pawel Biernacki
Modified: 2014-06-24 15:55 UTC (History)
1 user (show)

See Also:


Attachments
file.diff (923 bytes, patch)
2014-01-08 14:40 UTC, Pawel Biernacki
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Biernacki freebsd_committer freebsd_triage 2014-01-08 14:40:00 UTC
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.

Fix: Patch attached with submission follows:
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
Comment 1 Bryan Drewery freebsd_committer freebsd_triage 2014-06-04 13:07:28 UTC
I will get this in this week. Juggling a few other things. This is quite trivial though.
Comment 2 commit-hook freebsd_committer freebsd_triage 2014-06-06 17:38:41 UTC
A commit references this bug:

Author: bdrewery
Date: Fri Jun  6 17:38:38 UTC 2014
New revision: 267174
URL: http://svnweb.freebsd.org/changeset/base/267174

Log:
  Fix some rpcgen sample file issues.

  * -Sc was generating code without a return type on main.
  * -Sm was generating an unusable clean target due to undefined RM.
  * -Sm was generating clean target with extra preceding space.

  PR:		185582
  Submitted by:	Pawel Biernacki <pawel.biernacki@gmail.com>
  MFC after:	1 week

Changes:
  head/usr.bin/rpcgen/rpc_main.c
  head/usr.bin/rpcgen/rpc_sample.c
Comment 3 commit-hook freebsd_committer freebsd_triage 2014-06-13 15:04:50 UTC
A commit references this bug:

Author: bdrewery
Date: Fri Jun 13 15:04:22 UTC 2014
New revision: 267444
URL: http://svnweb.freebsd.org/changeset/base/267444

Log:
  MFC r267174:

    Fix some rpcgen sample file issues.

  PR:	185582

Changes:
_U  stable/10/
  stable/10/usr.bin/rpcgen/rpc_main.c
  stable/10/usr.bin/rpcgen/rpc_sample.c
Comment 4 commit-hook freebsd_committer freebsd_triage 2014-06-24 15:55:25 UTC
A commit references this bug:

Author: bdrewery
Date: Tue Jun 24 15:54:42 UTC 2014
New revision: 267822
URL: http://svnweb.freebsd.org/changeset/base/267822

Log:
  MFC r267174:

    Fix some rpcgen sample file issues.

  PR:		185582

Changes:
_U  stable/9/usr.bin/rpcgen/
  stable/9/usr.bin/rpcgen/rpc_main.c
  stable/9/usr.bin/rpcgen/rpc_sample.c