mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-07 20:50:42 +02:00
* give an error message when including a file starting with an UTF-8 BOM
in a compilation module parsed using a different code page, because this changes the default ansistring type and {$codepage xxx} is also not allowed in the middle of a unit (mantis #21445) git-svn-id: trunk@20488 -
This commit is contained in:
parent
2696c1f1d3
commit
a6a43c71ec
@ -135,7 +135,7 @@ general_f_oserror=01025_F_Operating system error: $1
|
||||
#
|
||||
# Scanner
|
||||
#
|
||||
# 02087 is the last used one
|
||||
# 02089 is the last used one
|
||||
#
|
||||
% \section{Scanner messages.}
|
||||
% This section lists the messages that the scanner emits. The scanner takes
|
||||
@ -374,6 +374,9 @@ scanner_w_illegal_warn_identifier=02087_W_Illegal identifier "$1" for $WARN dire
|
||||
scanner_e_illegal_alignment_directive=02088_E_Illegal alignment directive
|
||||
% The alignment directive is not valid. Either the alignment type is not known or the alignment
|
||||
% value is not a power of two.
|
||||
scanner_f_illegal_utf8_bom=02089_F_It is not possible to include a file that starts with an UTF-8 BOM in a module that uses a different code page
|
||||
% All source code that is part of a single compilation entity (program, library, unit) must be encoded
|
||||
% in the same code page
|
||||
% \end{description}
|
||||
#
|
||||
# Parser
|
||||
|
@ -110,6 +110,7 @@ const
|
||||
scan_w_multiple_main_name_overrides=02086;
|
||||
scanner_w_illegal_warn_identifier=02087;
|
||||
scanner_e_illegal_alignment_directive=02088;
|
||||
scanner_f_illegal_utf8_bom=02089;
|
||||
parser_e_syntax_error=03000;
|
||||
parser_e_dont_nest_interrupt=03004;
|
||||
parser_w_proc_directive_ignored=03005;
|
||||
@ -918,9 +919,9 @@ const
|
||||
option_info=11024;
|
||||
option_help_pages=11025;
|
||||
|
||||
MsgTxtSize = 62138;
|
||||
MsgTxtSize = 62257;
|
||||
|
||||
MsgIdxMax : array[1..20] of longint=(
|
||||
26,89,315,109,85,55,116,26,202,63,
|
||||
26,90,315,109,85,55,116,26,202,63,
|
||||
50,20,1,1,1,1,1,1,1,1
|
||||
);
|
||||
|
1197
compiler/msgtxt.inc
1197
compiler/msgtxt.inc
File diff suppressed because it is too large
Load Diff
@ -2657,6 +2657,13 @@ In case not, the value returned can be arbitrary.
|
||||
(ord((inputpointer+1)^)=$bb) and
|
||||
(ord((inputpointer+2)^)=$bf) then
|
||||
begin
|
||||
(* we don't support including files with an UTF-8 bom
|
||||
inside another file that wasn't encoded as UTF-8
|
||||
already (we don't support {$codepage xxx} switches in
|
||||
the middle of a file either) *)
|
||||
if (current_settings.sourcecodepage<>CP_UTF8) and
|
||||
not current_module.in_global then
|
||||
Message(scanner_f_illegal_utf8_bom);
|
||||
inc(inputpointer,3);
|
||||
message(scan_c_switching_to_utf8);
|
||||
current_settings.sourcecodepage:=CP_UTF8;
|
||||
|
Loading…
Reference in New Issue
Block a user