[PATCH v2 2/2] Add Rust support to source highlighting

Tom de Vries tdevries@suse.de
Wed Sep 18 22:16:00 GMT 2019


On 17-09-19 20:23, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
> 
> Tom> Tested on openSUSE Leap 15.1, both with and without source-highlight
> Tom> package installed.
> 
> Tom> OK for 8.3 branch?
> 
> This looks fine to me, but I had two comments.
> 
> First, Joel pointed out earlier that backports require a tracking PR, so
> be sure to file one and mention it in the commit.
> 

Ack.  Filed https://sourceware.org/bugzilla/show_bug.cgi?id=25009
"terminate called after throwing an instance of
'srchilite::ParserException'".

> Second, up-thread you said:
> 
> Tom> This expection happens when the library attempts to access
> Tom> /usr/share/source-highlight/esc.outlang, which is not there, because
> Tom> it's contained in another package (source-highlight).
> 
> ... but the patch does:
> 
> Tom>  	      srchilite::SourceHighlight highlighter ("esc.outlang");
> Tom>  	      highlighter.setStyleFile("esc.style");
>  
> Tom> -	      std::ostringstream output;
> Tom> -	      highlighter.highlight (input, output, lang_name, fullname);
> Tom> +	      try
> Tom> +		{
> Tom> +		  std::ostringstream output;
> Tom> +		  highlighter.highlight (input, output, lang_name, fullname);
> 
> I am wondering if the "try" should encompass the construction of
> "highlighter".  It's possible that it works fine as-is, since maybe the
> argument isn't used until highlighting is attempted -- but I figured I
> would ask just to be sure.
> 

Well, it does work, but your question makes me realize that that's an
implementation artefact of the library, which could change for newer
version (or perhaps there are older versions where that differs). So it
should be safer to wrap highlighter construction as well.

Updated the patch accordingly, and also added a PR number to both patches.

Thanks,
- Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-with-static-standard-libraries-to-the-top-level.patch
Type: text/x-patch
Size: 4766 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20190918/aff7d895/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Add-Rust-support-to-source-highlighting.patch
Type: text/x-patch
Size: 5302 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20190918/aff7d895/attachment-0001.bin>


More information about the Gdb-patches mailing list