From e98c3e8143b818518120802346d5a6eb98ce0673 Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Mon, 20 Feb 2017 12:54:46 +0100
Subject: [PATCH] report warnings to user after compilation

Let the user see how many warnings a compilation generates.
The goal is to have 0 warning, for any compiled component
of openair.
---
 cmake_targets/tools/build_helper | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper
index 30cfa0c9fb2..ede8ef4196e 100755
--- a/cmake_targets/tools/build_helper
+++ b/cmake_targets/tools/build_helper
@@ -136,6 +136,20 @@ clean_all_files() {
 # Compilers
 ###################################
 
+#check_warnings:
+#    print error message if the compilation had warnings
+#argument:
+#    $1: log file
+check_warnings() {
+  #we look for 'warning:' in the compilation log file
+  #this is how gcc starts a warning
+  #this is not perfect, we may get false positive
+  warning_count=`grep "warning:" "$1"|wc -l`
+  if [ $warning_count -gt 0 ]; then
+    echo_error "WARNING: $warning_count warnings. See $1"
+  fi
+}
+
 compilations() {
   cd $OPENAIR_DIR/cmake_targets/$1/build
   set +e
@@ -153,6 +167,7 @@ compilations() {
   if [ -s $3 ] ; then
      cp $3 $4
      echo_success "$2 compiled"
+     check_warnings "$dlog/$2.$REL.txt"
   else
      echo_error "$2 compilation failed"
      exit 1
-- 
GitLab