-
Notifications
You must be signed in to change notification settings - Fork 1
/
NEWS
2367 lines (1649 loc) · 92.7 KB
/
NEWS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
2024-03-10: Version 0.1.86 released
Added experimental command-line option --mc6839, which allows single-
precision floating point operations, by adding the 8k image of
Motorola's MC6839 ROM. Those operations are then independent of
Color Basic's floating point routines, and Basic does not have to
be present. When using this option, the use of the %f placeholder
in a printf() statement requires calling enable_printf_float()
are the beginning of main().
Added sbrk() and sbrkmax() for OS-9.
Added strspn(), strcspn(), strtok(), strpbrk().
Fixed the definition of the program_end label on OS-9 so that it
follows the code and read-only globals, instead of following the
rwdata and bss sections, which are in the data segment.
Added option -Wshadow, which warns if a local variable hides another one
in the same function.
Added ssize_t, a signed version of type size_t. It is defined by cmoc.h.
Fixed a bug with -fomit-frame-pointer to take in account other routines
that pop their argument off the stack before returning.
Fixed a bug with the line number that accompanies the "array `...'
assumed to have one element" warning.
Fixed a bug with the --limit option where the executable file would be
left existing when the limit was exceeded, at the risk of the user
launching a program that is too long.
Fixed a bug where the compiler crashed when using an undefined enum name
in an array's size.
Fixed a bug where a syntax error was issued for an empty enum.
A warning is now issued when assigning a long value to an int.
A warning is now issued when a character constant, e.g., 'x', is passed
to a function parameter of pointer type.
The compiler does not issue the same error or warning message more than
once for a given source line anymore.
Added strrchr() to CMOC's standard library.
strlen(), strcpy(), strncpy(), strcat(), strlwr(), strupr(), strchr(),
strstr(), memcpy(), memcmp() and memicmp() do not preserve X anymore.
That register does not need to be preserved by a function under the
CMOC calling convention.
Command-line option -Wgives-byte now gives no warning about binary
operations on bytes yielding a byte if either operand has a cast,
e.g., x + (char) y. A warning is still given on x + y.
Fixed -Wgives-byte so that it does not warn on a binary operator
applied to a small enum value (which is int) or a small sizeof value
(which is size_t).
A warning is now issued when a label is put on a declaration, e.g.,
case 42: int n = 0;
New command-line option -Wno-label-on-declaration disables this warning.
gcc 9.4.0 gives an error for this.
Minor optimizations, including to struct assignments and to the
initialization of an array from a string literal.
An error is now given when no argument is passed to --stack-space=,
--add-os9-stack-space= and --function-stack=.
Command line option --deps-only now fails if the preprocessor exits
with a non-zero status.
Options -MT, -MD, -MP and -MF added to help support the gcc3 dependency
style supported by GNU Automake.
2023-09-02: Version 0.1.85 released
Function-local function prototypes are now supported.
A K&R prototype for a function that specifies no return type is now
allowed, but only at the top level, not inside a function. The return
type is assumed to be int. Example: f(); int main() { return f(); }
Calling an undeclared function does not generate an "undeclared
identifier" error anymore. It now generates a warning about calling
an undeclared function. This can be useful to port K&R-style code.
Suchs calls are assumed to return an int.
Fixed a crash that could happen when compiling an empty file.
A failed assert() statement now calls exit(1) instead of freezing.
The <assert.h> header now defines _FreezeOnFailedAssert() to determine
what happens after a failed assert, and _SetFailedAssertHandler() to
determine the function to be called when an assert() fails.
The compiler now detects a typedef with an initializer (e.g.,
typedef int a = 0;) and issues an error message for it.
New option -Wno-unknown-first-dim keeps the compiler from issuing
"array `...' assumed to have one element" warnings.
The "too many elements [...] in initializer for array" error is now
a warning and new option -Wno-too-many-elements keeps the compiler
from issuing it.
The compiler now warns about bit shifts that always give zero, e.g.,
unsigned char a = ..., b = a << 8. New option -Wno-shift-always-zero
turns off this warning.
Fixed a memory leak that occurred during parsing of K&R parameter lists.
Added a small optimization to the code that computes the address of
an array element when the elements are less than 256 bytes in size
and the element index is 16 bits. Added a small optimization to some
16-by-8 multiplications, and to the initialization of a local character
array.
Added an optimization that removes repeated LDX instructions, which
allows other, pre-existing optimizations to remove more instructions.
Improved detection of overflows in the computation of multi-dimensional
array sizes.
CMOC is now built with -Wsuggest-override when the C++ compiler supports
that option. The CMOC source code now uses the override keyword (a C++11
feature) on the overriding virtual functions.
2023-08-17: Version 0.1.84 released
Added option "-x c" to indicate that all files whose extension is not
.a, .asm, .o or .a must be assumed to be C files, and option "-x none",
which is the default, which only considers .c files to be C files.
Verbatim assembly blocks (asm {...}) are now allowed at global scope.
If a sequence of more than one assembly blocks precedes a certain
C function, those blocks are all emitted, in order, just before that
function's code.
Fixed bugs that prevented returning an integral type from a
float-returning function, and returning a float from a long-returning
function.
Fixed a bug with -fomit-frame-pointer that did not take in account
the fact that some CMOC utility routines pop their argument off the
stack before returning.
Fixed a bug with the += operator that sometimes caused two bytes
to be leaked on the stack, although without -fomit-frame-pointer,
this did not keep the function from returning normally.
Fixed a bug where an error was given when trying to change a struct
member through a const pointer to a non-const struct.
Fixed a bug where a string literal cast to a character pointer type
would not be usable in a constant initializer.
Fixed a bug where a numerical constant cast to another numerical type
or to a pointer type would not be usable in a constant initializer.
Error "return without argument in a non-void function" is now a warning.
Replaced the implementation of sqrt16() with one which is about 35%
faster on average on a CoCo, as measured with XRoar 1.4.2.
Fixed bugs that affected a pointer to an array, e.g., int (*a)[20].
2023-07-14: Version 0.1.83 released
The compiler now gives an error, instead of a warning, when the
linking phase detects that a global variable or function name with
external linkage is used in two different modules. No error or warning
is given when the two variables or functions are static, i.e., have
internal linkage. Previously, a warning was given in all these cases,
and the user had to figure out if the symbols involved had internal
or external linkage. A name clash is not a problem in the internal
linkage case.
Fixed a build problem on OpenBSD where Parameters.cpp failed to compile
because WEXITSTATUS() and WIFEXITED() were not declared.
Fixed an inline assembly bug where LDD #foo would try to refer to a
C variable named foo if one exists. An instruction argument of that form
now always refers to assembly label foo, never to a C variable.
To force a name in an inline assembly argument to refer to a C variable
or enum, precede it with a colon (e.g., LDD :n).
isspace() now returns non-zero for '\f' and '\v'.
Functions attr(), cls(), getTextMode(), hscreen(), locate(), palette(),
paletteRGB(), resetPalette(), setBorderColor(), setHighSpeed() and
width() (declared by <coco.h>) do not require a previous call to
initCoCoSupport() anymore.
resetPalette() (declared by <coco.h>) does not require the presence
of Basic anymore.
2023-04-29: Version 0.1.82 released
Added new header <setjmp.h>, which provides C functions setjmp()
and longjmp().
Defining and calling a function using a parenthesized function name
(e.g., void (foo)(...) {...}) is now supported.
Added optimization option -fomit-frame-pointer to tell the compiler
to not keep the frame pointer in a register for functions that do
not need one. This can shorten the program. This option is not on
by default. It does not act on functions that use inline assembly.
It should be used with caution because it has not seen much use as
of this release.
The asm() directive, not to be confused with asm{}, now produces
inline assembly text that is tagged in ASMText as INLINE_ASM instead
of INSTR. This ensures that the text generated by both directives
is processed the same way by the optimizer. (It is recommended to
use asm{} because it supports multi-line assembly code.)
Added warning option -Wfor-condition-sizes, which warns if a for()
loop's condition compares values of different sizes. For example:
unsigned n = 256; for (unsigned char i = 0; i < n; ++i) {...}
Local static variables whose initializer involves a string literal
are now supported, instead of giving a compilation error.
Fixed an issue where an error was issued in a byte-returning function
for a return statement that used a comma expression finishing with
a byte-compatible sub-expression. Example: return (f(), 'x');
CMOC is now compiled without debugging information by default.
To compile CMOC with it, pass --enable-debug to the configure script.
Added minor optimizations.
Moved the Parameters class to its own file.
2023-02-03: Version 0.1.81 released
Fixed a bug where the compiler crashed on a struct member array with
an invalid array size. An intelligible error message is now issued.
Fixed usim compilation problems when building CMOC on Cygwin.
Added sqrt32() to CMOC's standard library (declared by <cmoc.h>).
It computes the integer part of the square root of the given
32-bit number.
Added an optimized routine for dividing an unsigned byte by 3 that
is faster than the general byte division routine.
Optimized the case where an unsigned char value that is cast to an
int is multiplied by another unsigned char value on the right.
Fixed a bug where the compiler gave a superfluous error message when
a break or continue keyword was used outside of a breakable statement
(in addition to the normal error message).
Fixed bugs in memcmp(), memicmp(), strcmp(), stricmp() for OS-9.
readDECBFile() now avoids reading a data sector for nothing in the
case of an empty file. Note that the destination buffer must be at
least 256 bytes, even if the file to be read is shorter than that.
2022-09-16: Version 0.1.80 released
Options --raw and --srec are now usable with --dragon. Previously,
they caused a fatal error.
Fixed a bug with the code generated when += or -= were used on
pointers to multi-byte types other than int.
Fixed a bug where an OS-9 executable that used %f in a printf() call
would crash.
readDECBFile() now returns the file length in bytes, not the total
length of the sectors read.
Fixed printf() format string warnings. A warning is now issued for
"%04 ", where there is no conversion specifier.
2022-08-24: Version 0.1.79 released
Floating-point arithmetic using the float type is now supported
when targeting the DragonDOS environment.
Added option --add-os9-stack-space, which allows specifying a number
of bytes to add to the stack space normally allocated by OS-9.
Fixed a bug with the references to `fixserr' in the OS-9 runtime
(crt.asm) and to `chrtomem' in the OS-9 version of sprintf().
The compiler now issues a warning when passing a struct or union to
printf() or sprintf().
The BSS section is now emitted at the end, to avoid a hole in the
executable. This helps shrink the executable file in some formats
like the DECB .bin format. As a consequence, #pragma exec_once
has been removed.
Inline assembly statements can now refer to fields of a struct variable,
e.g., asm { inc :player.score }.
Fixed a potential bug involving the += operator applied to a long on
the left side and a float on the right side.
Indexes into C arrays in inline assembly statements are in array elements,
not in bytes. A warning is issued on such an index when it is not zero.
This warning can be disabled with -Wno-inline-asm-array-indexes.
Indexes into non-arrays are in bytes.
Pointers to pointers to functions are now supported without having
to create a typedef for the pointer-to-function type.
Similarly for arrays.
Added minor optimizations.
2022-07-05: Version 0.1.78 released
Added more optimizations. The branch shortening optimization is
slightly more aggressive. Assembly errors about short branches
being out of range should be reported.
Functions rand(), sbrkmax(), readword(), readline() and typedef
ConsoleOutHook are now declared rand(void), etc.
Added support for compilers that need an explicit option (e.g.,
-std=c++11) to recognize the C++11 features used by the CMOC
source code.
Fixed bugs with local static variable support: one that prevented
having two functions in the same translation unit that defined a
local static of the same name, and one that omitted the assembly
language definition of a local static that did not have an
initializer.
Fixed a bug with negating a float variable containing 0.0f (the
resulting mantissa was not entirely zeroes).
Fixed a potential bug with the compile-time evaluation of a name
that is an enumerator name hidden by a local variable name.
Fixed a potential bug with the compile-time evaluation of a signed
byte getting cast to a signed integer.
Fixed a potential bug where structs whose initializers contain fewer
values than there are fields would leave those bytes undefined.
They are now initialized to null bytes.
This also applies to array initializers.
Fixed a bug where a global character array initialized from a literal
that is shorter than the array would be generated without the trailing
null bytes.
Fixed a K&R prototype bug where a prototype without any parameters
would forbid calls with parameters.
Added a -Wno-missing-field-initializers command-line option to
disable warnings about a struct being initialized with fewer values
than there are fields.
Fixed a failed assertion triggered by declaring a void variable.
The --no-relocate option now makes the compiler emit a JSR instead
of an LBSR for most function calls.
Removed optimizations removeUselessLdb() and removeUselessLdd()
because they are not safe anymore.
A warning is now given when applying an increment or decrement
operator to a function pointer.
2022-04-23: Version 0.1.77 released
Added functions sinf, cosf, tanf, atanf, logf, expf, sqrtf, fabsf,
floorf, truncf and roundf to <coco.h>.
These functions only work on the CoCo and only if Extended Color Basic
is present. Passing them an invalid argument may display a Basic error
message and end the execution of the program.
Emit an error instead of crashing when a floating-point value
cannot be represented on the targeted platform (typically because
it is too large or too small).
2022-03-05: Version 0.1.76 released
Local static variables are now supported.
Option --decb added as a synonym for --coco.
Retired optimizeTfrOp.
2022-02-19: Version 0.1.75 released
Added support for the FLEX operating system (--flex).
Added abs() and labs() to CMOC's standard library (declared by <cmoc.h>).
Fixed a bug that rejected "long int/signed/unsigned".
Fixed a bug with the switch() statement where a large sparse array
of switch values would generate a huge assembly language sequence.
(The jump table cost calculator had a 16-bit overflow.)
Fixed a bug where a static function was seen as not used, which
caused a warning, even though it was used in a variable's initializer.
Fixed a bug with K&R function definition parsing to support more than
one declarator per declarator speficier, e.g. f(x, y) int x, y; {}.
Passing a non-enum integral expression to a function that expects an
enum value is now a warning instead of an error.
Using an #pragma directive that is unknown to CMOC is now a warning
instead of an error.
A member of a const struct is now correctly typed as const, including in
the case where the member is accessed through a pointer to a const struct.
More error messages for const-incorrectness have been changed to warnings.
pmode(), screen() and setPmodeGraphicsAddressEx() (declared by <coco.h>)
are now in their own .c file in CMOC's standard library, to help reduce
executable size.
setPmodeGraphicsAddress() is now a macro defined in <coco.h>.
readDECBFile() now returns an error code and has a different signature.
2022-01-14: Version 0.1.74 released
K&R C function definitions are now accepted, experimentally.
(Bug reports are welcome.)
Replaced Unicode characters in dskcon-standalone.c to resolve
compilation issues with gcc 11.2.0.
Minor fixes to compile without warnings with gcc 11.2.0.
No warning is issued anymore for a missing return statement if the last
statement in the function body is an asm{} statement, because the return
value will typically be stored directly in B or D by that inline assembly
code.
Minor optimizations added.
Minor optimizations to the compiler's low-level optimizer's performance.
Some of the compiler's C++ sources now use the 'auto' keyword to declare
some variables.
2022-01-02: Version 0.1.73 released
Added readDECBFile() to <coco.h>.
This function reads a Disk Basic floppy file into memory.
Added <dskcon-standalone.h> to CMOC's standard library.
It provides a function that reads or writes a CoCo floppy sector.
Added memset16(), which fills a memory region with a 16-bit word.
The rgb() and cmp() functions are now independent of Color Basic.
Minor optimizations added.
Resolved a memory leak when compiling an unnamed bit field.
No warning anymore on the number of elements in an initializer used to
initialize a union variable.
The makefiles do not define docdir anymore, since that variable is
defined by Autoconf.
2021-11-19: Version 0.1.72 released
Fixed a code generation bug with an array whose initializer has fewer
values that the length of the array.
Fixed a code generation bug with casting a long to a pointer.
Fixed a bug where some writable arrays would be put in the read-only
section.
New -Wno-uncalled-static option to disable the warning on a static
function that is not called.
Added C functions memmove(), memichr() and vsprintf() to CMOC's library.
Bug fix: Option --check-null now covers an assignment through a
literal null pointer.
Fixed a problem with -nodefaultlibs that caused struct assignments to
cause a linking error. Note that struct assignments require the program
to provide memcpy() when the program is built with -nodefaultlibs.
Command-line option -Wgives-byte now gives no warning about binary
operations on bytes yielding a byte, if both operands have a cast,
e.g., (char) x + (char) y. A warning is still given on x + y.
Command-line option --deps-only now takes an optional argument to specify
the path of the .d file to create.
When the --no-relocate option is specified and optimizations are enabled,
program-counter-relative addressing is typically replaced with absolute
addressing (e.g., LEAX foo,PCR is replaced with LDX #foo).
ultoa10() and sqrt16() have been slightly optimized.
Header cmoc.h now defines SIZE_MAX, which gives the highest value that
can be stored by the size_t type.
Fixed a bug with the listing of a function's formal parameters and locals
in the generated assembly language, where variables declared in sub-scopes
were not listed.
Fixed portability issues concerning FreeBSD.
2021-06-05: Version 0.1.71 released
Added support for the Thomson MO and TO computers (--thommo, --thomto).
Added C functions vprintf(), strncmp(), memchr(), isspace(),
isdigit(), isalpha() and isalnum() to CMOC's library.
New -Wno-printf option to disable the warning normally issued when
the format argument of printf() or sprintf() is not a string literal.
Fixed a bug with initializers for a struct that contains a matrix
of characters.
Fixed a bug where an error message would be given on an array
parameter of a size given by the sum of a constant and an enum
itself defined as sum. (E.g., enum {N=1+2}; void f(char a[N+1]) {}).
Fixed a bug where the compiler crashed on a function parameter type
mismatch instead of issuing an error message.
Fixed a bug where the compiler crashed on evaluating a sizeof
argument that incorrectly used a dot instead of an arrow to refer
to a member of a struct through a pointer, e.g., sizeof(obj.n)
with struct S *obj.
Bug fix: Option --check-null now covers an assignment through a
pointer variable.
Minor optimization in the CMOC library's multiplication utility
routines and the memset() function.
2021-03-07: Version 0.1.70 released
Added the --void-target command-line option, which targets a generic
platform whose I/O system is not known to CMOC. This target may
be useful to users of 6809-based single-board computers or other
unsupported platforms. Functions like putchar() and printf() do
nothing when compiling for that target, but the setConsoleOutHook()
function can be used to redirect those functions to a user-defined
character output routine. (See the CMOC manual for details.)
Added the --raw command-line option, which forces the compiler
to generate an executable in "raw" format, as defined by LWTOOLS'
linker (i.e., --format=raw is passed to lwlink). (This option is
not supported when targeting OS-9.)
Fixed a bug where the assembler failed on a reference to an external
variable because the extern declaration was local rather than global.
Fixed a potential problem by preventing the Vectrex exit() function
from executing the destructors repeatedly.
Optimized the passing of structs by value to function calls. Affects
structs of less than 256 bytes.
2021-01-24: Version 0.1.69 released
Fixed a bug with code emitted from array initializers containing
string literals for a character matrix, e.g., char a[2][6] = {...}.
Fixed a bug where an error message would have the wrong number when
the error happens after an inline assembly block that contains an
#if directive that generates a preprocessor line number directive
(of the form '# <num> <filename>').
Passing a pointer argument to a function parameter of integral type
now gives a warning.
2020-12-20: Version 0.1.68 released
Fixed a bug that prevented a numerical cast to a pointer, e.g.,
NULL, from being used as an initializer.
Fixed a bug that prevented initializing a struct local variable
from a const struct.
Fixed a bug that affected += and -= when applied to a function
pointer variable.
An error message is now given when a struct member is of type void.
Optimized copied shifting of an unsigned long by 8, 16 or 24 bits,
left or right.
Added an optimization to avoid EOR or OR with 0 and ANDing a byte
with 255.
Optimized conditional expressions (c ? x : y).
Using float or double when targeting platforms that do not support
those types is now an error instead of a warning.
Resolved "POSIX Yacc does not support %expect" warning by removing
the %expect directive from parser.yy and passing -Wno-conflicts-sr
to the Yacc wrapper.
2020-06-07: Version 0.1.67 released
Fixed an issue with the unsigned long shifting optimization
introduced in version 0.1.66.
2020-06-06: Version 0.1.66 released
New -Wlocal-var-hiding command line switch makes the compiler issue
a warning when a local variable declaration hides another one of the
same name.
Fixed a bug where a global variable initializer of the form &array[N]
was rejected as being non constant.
Added a low-level optimization that removes an unneeded LDB instruction
when a byte gets compared with two values.
Added an optimization for in-place shifting of an unsigned long by
8, 16 or 24 bits, left or right.
Added an optimization for the evaluation of a loop condition based
on a comma-expression.
Removed non-breakable spaces from several source files.
Monolith compilation mode is not offered anymore. This also means that
the --emit-uncalled command-line switch has been removed.
2020-04-24: Version 0.1.65 released
Added stricmp() and memicmp() (for ASCII case-insensitive comparisons)
to the CMOC library. (To be declared by #including <cmoc.h>.)
Fixed a crash that happened on |=, &= and ^=, or some casts, when used
inside an if() statement.
Fixed an internal error that happened on some array references whose
left side is an addition operation.
2020-04-05: Version 0.1.64 released
Fixed a bug with enumerated names that depended on a sizeof expression
and with array declarations that depended on such enumerated names.
2020-03-21: Version 0.1.63 released
Fixed a 16-bit by 8-bit multiplication code generation bug to make
sure that a 16-bit multiplication is done in those cases.
2020-03-01: Version 0.1.62 released
Fixed global variable initialization so that non-constant initializer
expressions are rejected as in Standard C.
Fixed crashes where a class definition was not associated with its
type descriptor.
Added the --intdir=D command-line option, which can be used to have
the intermediate files generated in directory D.
Added strstr() to CMOC's library.
The 'pdf' makefile target in the 'doc' subdirectory creates a PDF
of the manual, provided that the pandoc and pdflatex commands are
installed and in the path.
2019-10-21: Version 0.1.61 released
New command-line option -Wgives-byte tells CMOC to warn about
binary operations on bytes yielding a byte. For example,
(char) a * (char) b yields a byte under CMOC, while it yields
an int under Standard C.
Fixed a bug with comparisons between an int and a long.
Fixed support for bitwise negation on a long value.
Fixed support for logical AND and OR on long and float values.
Fixed a crash on a constant cast to a long.
An implicit cast from a void pointer is now a warning instead
of an error.
The --monolith mode is deprecated and is not tested anymore.
2019-08-25: Version 0.1.60 released
Fixed bugs related to function parameters of types based on
array typedefs.
Fixed under-reported const-correctness errors about assigning,
incrementing or decrementing members of structs.
Fixed a bug where an extern declaration in a function was taken
as a local variable declaration instead of a declaration of a
global defined in another file.
A struct initializer is now allowed to have a lower number of
expressions than the number of members to initialize.
A struct whose initializer allows it to be defined with static values
is now defined this way instead of using initialization code.
A function whose return type is pointer to void is now allowed
to return a pointer to any type.
sizeof(void) now returns 1 (as with GCC) instead of 0.
This fixes a bug where applying + or += to a void pointer failed
to advance the pointer.
C functions qsort() and bsearch() have been added to the
standard library.
Omitting a return statement in a non-void function is now a
warning instead of an error.
A warning is now issued instead of an error when passing a pointer
to a signed type to a function expecting a pointer to an unsigned
type (or vice versa).
A warning is now issued instead of an error when the return type
of main() is not int.
A few low-level optimizations have been added.
Fixed a bug where an initializer with a string literal would be
rejected in a case where the compiler thought that the initialized
struct was supposed to be suitable for ROM. (A string literal's address
gets resolved at run-time, in order to support relocatability.)
A bug with the CMP instruction and overflows has been fixed in the
USim 6809 simulator.
2019-06-03: Version 0.1.59 released
A library is now allowed to provide "constructor" and "destructor"
code sections that contain code to be run before and after main()
respectively.
See the manual in the "User library constructors and destructors"
section for details.
Fixed a bug where a string literal used to initialize a global
character array was emitted with backslashes taken literally
instead of with interpreted backslash escapes. For example,
const char vec[] = "\r" gave a 3-character array (92, 114, 0)
instead of a 2-character array (13, 0).
Fixed a bug where the string "<command line>" would end up in
a .d prerequisite file on a Mac.
Fixed inline assembly statements so that referring to "2,s"
is not seen as a reference to a C variable named 's'.
Fixed a linking bug where passing subdir/foo.o would fail because
cmoc would pass foo.o (without "subdir/") to lwlink.
Changed the interface of the OS-9 stack check routine (_stkcheck)
so that it does not trash the D register.
OS-9 code that was compiled with previous versions of this compiler
must not be linked with code compiled with this version or a more
recent one.
initCoCoSupport() and its global variables (isCoCo3, textScreenWidth,
textScreenHeight) are now part of CMOC's OS-9 library.
--org, --dos and --data are now disallowed when targetting OS-9.
The emitted assembly text now includes funcsize_* labels that give
the function's size in the assembly listing file.
Fixed an error re: return values in the "Calling convention" section
of the manual.
2019-03-30: Version 0.1.58 released
Fixed a crash when adding an offset to a struct member matrix,
e.g., struct S { char m[50][15]; } s; return s.m + 42;
Note that s.m + 42 is equivalent to s.m[42]. Both are the address
of a 15-character array.
Fixed the switch() statement so that an empty body is allowed,
and so that a body containing only a default statement is allowed.
Fixed a case where using an enum name before it was defined caused
a compiler crash.
The main() return value, and the exit() argument, are now guaranteed
to be returned in D upon exiting the program, when compiled for the
CoCo Basic environment or for the Dragon. This can be useful to return
a 16-bit address from one program for use by another program. Note that
registers U and Y must be preserved (typically with PSHS and PULS) when
calling another program.
Case and default statements are now rejected when they are not
inside a switch() statement.
Restored optimization "optimize8BitStackOps" thanks to a fix
provided by Jamie Cho.
Fixed a potential bug in low-level optimization "coalesceConsecutiveLeax".
Optimized the "* (byte/word *) ptr_or_array + k = ..." case.
Optimized array indexing when the index and the element size are
both unsigned bytes.
Floating point and long constants are now only emitted when they are
used by emitted code. This resolves double emissions that could happen
with an array of constants of those types.
Introduced itoa10(), utoa10(), ltoa10() and ultoa10(), which all
convert an integer to a decimal string, and made itoa(), utoa(),
ltoa() and ultoa() into macros that point to those functions, to
reduce the code size. (The current implementations only support
base 10.)
16-bit multiplications by 10 are now optimized by the use of a
specialized utility routine.
2019-01-01: Version 0.1.57 released
The invalid statement "(void *) p = q" is not a syntax error
anymore, but is now diagnosed as "l-value required as left operand
of assignment".
Reimplemented rand() as an Xorshift random number generator to
reduce the predictability of each of the 15 bits returned.
The previous implementation returned numbers that alternated between
even and odd.
Optimized assignments to long variables and to 4-byte structs.
Optimized some comparisons of byte-sized operands.
Fixed comparisons involving a signed byte and an unsigned 8-bit constant.
Invalid inline assembly array references of the form "var[var]"
are now rejected.
Suspended optimization "optimize8BitStackOps" because of a problem
concerning comparisons with a byte-sized function argument.
Modified optimization "storeLoad" so that a load of an absolute address
is assumed to deal with a volatile memory location, like an I/O port.
The USim simulator now accepts a --binary option to turn off translation
of carriage returns to line feeds when writing bytes to $FF00 (stdout).
2018-11-25: Version 0.1.56 released
CMOC now directly supports the generation of Dragon executables,
when the --dragon option is passed. CMOC's standard library is
expected to work on the Dragon. The float and double types are
not supported. The <disk.h> library is not supported.
Added itoa(), utoa(), ltoa() and ultoa() to the standard library
(declared in <cmoc.h>), although only base 10 is supported at
this time.
Fixed a bug with the substraction of a an immediate from a
pointer that caused the compiler to fail an assertion.
Fixed bad code generation in the case of a subtraction of
a pointer from an array name.
Fixed a bug that prevented a program from subtracting a value
of type T[] from a value of type const T *.
Fixed a bug in the USim 6809 simulator (used by CMOC for self-
testing) that incorrectly simulated indexed addressing of the
form A,R or B,R, where 8-bit accumulator A or B is used as the index.
USim took that 8-bit index as unsigned, when it really is signed on
a real 6809. See the end of page 3-28 of the Leventhal 6809 book.
Moved atoff() from the stdlib library to the float library.
readJoystickPositions() does not turn the audio back on anymore
after reading the positions.
The <cmoc.h> header file now defines the NULL macro, unless
it is already defined.
The delay() function does not preserve D anymore. Preserving D
is not necessary under CMOC's calling convention.
Stopped building a USim version of the float library.
2018-10-14: Version 0.1.55 released
Fixed a bug that gave an error when returning a non-const
pointer from a function that returns a const pointer (e.g.,
const char *f(char *p) { return p; }).
Fixed a bug where C errors would still be reported when
--deps-only was specified.
2018-10-04: Version 0.1.54 released
The compiler now tolerates the use of NULL (e.g., (void *) 0) in
contexts that expect a non-void pointer, e.g., int *p = NULL;
Additional optimizations of unsigned byte multiplications.
Added new function setPmodeGraphicsAddressEx(), which allows
the caller to change the screen buffer address for pcls() without
changing the currently displayed screen.
2018-09-20: Version 0.1.53 released
Fixed an OS-9 extern array problem by fixing the way the compiler
determines if a variable can go to the read-only section or not.
This determination does not depend on an array's initializer anymore.
Fixed a bug where an external variable declaration and a variable
definition of the same name were accepted even when they were not
of the same type.
Fixed a bug with the generation of some assignments involving an array
variable on the right side.
Added functions pmode(), screen(), rgb() and cmp() to the library that
ships with CMOC. These functions, which are close to their Color Basic
equivalents, are declared and documented in <coco.h>.
Function pcls() now takes only one argument. It used to take the screen
address, but does not anymore because it now uses the address passed to
pmode(). The latter must be called before calling pcls().
Removed misnamed function showPmode0() from <coco.h>: pmode() and
screen() should be used instead.
Fixed showGraphicsAddress() so that it supports PMODEs other than
PMODE 4. This requires passing a second argument, i.e., the new value
to assign to the SAM chip's V register. Using the pmode() and screen()
functions is easier however.
Added function setPmodeGraphicsAddress() that only changes the PMODE
graphics screen address without changing the graphics mode.
Fixed a crash that happened when the user program tried to typedef
a function instead of a function pointer, e.g., typedef void F();
Using a non-integer as an array subscript is now an error (as with GCC)
instead of a warning.
A warning is now issued when using a 32-bit array subscript. (Only the
low 16 bits of the value are used.)
Fixed the output format for Vectrex so that the resulting file is the
loadable binary, with the proper header.
2018-07-21: Version 0.1.52 released
Binary literals (e.g., `0b101010` for 42). Note that this feature is
not part of Standard C.
The --deps-only option does not emit code anymore.
Fixed a linking bug where inline assembly code would call a function
declared only by a prototype.
A warning is now issued when declaring a variable with both the
`extern' keyword and an initializer (e.g., extern int n = 1;).
An error is now issued when a declaration or typedef involves
an empty name (e.g., int a, ;).
Fixed a bug that prevented calling a function through a dereference
of the function's name(), e.g., void f() {} void g() { (*f)(); }
Hexadecimal literals prefixed with 0X (with a capital X) are now
supported. Invalid characters in such a literal are now properly
reported.
Bit fields are now accepted by the compiler, but each field is
allocated as a full char, int or long.
A prototype for main() does not cause a warning anymore.
Removed leading underscores from the names of assembly language
source files in directories src/stdlib and src/float.
Minor optimizations to the compiler's low-level optimizer.
writecocofile: