Hello Tom,
If ever you consider a port to an another language, I suggest Ada.
Ada is issued from Pascal with strong type checking and more.
(www.ada2012.org)
It is an ISO standard.
I port all my Pascal programs to Ada since 2000 and I'm very happy with it.
I used P2Ada: http://p2ada.sourceforge.net.
I have some exemples on my web site (in French).
Feel free to ask questions if you are interested in.
Regards, Pascal.
http://blady.pagesperso-orange.fr
> Le 27 janv. 2016 à 22:08, gpc-request(a)gnu.de a écrit :
>
> Date: Wed, 27 Jan 2016 14:11:59 -0500
> From: Schneider <schneidt(a)mail.nih.gov>
> To: <samiam(a)moorecad.com>
> Cc: gpc(a)gnu.de
> Subject: Re: GPC compile on Mac OS X 10.10.5?
> Message-ID: <20160127191159.GA73206(a)FR-W-C132678.ncifcrf.gov>
> Content-Type: text/plain; charset="us-ascii"
>
> Scott:
>
>> What was wrong with getting a p2c translation (just curious). You
>> only have to do the translation once, then you code in C after that.
>
> I'm used to programming in Pascal, not C. Also, it's safer because of
> the type checking. If I switched I could never go back.
>
>> I used p2c (I assume we are talking about the same one). Its a very
>> picky tool that crashes when you look at it funny, but I was able to
>> get satisfactory results.
>
> You are right about looking at it funny! One kind of bug(?) is that
> it changes how it handles i/o for the input file in the middle of the
> code. I haven't determined why but fortunately it's a rare problem.
>
> Tom
>
> Thomas D. Schneider, Ph.D.
> Senior Investigator
> National Institutes of Health
> National Cancer Institute
> Center for Cancer Research
> Gene Regulation and Chromosome Biology Laboratory
> Molecular Information Theory Group
> Frederick, Maryland 21702-1201
> schneidt(a)mail.nih.gov
> https://schneider.ncifcrf.gov (current link)
> https://alum.mit.edu/www/toms (permanent link)
>
While trying to get a successful compilation of GPC on Mac OS X 10.11 using Apple’s LLVM based tool chain, I discovered what looks to be a couple of source code errors in p/statements.c in the expand_pascal_assignment2 function’s code. That function is declared with a void return type so there shouldn’t be any return statements returning a value anywhere within the body of the function but there are two uses of the CHK_EM macro which does expand to a return statement that potentially returns a value (a tree type). Trying to potentially return something into the void of a non-existant return isn’t technically correct code and I haven’t found a way to get the LLVM based clang compiler to accept it.
I’ll note that you can get a gnu gcc version 5.2.0 compiler to accept the code when compiling with the -std=gnu89 command line option.
The GPC source code version I’m trying to get compiling is the Adriaan van Os’s Mac OS X patched gcc 3.4.6 with the p directory replaced with Waldek Hebisch’s git repository’s (<https://github.com/hebisch/gpc>) p directory source code. The code fragment containing the error producing code starting around line 1231 in file p/statements.c (in expand_pascal_assignment2 function’s body) is:
schema_source = undo_schema_dereference (source);
schema_target = undo_schema_dereference (target);
DEREFERENCE_SCHEMA (source);
DEREFERENCE_SCHEMA (target);
CHK_EM (source);
CHK_EM (target);
I’m not sure how long the code “error” has been around. I checked the gpc-20070904 sources and it is also in that version.
I don’t have a working GPC at the moment so I don’t know what sort of ill formed Pascal source code would be needed to exercise the CHK_EM macro return statement’s code and what sort of ills would result if the code was exercised.
The compiler version information on the compiler being used for the compiling stopping errors is:
gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.3.0
Thread model: posix
Note: Apple has got their tool chain wired up so that “gcc” invokes LLVM based clang.
In case you want to see it I’ve included the gcc [really clang] and make diagnostic output below my signature.
P.S. I think I’m getting close to seeing the light at the end of the tunnel of building a gcc-3.4.6 based GPC on the latest version of Mac OS X. The path to success looks to be using a real gnu based gcc and as for compiling and assembling to object code. At least for the fairly old code base of gcc-3.4.6, trying to use a LLVM based tool chain build path seems to be a never ending series of “close but no cigar” dead ends, issues, and headaches.
Gale Paeper
gpaeper(a)empirenet.com
gcc -std=gnu99 -arch i386 -o p/statements.o -c -g -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -DHAVE_CONFIG_H -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-traditional -I. -Ip -I../../gcc-3.4.6/gcc -I../../gcc-3.4.6/gcc/p -I../../gcc-3.4.6/gcc/../include -DGPC -DGPC_UNITS_DIR=\"/usr/local/gpc346u4/gpc346u4/lib/gcc/i386-apple-darwin15/3.4.6/units\" -I../../gcc-3.4.6/gcc/p -DRTS_VERSION_CHECK="\"_p_GPC_RTS_VERSION_`cat ../../gcc-3.4.6/gcc/p/rts/rts-version`\"" ../../gcc-3.4.6/gcc/p/statements.c
4 warnings generated.
warning: unknown warning option '-Wno-traditional' [-Wunknown-warning-option]
In file included from ../../gcc-3.4.6/gcc/p/statements.c:29:
In file included from ../../gcc-3.4.6/gcc/p/gpc.h:46:
In file included from ../../gcc-3.4.6/gcc/p/gbe.h:151:
../../gcc-3.4.6/gcc/output.h:122:6: warning: '__format__' attribute argument not supported: asm_fprintf [-Wignored-attributes]
ATTRIBUTE_ASM_FPRINTF(2, 3);
^
../../gcc-3.4.6/gcc/output.h:112:53: note: expanded from macro 'ATTRIBUTE_ASM_FPRINTF'
#define ATTRIBUTE_ASM_FPRINTF(m, n) __attribute__ ((__format__ (__asm_fprintf__, m, n))) ATTRIBUTE_NONNULL(m)
^
../../gcc-3.4.6/gcc/p/statements.c:1235:3: error: void function 'expand_pascal_assignment2' should not return a value [-Wreturn-type]
CHK_EM (source);
^~~~~~~~~~~~~~~
../../gcc-3.4.6/gcc/p/gpc.h:155:36: note: expanded from macro 'CHK_EM'
#define CHK_EM(t) do { if (EM (t)) return error_mark_node; } while (0)
^ ~~~~~~~~~~~~~~~
../../gcc-3.4.6/gcc/p/statements.c:1236:3: error: void function 'expand_pascal_assignment2' should not return a value [-Wreturn-type]
CHK_EM (target);
^~~~~~~~~~~~~~~
../../gcc-3.4.6/gcc/p/gpc.h:155:36: note: expanded from macro 'CHK_EM'
#define CHK_EM(t) do { if (EM (t)) return error_mark_node; } while (0)
^ ~~~~~~~~~~~~~~~
../../gcc-3.4.6/gcc/p/statements.c:1342:1: warning: no previous prototype for function 'assign_string2' [-Wmissing-prototypes]
assign_string2 (tree target, tree source, int is_init)
^
../../gcc-3.4.6/gcc/p/statements.c:1342:47: warning: unused parameter 'is_init' [-Wunused-parameter]
assign_string2 (tree target, tree source, int is_init)
^
4 warnings and 2 errors generated.
make[2]: *** [p/statements.o] Error 1
make[1]: *** [stage1_build] Error 2
make: *** [bootstrap] Error 2