mirror of
				https://github.com/jart/cosmopolitan.git
				synced 2025-10-27 03:16:44 +00:00 
			
		
		
		
	Fix cosmopolitan.h for C++
We now have an integration test that runs the amalgamated sources through a C++ compiler, to prevent the recurrence of such issues. Fixes #38 Thanks @gbbnfhb for the report!
This commit is contained in:
		
							parent
							
								
									1ff9ab95ac
								
							
						
					
					
						commit
						3ab76b2312
					
				
					 3 changed files with 44 additions and 1 deletions
				
			
		|  | @ -17,5 +17,6 @@ bool32 GetComputerNameEx(/* enum/computernameformat.h */ int NameType, | ||||||
| #if ShouldUseMsabiAttribute() | #if ShouldUseMsabiAttribute() | ||||||
| #include "libc/nt/thunk/systeminfo.inc" | #include "libc/nt/thunk/systeminfo.inc" | ||||||
| #endif /* ShouldUseMsabiAttribute() */ | #endif /* ShouldUseMsabiAttribute() */ | ||||||
|  | COSMOPOLITAN_C_END_ | ||||||
| #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ | #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ | ||||||
| #endif /* COSMOPOLITAN_LIBC_NT_INFO_H_ */ | #endif /* COSMOPOLITAN_LIBC_NT_INFO_H_ */ | ||||||
|  |  | ||||||
							
								
								
									
										11
									
								
								test/libc/release/smokecxx.cc
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								test/libc/release/smokecxx.cc
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | int main() { | ||||||
|  |   int rc; | ||||||
|  |   FILE *f; | ||||||
|  |   f = fopen("/dev/null", "w"); | ||||||
|  |   fprintf(f, "hello world\n"); | ||||||
|  |   fclose(f); | ||||||
|  |   rc = system("exit 42"); | ||||||
|  |   CHECK_NE(-1, rc); | ||||||
|  |   CHECK_EQ(42, WEXITSTATUS(rc)); | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | @ -38,7 +38,38 @@ o/$(MODE)/test/libc/release/smoke.com.dbg:			\ | ||||||
| 		o/$(MODE)/ape/ape.o				\
 | 		o/$(MODE)/ape/ape.o				\
 | ||||||
| 		o/$(MODE)/cosmopolitan.a | 		o/$(MODE)/cosmopolitan.a | ||||||
| 
 | 
 | ||||||
|  | o/$(MODE)/test/libc/release/smokecxx.com:			\ | ||||||
|  | 		o/$(MODE)/test/libc/release/smokecxx.com.dbg | ||||||
|  | 	@objcopy -SO binary $< $@ | ||||||
|  | 
 | ||||||
|  | o/$(MODE)/test/libc/release/smokecxx.com.dbg:			\ | ||||||
|  | 		test/libc/release/smokecxx.cc			\
 | ||||||
|  | 		o/cosmopolitan.h				\
 | ||||||
|  | 		o/$(MODE)/ape/ape.lds				\
 | ||||||
|  | 		o/$(MODE)/libc/crt/crt.o			\
 | ||||||
|  | 		o/$(MODE)/ape/ape.o				\
 | ||||||
|  | 		o/$(MODE)/cosmopolitan.a | ||||||
|  | 	@ACTION=CXX build/compile $(CXX)			\
 | ||||||
|  | 		-o $@						\
 | ||||||
|  | 		-Os						\
 | ||||||
|  | 		-static						\
 | ||||||
|  | 		-no-pie						\
 | ||||||
|  | 		-fno-pie					\
 | ||||||
|  | 		-nostdlib					\
 | ||||||
|  | 		-nostdinc					\
 | ||||||
|  | 		-mno-red-zone					\
 | ||||||
|  | 		-Wl,--gc-sections				\
 | ||||||
|  | 		-Wl,-z,max-page-size=0x1000			\
 | ||||||
|  | 		-Wl,-T,o/$(MODE)/ape/ape.lds			\
 | ||||||
|  | 		-include o/cosmopolitan.h			\
 | ||||||
|  | 		test/libc/release/smokecxx.cc			\
 | ||||||
|  | 		o/$(MODE)/libc/crt/crt.o			\
 | ||||||
|  | 		o/$(MODE)/ape/ape.o				\
 | ||||||
|  | 		o/$(MODE)/cosmopolitan.a | ||||||
|  | 
 | ||||||
| .PHONY: o/$(MODE)/test/libc/release | .PHONY: o/$(MODE)/test/libc/release | ||||||
| o/$(MODE)/test/libc/release:					\ | o/$(MODE)/test/libc/release:					\ | ||||||
| 		o/$(MODE)/test/libc/release/smoke.com		\
 | 		o/$(MODE)/test/libc/release/smoke.com		\
 | ||||||
| 		o/$(MODE)/test/libc/release/smoke.com.runs | 		o/$(MODE)/test/libc/release/smoke.com.runs	\
 | ||||||
|  | 		o/$(MODE)/test/libc/release/smokecxx.com	\
 | ||||||
|  | 		o/$(MODE)/test/libc/release/smokecxx.com.runs | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue