warning elimination reported by clang
authorebensza <bence.janos.szabo@ericsson.com>
Thu, 12 May 2016 10:51:01 +0000 (12:51 +0200)
committerebensza <bence.janos.szabo@ericsson.com>
Thu, 12 May 2016 10:51:01 +0000 (12:51 +0200)
Signed-off-by: ebensza <bence.janos.szabo@ericsson.com>
common/memory.c
common/usage_stats.cc
compiler2/AST.cc
compiler2/PredefFunc.cc
compiler2/Type_codegen.cc
compiler2/ttcn3/compiler.y
core/ProfilerTools.cc
core/XER.hh
core2/Basetype2.cc
xsdconvert/AttributeType.hh

index b84a20824ed23f61c747cfe3471f98ac627f4969..b8cdf42b320bfc206ff65314f3145c1851a7a50a 100644 (file)
@@ -503,7 +503,9 @@ void Free(void *ptr)
     }
 }
 
+#ifdef MEMORY_DEBUG
 static const size_t maxprint = 32;
+#endif
 
 void check_mem_leak(const char *program_name)
 {
index 74bc47c907d7651e6ef08fa69d3c54ce6f6ae09c..4eb264a361e3efa8573e0344a01de13ac2dd27da 100644 (file)
@@ -117,7 +117,7 @@ std::string gethostnameFullyQualified ( void )
     }
 
     if( !domain[0] && NULL != (fp=fopen("/etc/defaultdomain","r")) ) {
-      fgets(domain, sizeof(domain), fp);
+      (void)fgets(domain, sizeof(domain), fp);
       fclose(fp);
     }
 
@@ -238,7 +238,7 @@ ssize_t process_http(int sockfd, const char *host, const char *page, const char
      "Content-length: %lu\r\n\r\n"
      "%s", page, host, (unsigned long)strlen(poststr), poststr);
 
-  write(sockfd, sendline, strlen(sendline));
+  (void)write(sockfd, sendline, strlen(sendline));
   /*while ((n = read(sockfd, recvline, MAXLINE)) > 0) {
     recvline[n] = '\0';
     printf("%s", recvline);
index 4c74e61dd1d7f987bdd819e16f393d3eb57b25e8..82686289f829e85b3b30aefd6995e1015ae5ff5d 100644 (file)
@@ -1037,19 +1037,19 @@ namespace Common {
     // All we can do is store NULLs for the unused namespaces.
     size_t num_xml_namespaces = namespaces.size();
     if (moduletype == MOD_TTCN) { //TODO remove this when ASN.1 gets EXER
-      output->source.global_vars = mputprintf(output->source.global_vars,
 #ifndef NDEBUG
+      output->source.global_vars = mputprintf(output->source.global_vars,
         "// written by %s in " __FILE__ " at %d\n"
-#endif
-        "static const size_t num_namespaces = %lu;\n"
-#ifndef NDEBUG
         , __FUNCTION__, __LINE__
-#endif
-        , (unsigned long)num_xml_namespaces
       );
+#endif
+
       if (num_xml_namespaces != 0 || (control_ns && control_ns_prefix)) {
-        output->source.global_vars = mputstr(output->source.global_vars,
-          "static const namespace_t xml_namespaces[num_namespaces+1] = {\n");
+        output->source.global_vars = mputprintf(output->source.global_vars,
+          "static const size_t num_namespaces = %lu;\n"
+          "static const namespace_t xml_namespaces[num_namespaces+1] = {\n"
+          , (unsigned long)num_xml_namespaces
+        );
         for (size_t i=0; i < namespaces.size(); ++i) {
           if (used_namespaces.has_key(i)) {
             output->source.global_vars = mputprintf(output->source.global_vars,
index 8252f49a2c2266617d2c8a82477d439c7b70d2c8..2a36c8877af3bc6c47c4acfd0a01ab20aae21442 100644 (file)
@@ -751,7 +751,7 @@ string* remove_bom(const string& encoded_value)
 {
   size_t length = encoded_value.size();
   if (0 == length) return new string();
-  if (length % 2 || 0 > length) {
+  if (length % 2) {
     ERROR("remove_bom(): Wrong string. The number of nibbles (%d) in string "
                 "shall be divisible by 2", static_cast<int>(length));
     return new string(encoded_value);
@@ -819,7 +819,7 @@ string* get_stringencoding(const string& encoded_value)
 {
   size_t length = encoded_value.size();
   if (0 == length) return new string("<unknown>");
-  if (length % 2 || 0 > length) {
+  if (length % 2) {
     ERROR("get_stringencoding(): Wrong string. The number of nibbles (%d) in string "
                 "shall be divisible by 2", static_cast<int>(length));
     return new string("<unknown>");
index 674e133721f5da0cf8e1de498fc6f2861063a5fa..170ec49df90ce8e6d2a1b460e35deb31dd01e0af 100644 (file)
@@ -3037,7 +3037,7 @@ void Type::generate_json_schema_array(JSON_Tokenizer& json)
       "\"record of\"" : "\"set of\"");
   } else {
     // set the number of elements for arrays
-    char* size_str = mprintf("%lu", get_nof_comps());
+    char* size_str = mprintf("%zu", get_nof_comps());
     json.put_next_token(JSON_TOKEN_NAME, "minItems");
     json.put_next_token(JSON_TOKEN_NUMBER, size_str);
     json.put_next_token(JSON_TOKEN_NAME, "maxItems");
index 66ef6511efbbb112da8f97cb6506bb079cf7f9d8..1f56362b50217781bfbea4481e4ae662286308f6 100644 (file)
@@ -8746,7 +8746,7 @@ PredefinedOps:
   {
     if ($3->get_nof_logargs() != 1) {
       Location loc(infile, @1);
-      loc.error("The any2unistr function takes exactly one argument, not %lu.",
+      loc.error("The any2unistr function takes exactly one argument, not %zu.",
         $3->get_nof_logargs());
         delete $3;
         $$ = new Value(Value::OPTYPE_ANY2UNISTR, new LogArguments());
index cf70300eacee500a2062e1eccbaf332a65e96966..a8cd12dd68befbff736ed9db45eed8838f5f9bed 100644 (file)
@@ -896,7 +896,7 @@ namespace Profiler_Tools {
 
       // number of lines and functions
       if (p_flags & STATS_NUMBER_OF_LINES) {
-        line_func_count_str = mputprintf(line_func_count_str, "%s:\t%lu lines,\t%lu functions\n",
+        line_func_count_str = mputprintf(line_func_count_str, "%s:\t%zu lines,\t%zu functions\n",
            p_db[i].filename, p_db[i].lines.size(), p_db[i].functions.size());
       }
       total_code_lines += p_db[i].lines.size();
@@ -905,7 +905,7 @@ namespace Profiler_Tools {
     if (p_flags & STATS_NUMBER_OF_LINES) {
       line_func_count_str = mputprintf(line_func_count_str,
         "--------------------------------------\n"
-        "Total:\t%lu lines,\t%lu functions\n", total_code_lines, total_functions);
+        "Total:\t%zu lines,\t%zu functions\n", total_code_lines, total_functions);
     }
 
     if (p_flags & (STATS_TOP10_ALL_DATA | STATS_ALL_DATA_SORTED)) {
index 80d220cf081718dca851a14d7fafe01878cfe7a4..efc41a4afeff486793f48cb2f1a0a817d207a67f 100644 (file)
@@ -25,7 +25,7 @@ class XmlReaderWrap;
 class Base_Type;
 #ifdef TITAN_RUNTIME_2
 class Record_Of_Type;
-class Erroneous_descriptor_t;
+struct Erroneous_descriptor_t;
 #else
 namespace PreGenRecordOf {
   class PREGEN__RECORD__OF__UNIVERSAL__CHARSTRING;
index 0af50fb2c2af4a748dad2e92dfc832437db03d57..1ddac029f5783313b5f287a4906a5fc9638c986f 100644 (file)
@@ -6006,7 +6006,7 @@ int Record_Type::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer&
     }
   }
   
-  delete metainfo;
+  delete[] metainfo;
   
   return dec_len;
 }
index 5a58fe76b2cafc964845dff42ae85d3155af770b..3ab8072e1be92730ef65baf2a2f4ee954396f2cd 100644 (file)
@@ -100,6 +100,9 @@ public:
     return isAnyAttr;
   }
 
+  void printToFile(FILE* file) {
+    printToFile(file, 0);
+  }
   void printToFile(FILE* file, unsigned level);
 
   void dump(unsigned int depth) const;
This page took 0.030194 seconds and 5 git commands to generate.