mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-31 15:43:01 +00:00 
			
		
		
		
	Fix some example issue and warnings under -Os.
This commit is contained in:
		
							
								
								
									
										4
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								Makefile
									
									
									
									
									
								
							| @@ -249,10 +249,12 @@ valgrind: $(JANET_TARGET) | |||||||
|  |  | ||||||
| test: $(JANET_TARGET) $(TEST_PROGRAMS) | test: $(JANET_TARGET) $(TEST_PROGRAMS) | ||||||
| 	for f in test/suite*.janet; do ./$(JANET_TARGET) "$$f" || exit; done | 	for f in test/suite*.janet; do ./$(JANET_TARGET) "$$f" || exit; done | ||||||
| 	$(JANET_TARGET) -k auxbin/jpm | 	for f in examples/*.janet; do ./$(JANET_TARGET) -k "$$f"; done | ||||||
|  | 	./$(JANET_TARGET) -k auxbin/jpm | ||||||
|  |  | ||||||
| valtest: $(JANET_TARGET) $(TEST_PROGRAMS) | valtest: $(JANET_TARGET) $(TEST_PROGRAMS) | ||||||
| 	for f in test/suite*.janet; do $(VALGRIND_COMMAND) ./$(JANET_TARGET) "$$f" || exit; done | 	for f in test/suite*.janet; do $(VALGRIND_COMMAND) ./$(JANET_TARGET) "$$f" || exit; done | ||||||
|  | 	for f in examples/*.janet; do ./$(JANET_TARGET) -k "$$f"; done | ||||||
| 	$(VALGRIND_COMMAND) ./$(JANET_TARGET) -k auxbin/jpm | 	$(VALGRIND_COMMAND) ./$(JANET_TARGET) -k auxbin/jpm | ||||||
|  |  | ||||||
| callgrind: $(JANET_TARGET) | callgrind: $(JANET_TARGET) | ||||||
|   | |||||||
| @@ -1,7 +1,5 @@ | |||||||
| # naive matrix implementation for testing typed array | # naive matrix implementation for testing typed array | ||||||
|  |  | ||||||
| (defmacro printf [& xs] ['print ['string/format (splice xs)]]) |  | ||||||
|  |  | ||||||
| (defn matrix [nrow ncol] {:nrow nrow :ncol ncol :array (tarray/new :float64 (* nrow ncol))}) | (defn matrix [nrow ncol] {:nrow nrow :ncol ncol :array (tarray/new :float64 (* nrow ncol))}) | ||||||
|  |  | ||||||
| (defn matrix/row [mat i] | (defn matrix/row [mat i] | ||||||
| @@ -34,16 +32,15 @@ | |||||||
|   ((matrix/row mat i) j)) |   ((matrix/row mat i) j)) | ||||||
|  |  | ||||||
| (defn matrix/get** [mat i j value] | (defn matrix/get** [mat i j value] | ||||||
|   ((matrix/column j) i)) |   ((matrix/column mat j) i)) | ||||||
|  |  | ||||||
|  |  | ||||||
| (defn tarray/print [array] | (defn tarray/print [arr] | ||||||
|   (def size (tarray/length array)) |   (def size (tarray/length arr)) | ||||||
|   (def buf @"") |   (prinf "[%2i]" size) | ||||||
|   (buffer/format buf "[%2i]" size) |  | ||||||
|   (for i 0 size |   (for i 0 size | ||||||
|        (buffer/format buf " %+6.3f " (array i))) |     (prinf " %+6.3f " (arr i))) | ||||||
|   (print buf)) |   (print)) | ||||||
|  |  | ||||||
| (defn matrix/print [mat] | (defn matrix/print [mat] | ||||||
|   (def {:nrow nrow :ncol ncol :array tarray} mat) |   (def {:nrow nrow :ncol ncol :array tarray} mat) | ||||||
| @@ -74,10 +71,3 @@ | |||||||
|   (printf "row properties:[%i]\n%p" i (tarray/properties (matrix/row A i)))) |   (printf "row properties:[%i]\n%p" i (tarray/properties (matrix/row A i)))) | ||||||
| (for i 0 nc   | (for i 0 nc   | ||||||
|   (printf "col properties:[%i]\n%p" i (tarray/properties (matrix/column A i)))) |   (printf "col properties:[%i]\n%p" i (tarray/properties (matrix/column A i)))) | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1030,7 +1030,7 @@ JanetSignal janet_step(JanetFiber *fiber, Janet in, Janet *out) { | |||||||
|     /* Check current opcode (sans debug flag). This tells us where the next or next two candidate |     /* Check current opcode (sans debug flag). This tells us where the next or next two candidate | ||||||
|      * instructions will be. Usually it's the next instruction in memory, |      * instructions will be. Usually it's the next instruction in memory, | ||||||
|      * but for branching instructions it is also the target of the branch. */ |      * but for branching instructions it is also the target of the branch. */ | ||||||
|     uint32_t *nexta = NULL, *nextb = NULL, olda, oldb; |     uint32_t *nexta = NULL, *nextb = NULL, olda = 0, oldb = 0; | ||||||
|  |  | ||||||
|     /* Set temporary breakpoints */ |     /* Set temporary breakpoints */ | ||||||
|     switch (*pc & 0x7F) { |     switch (*pc & 0x7F) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose