builtin: remove `unused return` C warnings (#9797)
							parent
							
								
									8ab0d42b5f
								
							
						
					
					
						commit
						22351a6fb7
					
				
							
								
								
									
										4
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										4
									
								
								Makefile
								
								
								
								
							|  | @ -80,11 +80,11 @@ endif | ||||||
| all: latest_vc latest_tcc | all: latest_vc latest_tcc | ||||||
| ifdef WIN32 | ifdef WIN32 | ||||||
| 	$(CC) $(CFLAGS) -g -std=c99 -municode -w -o $(V) $(VC)/$(VCFILE) $(LDFLAGS) | 	$(CC) $(CFLAGS) -g -std=c99 -municode -w -o $(V) $(VC)/$(VCFILE) $(LDFLAGS) | ||||||
| 	$(V) -o v2.exe cmd/v | 	$(V) -o v2.exe $(VFLAGS) cmd/v | ||||||
| 	move /y v2.exe v.exe | 	move /y v2.exe v.exe | ||||||
| else | else | ||||||
| 	$(CC) $(CFLAGS) -g -std=gnu99 -w -o $(V) $(VC)/$(VCFILE) -lm -lpthread $(LDFLAGS) | 	$(CC) $(CFLAGS) -g -std=gnu99 -w -o $(V) $(VC)/$(VCFILE) -lm -lpthread $(LDFLAGS) | ||||||
| 	$(V) -o v2.exe cmd/v | 	$(V) -o v2.exe $(VFLAGS) cmd/v | ||||||
| 	mv -f v2.exe v   | 	mv -f v2.exe v   | ||||||
| endif | endif | ||||||
| 	@echo "V has been successfully built" | 	@echo "V has been successfully built" | ||||||
|  |  | ||||||
|  | @ -120,11 +120,12 @@ pub fn eprintln(s string) { | ||||||
| 				C.fprintf(C.stderr, c'%.*s\n', s.len, s.str) | 				C.fprintf(C.stderr, c'%.*s\n', s.len, s.str) | ||||||
| 			} | 			} | ||||||
| 		} $else { | 		} $else { | ||||||
|  | 			_ := 0 | ||||||
| 			if s.str == 0 { | 			if s.str == 0 { | ||||||
| 				C.write(2, c'eprintln(NIL)\n', 14) | 				_ = C.write(2, c'eprintln(NIL)\n', 14) | ||||||
| 			} else { | 			} else { | ||||||
| 				C.write(2, s.str, s.len) | 				_ = C.write(2, s.str, s.len) | ||||||
| 				C.write(2, c'\n', 1) | 				_ = C.write(2, c'\n', 1) | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		C.fflush(C.stderr) | 		C.fflush(C.stderr) | ||||||
|  | @ -157,10 +158,11 @@ pub fn eprint(s string) { | ||||||
| 				C.fprintf(C.stderr, c'%.*s', s.len, s.str) | 				C.fprintf(C.stderr, c'%.*s', s.len, s.str) | ||||||
| 			} | 			} | ||||||
| 		} $else { | 		} $else { | ||||||
|  | 			_ := 0 | ||||||
| 			if s.str == 0 { | 			if s.str == 0 { | ||||||
| 				C.write(2, c'eprint(NIL)', 11) | 				_ = C.write(2, c'eprint(NIL)', 11) | ||||||
| 			} else { | 			} else { | ||||||
| 				C.write(2, s.str, s.len) | 				_ = C.write(2, s.str, s.len) | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		C.fflush(C.stderr) | 		C.fflush(C.stderr) | ||||||
|  | @ -170,6 +172,7 @@ pub fn eprint(s string) { | ||||||
| // print prints a message to stdout. Unlike `println` stdout is not automatically flushed.
 | // print prints a message to stdout. Unlike `println` stdout is not automatically flushed.
 | ||||||
| // A call to `flush()` will flush the output buffer to stdout.
 | // A call to `flush()` will flush the output buffer to stdout.
 | ||||||
| pub fn print(s string) { | pub fn print(s string) { | ||||||
|  | 	_ := 0 | ||||||
| 	$if android { | 	$if android { | ||||||
| 		C.fprintf(C.stdout, c'%.*s', s.len, s.str) | 		C.fprintf(C.stdout, c'%.*s', s.len, s.str) | ||||||
| 	} $else $if ios { | 	} $else $if ios { | ||||||
|  | @ -178,7 +181,7 @@ pub fn print(s string) { | ||||||
| 	} $else $if freestanding { | 	} $else $if freestanding { | ||||||
| 		bare_print(s.str, u64(s.len)) | 		bare_print(s.str, u64(s.len)) | ||||||
| 	} $else { | 	} $else { | ||||||
| 		C.write(1, s.str, s.len) | 		_ = C.write(1, s.str, s.len) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -191,6 +194,7 @@ fn C.asl_log(voidptr, voidptr, int, charptr) | ||||||
| */ | */ | ||||||
| // println prints a message with a line end, to stdout. stdout is flushed.
 | // println prints a message with a line end, to stdout. stdout is flushed.
 | ||||||
| pub fn println(s string) { | pub fn println(s string) { | ||||||
|  | 	_ := 0 | ||||||
| 	if s.str == 0 { | 	if s.str == 0 { | ||||||
| 		$if android { | 		$if android { | ||||||
| 			C.fprintf(C.stdout, c'println(NIL)\n') | 			C.fprintf(C.stdout, c'println(NIL)\n') | ||||||
|  | @ -200,7 +204,7 @@ pub fn println(s string) { | ||||||
| 			bare_print(s.str, u64(s.len)) | 			bare_print(s.str, u64(s.len)) | ||||||
| 			bare_print(c'println(NIL)\n', 13) | 			bare_print(c'println(NIL)\n', 13) | ||||||
| 		} $else { | 		} $else { | ||||||
| 			C.write(1, c'println(NIL)\n', 13) | 			_ = C.write(1, c'println(NIL)\n', 13) | ||||||
| 		} | 		} | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
|  | @ -212,8 +216,8 @@ pub fn println(s string) { | ||||||
| 		bare_print(s.str, u64(s.len)) | 		bare_print(s.str, u64(s.len)) | ||||||
| 		bare_print(c'\n', 1) | 		bare_print(c'\n', 1) | ||||||
| 	} $else { | 	} $else { | ||||||
| 		C.write(1, s.str, s.len) | 		_ = C.write(1, s.str, s.len) | ||||||
| 		C.write(1, c'\n', 1) | 		_ = C.write(1, c'\n', 1) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue