Menu

gcc-3.4.x fixups for 1.0.7 sources

2004-07-21
2004-07-25
  • Nobody/Anonymous

    Here are some changes to get this closer to working.

    With this patch, I ran into problems linking. In particular, the symbol
    shm_unlink is referenced, but not defined. (See shared_memory.h: 775)

    Do you know where this is defined?

    best,
    benjamin

    2004-07-21  Benjamin Kosnik  <bkoz@redhat.com>

        * shared_memory.h (shared::bit_vector_buf): Remove repeated
        default template parameter argument from non-declarations.
        (shared::mappings): Same.
        * pooled_allocator.h (Pool::chunks): Same. Qualify base data
        members with this in derived classes.

    *** shared_memory.h.orig    2004-07-21 01:37:48.013020856 -0500
    --- shared_memory.h    2004-07-21 01:13:27.902991320 -0500
    *************** namespace mem_space {
    *** 696,705 ****
      //   template<allocator_key_t alloc_key, allocator_addr_t alloc_addr = 0>
      //   void* shared<alloc_key, alloc_addr>::buffers[shared::num_of_segments] = {0};
     
    !   template<allocator_key_t alloc_key, allocator_addr_t alloc_addr = 0>
        unsigned char shared<alloc_key, alloc_addr>::bit_vector_buff[shared::bit_vec_size] = {0};
     
    !   template<allocator_key_t alloc_key, allocator_addr_t alloc_addr = 0>
        std::map<std::string,
             std::pair<void*,struct stat> > shared<alloc_key, alloc_addr>::mappings;
     
    --- 696,705 ----
      //   template<allocator_key_t alloc_key, allocator_addr_t alloc_addr = 0>
      //   void* shared<alloc_key, alloc_addr>::buffers[shared::num_of_segments] = {0};
     
    !   template<allocator_key_t alloc_key, allocator_addr_t alloc_addr>
        unsigned char shared<alloc_key, alloc_addr>::bit_vector_buff[shared::bit_vec_size] = {0};
     
    !   template<allocator_key_t alloc_key, allocator_addr_t alloc_addr>
        std::map<std::string,
             std::pair<void*,struct stat> > shared<alloc_key, alloc_addr>::mappings;
     
    *** pooled_allocator.h.orig    2004-07-21 01:38:05.088425000 -0500
    --- pooled_allocator.h    2004-07-21 01:20:18.154623592 -0500
    *************** namespace pooled_allocator {
    *** 331,337 ****
        // static elements of class Pool
        template<class T,
              mem_space::allocator_key_t alloc_key,
    !        mem_space::allocator_addr_t alloc_addr=0>
        Chunk* Pool<T,alloc_key,alloc_addr>::chunks = 0; // list of allocated chunks
       
       
    --- 331,337 ----
        // static elements of class Pool
        template<class T,
              mem_space::allocator_key_t alloc_key,
    !        mem_space::allocator_addr_t alloc_addr>
        Chunk* Pool<T,alloc_key,alloc_addr>::chunks = 0; // list of allocated chunks
       
       
    *************** namespace pooled_allocator {
    *** 1541,1580 ****
          }; // assignment operator
          Container* attach(void);
          mem_space::map_index_t get_map_index(void) {
    !       return mem.get_map_index();
          };  // get_map_index(void)
          void set_map_index(mem_space::map_index_t mem_obj) {
    !       mem.set_map_index(mem_obj);
          };  // get_map_index(void)
          int get_proj_id() {
            mem_space::map_index_t mem_idx =
    !     mem.get_map_index();
            return mem_idx.get_proj_id();
          }
          int get_segment_page_num() {
            mem_space::map_index_t mem_idx =
    !     mem.get_map_index();
            return mem_idx.get_segment_page_num();
          }
          void lock(int segment_num, int segment_page_num) {
            // lock access to the shared memory container
    !       mem.lock(segment_num,segment_page_num);
          }
          void unlock(int segment_num, int segment_page_num) {
            // lock access to the shared memory container
    !       mem.unlock(segment_num,segment_page_num);
          }
          Chunk* get_chunks_list(void) {
            // return a pointer to the chunk list
    !       return mem.get_chunks_list();
          }
          void set_chunks_list(Chunk* chunks) {
            // set the pointer to the chunks list
    !       mem.set_chunks_list(chunks);
            return;
          }
          void shutdown(void) {
    !       mem.shutdown();
            return;
          }
        };  // class Multi_Process_Pool_alloc
    --- 1541,1580 ----
          }; // assignment operator
          Container* attach(void);
          mem_space::map_index_t get_map_index(void) {
    !       return this->mem.get_map_index();
          };  // get_map_index(void)
          void set_map_index(mem_space::map_index_t mem_obj) {
    !       this->mem.set_map_index(mem_obj);
          };  // get_map_index(void)
          int get_proj_id() {
            mem_space::map_index_t mem_idx =
    !     this->mem.get_map_index();
            return mem_idx.get_proj_id();
          }
          int get_segment_page_num() {
            mem_space::map_index_t mem_idx =
    !     this->mem.get_map_index();
            return mem_idx.get_segment_page_num();
          }
          void lock(int segment_num, int segment_page_num) {
            // lock access to the shared memory container
    !       this->mem.lock(segment_num,segment_page_num);
          }
          void unlock(int segment_num, int segment_page_num) {
            // lock access to the shared memory container
    !       this->mem.unlock(segment_num,segment_page_num);
          }
          Chunk* get_chunks_list(void) {
            // return a pointer to the chunk list
    !       return this->mem.get_chunks_list();
          }
          void set_chunks_list(Chunk* chunks) {
            // set the pointer to the chunks list
    !       this->mem.set_chunks_list(chunks);
            return;
          }
          void shutdown(void) {
    !       this->mem.shutdown();
            return;
          }
        };  // class Multi_Process_Pool_alloc
    *************** namespace pooled_allocator {
    *** 1865,1871 ****
             map_alloc.deallocate(map_p,1);
            // use  the map  in the  shared memory  class to  remove all
            // related shared memory segments
    !       mem.unlink();
          }
            }
          }
    --- 1865,1871 ----
             map_alloc.deallocate(map_p,1);
            // use  the map  in the  shared memory  class to  remove all
            // related shared memory segments
    !       this->mem.unlink();
          }
            }
          }

     
    • Marc Bumble

      Marc Bumble - 2004-07-22

      Hi Benjamin,

      shm_unlink is a function described on the shm_open man page.  I believe that it is misspelled on that man page as shm_inlink at the top, but corrected shortly thereafter.

      I am looking through the recommended patches.  In class Multi_Process_Pool_alloc, mem is an inherited attribute from the Pool_alloc class.  Why is the patch qualifying the attribute with this?  It seems redundant?  For example,

         mem.set_map_index(mem_obj);

      in the patch becomes

         this->mem.set_map_index(mem_obj);

      Where mem is an inherited attribute of the class where the method calling set_map_index() is being called.

      Does the gcc 3.4 compiler really have a problem?  It seems overly syntatically sugary and verbose.  The only changes to the pool_allocator.h file related to adding this-> qualifiers.

      I can not find this addition required by Stroustrup.  Can you point me to the correct page reference?

      Thanks,

      Marc

       
      • Nobody/Anonymous

        > I am looking through the recommended patches. In > class Multi_Process_Pool_alloc, mem is an inherited >attribute from the Pool_alloc class.

        This patch is correct for the stricter parser in 3.4.0, see dependant types and two phase lookup. With these additions, the code will compile with 3.3.x and 3.4.x gcc compilers.

        -benjamin

         
        • Marc Bumble

          Marc Bumble - 2004-07-25

          Benjamin,

            > see dependant types and two phase lookup

          I do appreciate the help, but I need to confirm the changes.  Where are "dependent types" and "two phase" lookup listed specifically with regard to the gcc parser or to C++?  I need a bibliographic reference please with the name of the article, the page number, etc. so that I can retrieve the source which describes there changes as necessary.  A substantive web page URL may suffice.

          Thanks,

          marc

           

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.