Mail Archives: geda-user/2015/10/06/07:59:25
Hi,
gerbv does not compile with gcc5, giving ilnk time errors.
The root of the problem is the changes in the meaning of the inline
keyword from gcc5 onwards:
https://gcc.gnu.org/gcc-5/porting_to.html
Since selection.c defined inline functions which were never used in the
same translation unit, the function is actually never inlined and the
external function is always called. This is a very simple patch, but you
don't get the advantages of inlining.
Another possibility is to move the inlined function definitions to the
selection.h header file. That's what I did, but I'm not sure it's worth
the small gain in efficiency.
Anyaway here is the patch I have rigt now in my tree, disregard the "#if 0"
for selection_free_array(), it was simply to check that this function is
actually never used.
Gabriel
diff --git a/src/selection.c b/src/selection.c
index aaf2b04..2a8087e 100644
--- a/src/selection.c
+++ b/src/selection.c
@@ -32,39 +32,9 @@ GArray *selection_new_array (void)
return g_array_new (FALSE, FALSE, sizeof (gerbv_selection_item_t));
}
+#if 0
gchar *selection_free_array (gerbv_selection_info_t *sel_info)
{
return g_array_free (sel_info->selectedNodeArray, FALSE);
}
-
-inline guint selection_length (gerbv_selection_info_t *sel_info)
-{
- return sel_info->selectedNodeArray->len;
-}
-
-inline gerbv_selection_item_t selection_get_item_by_index (
- gerbv_selection_info_t *sel_info, guint idx)
-{
- return g_array_index (sel_info->selectedNodeArray,
- gerbv_selection_item_t, idx);
-}
-
-inline void selection_clear_item_by_index (
- gerbv_selection_info_t *sel_info, guint idx)
-{
- g_array_remove_index (sel_info->selectedNodeArray, idx);
-}
-
-inline void selection_clear (gerbv_selection_info_t *sel_info)
-{
- if (selection_length(sel_info))
- g_array_remove_range (sel_info->selectedNodeArray, 0,
- sel_info->selectedNodeArray->len);
-}
-
-inline void selection_add_item (gerbv_selection_info_t *sel_info,
- gerbv_selection_item_t *item)
-{
- g_array_append_val (sel_info->selectedNodeArray, *item);
-}
-
+#endif
diff --git a/src/selection.h b/src/selection.h
index 68148a0..db4631f 100644
--- a/src/selection.h
+++ b/src/selection.h
@@ -26,12 +26,34 @@
*/
GArray *selection_new_array (void);
-guint selection_length (gerbv_selection_info_t *sel_info);
-void selection_add_item (gerbv_selection_info_t *sel_info,
- gerbv_selection_item_t *item);
-gerbv_selection_item_t selection_get_item_by_index (
- gerbv_selection_info_t *sel_info, guint idx);
-void selection_clear_item_by_index (
- gerbv_selection_info_t *sel_info, guint idx);
-void selection_clear (gerbv_selection_info_t *sel_info);
+inline guint selection_length (gerbv_selection_info_t *sel_info)
+{
+ return sel_info->selectedNodeArray->len;
+}
+
+inline gerbv_selection_item_t selection_get_item_by_index (
+ gerbv_selection_info_t *sel_info, guint idx)
+{
+ return g_array_index (sel_info->selectedNodeArray,
+ gerbv_selection_item_t, idx);
+}
+
+inline void selection_clear_item_by_index (
+ gerbv_selection_info_t *sel_info, guint idx)
+{
+ g_array_remove_index (sel_info->selectedNodeArray, idx);
+}
+
+inline void selection_clear (gerbv_selection_info_t *sel_info)
+{
+ if (selection_length(sel_info))
+ g_array_remove_range (sel_info->selectedNodeArray, 0,
+ sel_info->selectedNodeArray->len);
+}
+
+inline void selection_add_item (gerbv_selection_info_t *sel_info,
+ gerbv_selection_item_t *item)
+{
+ g_array_append_val (sel_info->selectedNodeArray, *item);
+}
- Raw text -