Revision: 73052
          http://sourceforge.net/p/brlcad/code/73052
Author:   starseeker
Date:     2019-05-13 15:21:04 +0000 (Mon, 13 May 2019)
Log Message:
-----------
Add a little more information reporting to the semchk error outputs

Modified Paths:
--------------
    brlcad/trunk/src/libbu/tests/semaphore.c
    brlcad/trunk/src/libbu/tests/semchk.cxx

Modified: brlcad/trunk/src/libbu/tests/semaphore.c
===================================================================
--- brlcad/trunk/src/libbu/tests/semaphore.c    2019-05-13 14:57:14 UTC (rev 
73051)
+++ brlcad/trunk/src/libbu/tests/semaphore.c    2019-05-13 15:21:04 UTC (rev 
73052)
@@ -28,7 +28,7 @@
 #include "bu.h"
 
 
-const int SEM = 1000; /* FIXME */
+const int SEM = BU_SEM_LAST+1;
 
 
 struct increment_thread_args {

Modified: brlcad/trunk/src/libbu/tests/semchk.cxx
===================================================================
--- brlcad/trunk/src/libbu/tests/semchk.cxx     2019-05-13 14:57:14 UTC (rev 
73051)
+++ brlcad/trunk/src/libbu/tests/semchk.cxx     2019-05-13 15:21:04 UTC (rev 
73052)
@@ -143,6 +143,8 @@
 
        working->pop();
 
+       //std::cerr << "Processing " << key << " -> " << val << "\n";
+
        if (semaphore_values.find(val) != semaphore_values.end()) {
 
            // The string value has a numerical definition - use it
@@ -171,6 +173,11 @@
                // value of yet. queue and continue
                next->push(key);
 
+               if (!key.length()) {
+                   std::cerr << "Empty key string??\n";
+                   exit(1);
+               }
+
            } else {
 
                std::string ekey = std::string(sem_exp[1]);
@@ -181,6 +188,7 @@
                ninc = strtol(einc.c_str(), &endptr, 0);
                if ((endptr != NULL && strlen(endptr) > 0) || errno == ERANGE) {
                    std::cerr << "Could not evalute expression number: " << 
einc << "\n";
+                   exit(1);
                }
 
                if (semaphore_values.find(ekey) != semaphore_values.end()) {
@@ -207,6 +215,10 @@
                    // yet, queue and continue
                    next->push(key);
 
+                   if (!key.length()) {
+                       std::cerr << "Empty key string??\n";
+                       exit(1);
+                   }
                }
            }
        }
@@ -217,7 +229,13 @@
            working = qtmp;
            if ((int)working->size() == wcnt) {
                // Infinite loop - we should always process at least one 
definition per pass
-               std::cerr << "Error processing semaphore definitions\n";
+               std::cerr << "Error processing semaphore definitions.  (Perhaps 
the regex pattern matching didn't catch a string being used as a 
semaphore?):\n";
+               while (!working->empty()) {
+                   key = working->front();
+                   val = (*sem_defs)[key];
+                   std::cerr << key << " -> " << val << "\n";
+                   working->pop();
+               }
                exit(-1);
            }
            wcnt = working->size();
@@ -283,6 +301,7 @@
        std::cerr << "Unable to open file list " << argv[1] << "\n";
     }
     while (std::getline(fs, sfile)) {
+       //std::cout << "Processing " << sfile << "\n";
        ret += process_file(&sem_defs, &sem_files, sfile);
     }
     fs.close();

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to