Skip to content

Missing file name sanitization in backends C and OCaml #325

@andreasabel

Description

@andreasabel

Using a file name like 1-foo-Bar2.cf breakes some backends:

  • C
gcc -g --ansi -W -Wall -Wno-unused-parameter -Wno-unused-function -Wno-unneeded-internal-declaration -D_POSIX_C_SOURCE=200809L  -c Lexer.c
Lexer.c:181:18: error: expected identifier or '('
extern yy_size_t 1-foo-Bar2leng;
                 ^
Lexer.c:183:14: error: expected identifier or '('
extern FILE *1-foo-Bar2in, *1-foo-Bar2out;
             ^
...
  • Ocaml
File "Abs1-foo-Bar2.ml", line 1:
Warning 24: bad source file name: "Abs1-foo-Bar2" is not a valid module name.
File "Skel1-foo-Bar2.ml", line 1:
Warning 24: bad source file name: "Skel1-foo-Bar2" is not a valid module name.
File "Skel1-foo-Bar2.ml", line 1, characters 12-13:
1 | module Skel1-foo-Bar2 = struct
                ^
Error: Syntax error

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions