mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	 4ff3f20540
			
		
	
	
		4ff3f20540
		
	
	
	
	
		
			
			According to MSVC manual (*1), cl.exe can skip including a header file when that: - contains #pragma once, or - starts with #ifndef, or - starts with #if ! defined. GCC has a similar trick (*2), but it acts more stricter (e. g. there must be _no tokens_ outside of #ifndef...#endif). Sun C lacked #pragma once for a looong time. Oracle Developer Studio 12.5 finally implemented it, but we cannot assume such recent version. This changeset modifies header files so that each of them include strictly one #ifndef...#endif. I believe this is the most portable way to trigger compiler optimizations. [Bug #16770] *1: https://docs.microsoft.com/en-us/cpp/preprocessor/once *2: https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html
		
			
				
	
	
		
			55 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| #ifndef CONSTANT_H
 | |
| #define CONSTANT_H
 | |
| /**********************************************************************
 | |
| 
 | |
|   constant.h -
 | |
| 
 | |
|   $Author$
 | |
|   created at: Sun Nov 15 00:09:33 2009
 | |
| 
 | |
|   Copyright (C) 2009 Yusuke Endoh
 | |
| 
 | |
| **********************************************************************/
 | |
| #include "ruby/ruby.h"
 | |
| #include "id_table.h"
 | |
| 
 | |
| typedef enum {
 | |
|     CONST_DEPRECATED = 0x100,
 | |
| 
 | |
|     CONST_VISIBILITY_MASK = 0xff,
 | |
|     CONST_PUBLIC    = 0x00,
 | |
|     CONST_PRIVATE,
 | |
|     CONST_VISIBILITY_MAX
 | |
| } rb_const_flag_t;
 | |
| 
 | |
| #define RB_CONST_PRIVATE_P(ce) \
 | |
|     (((ce)->flag & CONST_VISIBILITY_MASK) == CONST_PRIVATE)
 | |
| #define RB_CONST_PUBLIC_P(ce) \
 | |
|     (((ce)->flag & CONST_VISIBILITY_MASK) == CONST_PUBLIC)
 | |
| 
 | |
| #define RB_CONST_DEPRECATED_P(ce) \
 | |
|     ((ce)->flag & CONST_DEPRECATED)
 | |
| 
 | |
| typedef struct rb_const_entry_struct {
 | |
|     rb_const_flag_t flag;
 | |
|     int line;
 | |
|     VALUE value;            /* should be mark */
 | |
|     VALUE file;             /* should be mark */
 | |
| } rb_const_entry_t;
 | |
| 
 | |
| VALUE rb_mod_private_constant(int argc, const VALUE *argv, VALUE obj);
 | |
| VALUE rb_mod_public_constant(int argc, const VALUE *argv, VALUE obj);
 | |
| VALUE rb_mod_deprecate_constant(int argc, const VALUE *argv, VALUE obj);
 | |
| void rb_free_const_table(struct rb_id_table *tbl);
 | |
| VALUE rb_const_source_location(VALUE, ID);
 | |
| 
 | |
| MJIT_SYMBOL_EXPORT_BEGIN
 | |
| int rb_autoloading_value(VALUE mod, ID id, VALUE *value, rb_const_flag_t *flag);
 | |
| rb_const_entry_t *rb_const_lookup(VALUE klass, ID id);
 | |
| VALUE rb_public_const_get_at(VALUE klass, ID id);
 | |
| VALUE rb_public_const_get_from(VALUE klass, ID id);
 | |
| int rb_public_const_defined_from(VALUE klass, ID id);
 | |
| VALUE rb_const_source_location_at(VALUE, ID);
 | |
| MJIT_SYMBOL_EXPORT_END
 | |
| 
 | |
| #endif /* CONSTANT_H */
 |