]> git.mdlowis.com Git - archive/atc.git/commitdiff
Added coverage and profiling options fo rthe build and enabled warnings as errors
authorMike D. Lowis <mike.lowis@gentex.com>
Thu, 2 Apr 2015 14:03:18 +0000 (10:03 -0400)
committerMike D. Lowis <mike.lowis@gentex.com>
Thu, 2 Apr 2015 14:03:18 +0000 (10:03 -0400)
build.rb
modules/atf
source/runtime/gc.c
source/runtime/gc.h
source/runtime/heap.c
tests/test_segment.c

index 7508bde578944dd3a63ca7598ba15bc3d577b648..bae9118af590156de3c4d831b86590ecb57062b9 100755 (executable)
--- a/build.rb
+++ b/build.rb
@@ -13,6 +13,25 @@ base_env = BuildEnv.new do |env|
   env.build_dir('modules', 'build/obj/modules')
   # Setup include paths
   env['CPPPATH'] += Dir['source/**/', 'modules/atf/source/']
+  # Turn on all warnings and treat them as errors, Also C99 strict mode
+  env['CFLAGS'] += ['-Wall', '-Wextra', '-Werror']
+  # Enable debug symbols for test
+  if Opts[:profile].include? "test"
+    env['CFLAGS'] += ['-g', '-O0']
+  else
+    env['CFLAGS'] += ['-O3']
+  end
+  # Enable profiling info
+  if Opts[:profile].include? "profile"
+    env['CFLAGS'] += ['-pg']
+    env['LDFLAGS'] += ['-pg']
+  end
+
+  # Enable coverage info
+  if Opts[:profile].include? "coverage"
+    env['CFLAGS'] += ['--coverage']
+    env['LDFLAGS'] += ['--coverage']
+  end
 end
 
 #------------------------------------------------------------------------------
index 0110dca83199322915e157fc1278ee6b58dfb4f8..04d4571218dbef83a4321209c21b383defb9dc16 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 0110dca83199322915e157fc1278ee6b58dfb4f8
+Subproject commit 04d4571218dbef83a4321209c21b383defb9dc16
index 49e1410bffada54c763ef60a7da5ced5372ad3a0..da1a32d68b940fb9535a8934f5adaec125b27bac 100644 (file)
@@ -10,14 +10,24 @@ static heap_t* heap = NULL;
 
 void gc_init(void* stack_bottom)
 {
+    (void)stack_bottom;
     heap = heap_create();
 }
 
-void* gc_alloc(uint64_t objmap, size_t num_slots)
+void* gc_object(uint64_t objmap, size_t num_slots)
 {
+    (void)objmap;
     return heap_allocate(heap, num_slots+1);
 }
 
+void* gc_allocate(size_t size)
+{
+    size_t slot_sz   = sizeof(uintptr_t);
+    size_t remainder = size % slot_sz;
+    size_t num_slots = (size / slot_sz) + ((remainder == 0) ? 0 : (slot_sz - remainder));
+    return heap_allocate(heap, num_slots + 1);
+}
+
 void gc_collect(void)
 {
 }
@@ -27,5 +37,3 @@ void gc_shutdown(void)
     heap_destroy(heap);
 }
 
-/*****************************************************************************/
-
index dd14cc4042758ad9e728bbcd1d9f8722b1b7ab91..1e43fefff1d21531e47df2c1818f9d1efd5bcd12 100644 (file)
@@ -10,7 +10,9 @@
 
 void gc_init(void* stack_bottom);
 
-void* gc_alloc(uint64_t objmap, size_t size);
+void* gc_object(uint64_t objmap, size_t num_slots);
+
+void* gc_allocate(size_t size);
 
 void gc_collect(void);
 
index 27577259cb0005dc489c5facee36b4ca92bd0019..4378d7d16e1324f980010df27e33898a892e4223 100644 (file)
@@ -12,7 +12,7 @@ heap_t* heap_create(void)
 
 void heap_destroy(heap_t* heap)
 {
-    int i;
+    unsigned int i;
     block_t* current = heap->blocks;
     /* Free all the large blocks */
     while (NULL != current) {
index f0e01ac92a1db6cf638902eb5d2a0002215e8823..016e455fbbc5decdc548c4a502046c63ef5c87f5 100644 (file)
@@ -5,7 +5,7 @@ TEST_SUITE(Segment) {
     /* Verify: segment_create
      *************************************************************************/
     TEST(Verify_Create_allocates_and_initializes_a_segment) {
-        int i;
+        unsigned int i;
         segment_t* seg = segment_create(2u, NULL);
         CHECK(seg->blocksize == 2u);
         CHECK(seg->start != NULL);