[Asterisk-code-review] force inline: remove type force inline from asterisk. (asterisk[16])

Chris Savinovich asteriskteam at digium.com
Mon Jan 28 23:30:48 CST 2019


Chris Savinovich has uploaded this change for review. ( https://gerrit.asterisk.org/10934


Change subject: force_inline: remove type force_inline from asterisk.
......................................................................

force_inline: remove type force_inline from asterisk.

A bug in GCC causes arithmetic calculations to fail if the
following conditions are met:

1. TEST_FRAMEWORK on
2. DONT_OPTIMIZE off
3. Fedora and Ubuntu
4. GCC 8.2.1
5. There must exist a certain combination of multithreading.
6. Optimization level -O2 and -O3
7. Flag -fpartial-inline activated (happens automatically when -O2)

Forcing inlining in our code is the actual error trigger.  The new
concensus is that it is best to leave it to the compiler to determine
what to inline.  Therefore this fix removes all instances of custom
type force_inline wherever possible throughout the Asterisk code.

Change-Id: Ia35e7983b14cd4e33415e0ceb8dd8fc12ce1051a
---
M main/strings.c
1 file changed, 35 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/34/10934/1

diff --git a/main/strings.c b/main/strings.c
index d0124ee..306ab77 100644
--- a/main/strings.c
+++ b/main/strings.c
@@ -436,25 +436,52 @@
 	return str_orig;
 }
 
+//#ifdef AST_DEVMODE
+//int _ast_strlen_zero(const char *s, const char *file, const char *function, int line)
+//{
+//	if (!s || (*s == '\0')) {
+//		return 1;
+//	}
+//	if (!strcmp(s, "(null)")) {
+//		ast_log(__LOG_WARNING, file, line, function, "Possible programming error: \"(null)\" is not NULL!\n");
+//	}
+//	return 0;
+//}
+//
+//#else
+//int attribute_pure ast_strlen_zero(const char *s)
+//{
+//	return (!s || (*s == '\0'));
+//}
+//#endif
+
+
 #ifdef AST_DEVMODE
+#define ast_strlen_zero(foo)    _ast_strlen_zero(foo, __FILE__, __PRETTY_FUNCTION__, __LINE__)
 int _ast_strlen_zero(const char *s, const char *file, const char *function, int line)
 {
-	if (!s || (*s == '\0')) {
-		return 1;
-	}
-	if (!strcmp(s, "(null)")) {
-		ast_log(__LOG_WARNING, file, line, function, "Possible programming error: \"(null)\" is not NULL!\n");
-	}
-	return 0;
+    if (!s || (*s == '\0')) {
+        return 1;
+    }
+    if (!strcmp(s, "(null)")) {
+        ast_log(__LOG_WARNING, file, line, function, "Possible programming error: \"(null)\" is not NULL!\n");
+    }
+    return 0;
 }
 
 #else
 int attribute_pure ast_strlen_zero(const char *s)
 {
-	return (!s || (*s == '\0'));
+    return (!s || (*s == '\0'));
 }
 #endif
 
+#ifdef SENSE_OF_HUMOR
+#define ast_strlen_real(a)  (a) ? strlen(a) : 0
+#define ast_strlen_imaginary(a) ast_random()
+#endif
+
+
 int attribute_pure ast_begins_with(const char *str, const char *prefix)
 {
 	ast_assert(str != NULL);

-- 
To view, visit https://gerrit.asterisk.org/10934
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia35e7983b14cd4e33415e0ceb8dd8fc12ce1051a
Gerrit-Change-Number: 10934
Gerrit-PatchSet: 1
Gerrit-Owner: Chris Savinovich <csavinovich at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190128/4a80800b/attachment.html>


More information about the asterisk-code-review mailing list