mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-12 16:50:39 +00:00
Work around a gcc5 bug
The old code produced crashes with gcc5 caused by calling the copy constructor (see https://bugzilla.redhat.com/show_bug.cgi?id=1260976). This has been filed as gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67557 It is currently being marked as invalid (they claim the code is not valid and produces undefined behaviour), but I don't think that this is correct. Fortunately i does not matter for us whether the old code was valid or not, since the new version is easier to understand and works with all compilers.
This commit is contained in:
parent
efe5e27692
commit
12ab5dd810
@ -205,7 +205,7 @@ docstring CompTag::writeTag() const
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
string fontToTag(html::FontTypes type)
|
string fontToTag(html::FontTypes type)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case FT_EMPH:
|
case FT_EMPH:
|
||||||
return "em";
|
return "em";
|
||||||
@ -245,68 +245,66 @@ string fontToTag(html::FontTypes type)
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
StartTag fontToStartTag(html::FontTypes type)
|
string fontToAttribute(html::FontTypes type)
|
||||||
{
|
{
|
||||||
string tag = fontToTag(type);
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case FT_EMPH:
|
case FT_EMPH:
|
||||||
return html::StartTag(tag);
|
|
||||||
case FT_BOLD:
|
case FT_BOLD:
|
||||||
return html::StartTag(tag);
|
return "";
|
||||||
case FT_NOUN:
|
case FT_NOUN:
|
||||||
return html::StartTag(tag, "class='lyxnoun'");
|
return "class='lyxnoun'";
|
||||||
case FT_UBAR:
|
case FT_UBAR:
|
||||||
return html::StartTag(tag);
|
return "";
|
||||||
case FT_DBAR:
|
case FT_DBAR:
|
||||||
return html::StartTag(tag, "class='dline'");
|
return "class='dline'";
|
||||||
case FT_SOUT:
|
case FT_SOUT:
|
||||||
return html::StartTag(tag, "class='strikeout'");
|
return "class='strikeout'";
|
||||||
case FT_WAVE:
|
case FT_WAVE:
|
||||||
return html::StartTag(tag, "class='wline'");
|
return "class='wline'";
|
||||||
case FT_ITALIC:
|
case FT_ITALIC:
|
||||||
return html::StartTag(tag);
|
return "";
|
||||||
case FT_UPRIGHT:
|
case FT_UPRIGHT:
|
||||||
return html::StartTag(tag, "style='font-style:normal;'");
|
return "style='font-style:normal;'";
|
||||||
case FT_SLANTED:
|
case FT_SLANTED:
|
||||||
return html::StartTag(tag, "style='font-style:oblique;'");
|
return "style='font-style:oblique;'";
|
||||||
case FT_SMALLCAPS:
|
case FT_SMALLCAPS:
|
||||||
return html::StartTag(tag, "style='font-variant:small-caps;'");
|
return "style='font-variant:small-caps;'";
|
||||||
case FT_ROMAN:
|
case FT_ROMAN:
|
||||||
return html::StartTag(tag, "style='font-family:serif;'");
|
return "style='font-family:serif;'";
|
||||||
case FT_SANS:
|
case FT_SANS:
|
||||||
return html::StartTag(tag, "style='font-family:sans-serif;'");
|
return "style='font-family:sans-serif;'";
|
||||||
case FT_TYPE:
|
case FT_TYPE:
|
||||||
return html::StartTag(tag, "style='font-family:monospace;'");
|
return "style='font-family:monospace;'";
|
||||||
case FT_SIZE_TINY:
|
case FT_SIZE_TINY:
|
||||||
case FT_SIZE_SCRIPT:
|
case FT_SIZE_SCRIPT:
|
||||||
case FT_SIZE_FOOTNOTE:
|
case FT_SIZE_FOOTNOTE:
|
||||||
return html::StartTag(tag, "style='font-size:x-small;'");
|
return "style='font-size:x-small;'";
|
||||||
case FT_SIZE_SMALL:
|
case FT_SIZE_SMALL:
|
||||||
return html::StartTag(tag, "style='font-size:small;'");
|
return "style='font-size:small;'";
|
||||||
case FT_SIZE_NORMAL:
|
case FT_SIZE_NORMAL:
|
||||||
return html::StartTag(tag, "style='font-size:normal;'");
|
return "style='font-size:normal;'";
|
||||||
case FT_SIZE_LARGE:
|
case FT_SIZE_LARGE:
|
||||||
return html::StartTag(tag, "style='font-size:large;'");
|
return "style='font-size:large;'";
|
||||||
case FT_SIZE_LARGER:
|
case FT_SIZE_LARGER:
|
||||||
case FT_SIZE_LARGEST:
|
case FT_SIZE_LARGEST:
|
||||||
return html::StartTag(tag, "style='font-size:x-large;'");
|
return "style='font-size:x-large;'";
|
||||||
case FT_SIZE_HUGE:
|
case FT_SIZE_HUGE:
|
||||||
case FT_SIZE_HUGER:
|
case FT_SIZE_HUGER:
|
||||||
return html::StartTag(tag, "style='font-size:xx-large;'");
|
return "style='font-size:xx-large;'";
|
||||||
case FT_SIZE_INCREASE:
|
case FT_SIZE_INCREASE:
|
||||||
return html::StartTag(tag, "style='font-size:larger;'");
|
return "style='font-size:larger;'";
|
||||||
case FT_SIZE_DECREASE:
|
case FT_SIZE_DECREASE:
|
||||||
return html::StartTag(tag, "style='font-size:smaller;'");
|
return "style='font-size:smaller;'";
|
||||||
}
|
}
|
||||||
// kill warning
|
// kill warning
|
||||||
return StartTag("");
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
FontTag::FontTag(FontTypes type)
|
FontTag::FontTag(FontTypes type)
|
||||||
: StartTag(fontToStartTag(type)), font_type_(type)
|
: StartTag(fontToTag(type), fontToAttribute(type)), font_type_(type)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,3 +109,5 @@ What's new
|
|||||||
|
|
||||||
* BUILD/INSTALLATION
|
* BUILD/INSTALLATION
|
||||||
|
|
||||||
|
- Work around gcc 5 bug 67557.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user