pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: pkgsrc/inputmethod/librime
Hello,
With the alignment attribute patch, compilation failed on NetBSD 6.1.5.
[ 33%] Building CXX object src/CMakeFiles/rime.dir/dict/table.cc.o
/home/pkgsrc/inputmethod/librime/work/librime/src/dict/table.cc:406:95: error: alignment may not be specified for 'entry'
*** Error code 1
However, changing attribute position fixes this problem.
1. current patch -> __attribute__ is placed *before* the type name(table::Entry).
bool Table::BuildEntry(const DictEntry &dict_entry, __attribute__((aligned(1))) table::Entry *entry) {
2. modified to build succeed -> __attribute__ is placed *after* the type name(table::Entry).
bool Table::BuildEntry(const DictEntry &dict_entry, table::Entry * __attribute__((aligned(1))) entry) {
I have tested and confirmed build success on
- NetBSD 6.1.5 : gcc version 4.5.3 (NetBSD nb2 20110806)
- NetBSD current(7.99.9) : gcc version 4.8.4 (nb2 20150115)
- Mac OS X 10.10 : Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
New patch-src_dict_table.cc is below. Can I commit this?
$NetBSD$
--- src/dict/table.cc.orig 2013-11-10 19:20:21.000000000 +0900
+++ src/dict/table.cc 2015-04-21 08:49:37.000000000 +0900
@@ -403,14 +403,15 @@
return true;
}
-bool Table::BuildEntry(const DictEntry &dict_entry, table::Entry *entry) {
+bool Table::BuildEntry(const DictEntry &dict_entry, table::Entry * __attribute__((aligned(1))) entry) {
if (!entry)
return false;
if (!CopyString(dict_entry.text, &entry->text)) {
LOG(ERROR) << "Error creating table entry '" << dict_entry.text << "'; file size: " << file_size();
return false;
}
- entry->weight = static_cast<float>(dict_entry.weight);
+ float weight = static_cast<float>(dict_entry.weight);
+ memcpy(&entry->weight, &weight, sizeof(weight));
return true;
}
On Tue, 14 Apr 2015 23:38:05 +0900,
"Joerg Sonnenberger" <joerg%netbsd.org@localhost> wrote:
>
> Module Name: pkgsrc
> Committed By: joerg
> Date: Tue Apr 14 14:38:05 UTC 2015
>
> Modified Files:
> pkgsrc/inputmethod/librime: Makefile distinfo
> Added Files:
> pkgsrc/inputmethod/librime/patches: patch-src_dict_table.cc
>
> Log Message:
> Entries in the output file are generally not correctly aligned, so tell
> the compiler explicitly about this fact and use memcpy for writing the
> data. Bump revision.
Kind regards,
HIRAMATSU, Yoshifumi
Home |
Main Index |
Thread Index |
Old Index