Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:19
erlang
1241-parsetools-Fix-compiler-warning-in-generat...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1241-parsetools-Fix-compiler-warning-in-generated-code.patch of Package erlang
From bf49f816ef9e6f362d777f89d5f7720f951485f4 Mon Sep 17 00:00:00 2001 From: Hans Bolinder <hasse@erlang.org> Date: Tue, 1 Jun 2021 12:41:06 +0200 Subject: [PATCH] parsetools: Fix compiler warning in generated code See also https://github.com/erlang/otp/issues/4918. --- lib/parsetools/src/leex.erl | 5 ++++- lib/parsetools/test/leex_SUITE.erl | 25 +++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/lib/parsetools/src/leex.erl b/lib/parsetools/src/leex.erl index 90d1b9f71e..37f3fb7114 100644 --- a/lib/parsetools/src/leex.erl +++ b/lib/parsetools/src/leex.erl @@ -1547,7 +1547,10 @@ pack_trans(Trs) -> pack_trans(Trs, []). %% Trs1. pack_trans([{{C,C},S}|Trs], Pt) -> % Singletons to the head - pack_trans(Trs, [{C,S}|Pt]); + case lists:member({C,S}, Pt) of + true -> pack_trans(Trs, Pt); + false -> pack_trans(Trs, [{C,S}|Pt]) + end; %% Special detection and handling of $\n. pack_trans([{{Cf,$\n},S}|Trs], Pt) -> pack_trans([{{Cf,$\n-1},S}|Trs], [{$\n,S}|Pt]); diff --git a/lib/parsetools/test/leex_SUITE.erl b/lib/parsetools/test/leex_SUITE.erl index 90ab770138..d03ff30127 100644 --- a/lib/parsetools/test/leex_SUITE.erl +++ b/lib/parsetools/test/leex_SUITE.erl @@ -45,7 +45,8 @@ pt/1, man/1, ex/1, ex2/1, not_yet/1, line_wrap/1, - otp_10302/1, otp_11286/1, unicode/1, otp_13916/1]). + otp_10302/1, otp_11286/1, unicode/1, otp_13916/1, + compiler_warnings/1]). % Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(1)). @@ -67,7 +68,8 @@ all() -> groups() -> [{checks, [], [file, compile, syntax]}, {examples, [], [pt, man, ex, ex2, not_yet, unicode]}, - {tickets, [], [otp_10302, otp_11286, otp_13916]}, + {tickets, [], [otp_10302, otp_11286, otp_13916, + compiler_warnings]}, {bugs, [], [line_wrap]}]. init_per_suite(Config) -> @@ -1131,6 +1133,26 @@ otp_17023(Config) -> ?line run(Config, Ts), ok. +%% OTP-17499. GH-4918. +compiler_warnings(Config) -> + Xrl = + <<" +Definitions. +Rules. +/(\\\\.|[^\\\\/]|\\[(/|\\\\.|[^\\\\/])+\\]|\\((\\\\.|/|[^\\\\/])+\\)+)*/ : a. +/\\*([^*][\\r\\n]|(\\*+([^*/]|[\\r\\n])))*\\*+/ : b. +Erlang code. + ">>, + Dir = ?privdir, + XrlFile = filename:join(Dir, "compiler_warnings.xrl"), + ok = file:write_file(XrlFile, Xrl), + ErlFile = filename:join(Dir, "compiler_warnings.erl"), +erlang:display({xrlfile,XrlFile}), + {ok, _} = leex:file(XrlFile, []), +erlang:display({erlfile,ErlFile}), + {ok, compiler_warnings, []} = compile:file(ErlFile, [return]), + ok. + start_node(Name, Args) -> [_,Host] = string:tokens(atom_to_list(node()), "@"), ct:log("Trying to start ~w@~s~n", [Name,Host]), -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor